Modified: lenya/trunk/org.apache.lenya.module.linkcheck/src/main/java/org/apache/lenya/cms/cocoon/generation/LinkStatusGenerator.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.module.linkcheck/src/main/java/org/apache/lenya/cms/cocoon/generation/LinkStatusGenerator.java?rev=742672&r1=742671&r2=742672&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.module.linkcheck/src/main/java/org/apache/lenya/cms/cocoon/generation/LinkStatusGenerator.java (original)
+++ lenya/trunk/org.apache.lenya.module.linkcheck/src/main/java/org/apache/lenya/cms/cocoon/generation/LinkStatusGenerator.java Mon Feb 9 18:49:13 2009
@@ -16,62 +16,53 @@
*/
package org.apache.lenya.cms.cocoon.generation;
-import org.apache.cocoon.generation.ServiceableGenerator;
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.net.URLConnection;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
import org.apache.avalon.excalibur.pool.Recyclable;
-import org.apache.avalon.framework.parameters.Parameters;
import org.apache.avalon.framework.configuration.Configurable;
import org.apache.avalon.framework.configuration.Configuration;
import org.apache.avalon.framework.configuration.ConfigurationException;
+import org.apache.avalon.framework.parameters.Parameters;
+import org.apache.cocoon.Constants;
import org.apache.cocoon.ProcessingException;
import org.apache.cocoon.environment.ObjectModelHelper;
import org.apache.cocoon.environment.Request;
import org.apache.cocoon.environment.SourceResolver;
-import org.apache.cocoon.Constants;
+import org.apache.cocoon.generation.ServiceableGenerator;
import org.apache.commons.lang.StringUtils;
import org.apache.excalibur.source.Source;
-import org.apache.lenya.cms.publication.DocumentFactory;
-import org.apache.lenya.cms.publication.DocumentUtil;
-import org.apache.lenya.cms.repository.RepositoryException;
-import org.apache.lenya.cms.repository.RepositoryManager;
-import org.apache.lenya.cms.repository.RepositoryUtil;
-import org.apache.lenya.cms.repository.Session;
+import org.apache.lenya.cms.publication.Repository;
import org.apache.regexp.RE;
import org.apache.regexp.RESyntaxException;
-
import org.xml.sax.SAXException;
import org.xml.sax.helpers.AttributesImpl;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.BufferedReader;
-import java.io.InputStreamReader;
-import java.net.URLConnection;
-import java.net.HttpURLConnection;
-import java.net.URL;
-import java.util.Map;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.ArrayList;
-
/**
*Generates a list of links that are reachable from the src and their status.
- *
+ *
* <pre>
- * <map:generator name="linkStatus" src="org.apache.lenya.cms.cocoon.generation.LinkStatusGenerator"/>
- *
- * <map:generate type="linkStatus" src="/{pubid}/{area}/{doc-id}.html">
- * <map:parameter name="depth" value="1"/>
+ * <map:generator name="linkStatus" src="org.apache.lenya.cms.cocoon.generation.LinkStatusGenerator"/>
+ * <map:generate type="linkStatus" src="/{pubid}/{area}/{doc-id}.html">
+ * <map:parameter name="depth" value="1"/>
* </map:generate>
* </pre>
-**/
+ **/
-public class LinkStatusGenerator extends ServiceableGenerator
- implements Recyclable, Configurable {
+public class LinkStatusGenerator extends ServiceableGenerator implements Recyclable, Configurable {
/** The URI of the namespace of this generator. */
- protected static final String URI =
- "http://apache.org/cocoon/linkstatus/2.0";
+ protected static final String URI = "http://apache.org/cocoon/linkstatus/2.0";
/** The namespace prefix for this namespace. */
protected static final String PREFIX = "linkstatus";
@@ -91,9 +82,9 @@
/**
* Config element name specifying expected link content-typ.
* <p>
- * Its value is <code>link-content-type</code>.
+ * Its value is <code>link-content-type</code>.
* </p>
- *
+ *
* @since
*/
public final static String LINK_CONTENT_TYPE_CONFIG = "link-content-type";
@@ -101,29 +92,28 @@
/**
* Default value of <code>link-content-type</code> configuration value.
* <p>
- * Its value is <code>application/x-cocoon-links</code>.
+ * Its value is <code>application/x-cocoon-links</code>.
* </p>
- *
+ *
* @since
*/
public final String LINK_CONTENT_TYPE_DEFAULT = "application/x-cocoon-links";
/**
- * Config element name specifying query-string appendend for requesting links
- * of an URL.
+ * Config element name specifying query-string appendend for requesting links of an URL.
* <p>
- * Its value is <code>link-view-query</code>.
+ * Its value is <code>link-view-query</code>.
* </p>
- *
+ *
* @since
*/
public final static String LINK_VIEW_QUERY_CONFIG = "link-view-query";
/**
* Default value of <code>link-view-query</code> configuration value.
* <p>
- * Its value is <code>?cocoon-view=links</code>.
+ * Its value is <code>?cocoon-view=links</code>.
* </p>
- *
+ *
* @since
*/
public final static String LINK_VIEW_QUERY_DEFAULT = "cocoon-view=links";
@@ -131,9 +121,9 @@
/**
* Config element name specifying excluding regular expression pattern.
* <p>
- * Its value is <code>exclude</code>.
+ * Its value is <code>exclude</code>.
* </p>
- *
+ *
* @since
*/
public final static String EXCLUDE_CONFIG = "exclude";
@@ -141,9 +131,9 @@
/**
* Config element name specifying including regular expression pattern.
* <p>
- * Its value is <code>include</code>.
+ * Its value is <code>include</code>.
* </p>
- *
+ *
* @since
*/
public final static String INCLUDE_CONFIG = "include";
@@ -151,15 +141,15 @@
/**
* Config element name specifying http header value for user-Agent.
* <p>
- * Its value is <code>user-agent</code>.
+ * Its value is <code>user-agent</code>.
* </p>
- *
+ *
* @since
*/
public final static String USER_AGENT_CONFIG = "user-agent";
/**
* Default value of <code>user-agent</code> configuration value.
- *
+ *
* @see org.apache.cocoon.Constants#COMPLETE_NAME
* @since
*/
@@ -168,18 +158,18 @@
/**
* Config element name specifying http header value for accept.
* <p>
- * Its value is <code>accept</code>.
+ * Its value is <code>accept</code>.
* </p>
- *
+ *
* @since
*/
public final static String ACCEPT_CONFIG = "accept";
/**
* Default value of <code>accept</code> configuration value.
* <p>
- * Its value is <code>* / *</code>
+ * Its value is <code>* / *</code>
* </p>
- *
+ *
* @since
*/
public final static String ACCEPT_DEFAULT = "*/*";
@@ -191,14 +181,15 @@
private HashSet crawled;
private HashSet linksToProcess;
-
+
/** The depth parameter determines how deep the EnhancedLinkStatusGenerator should delve. */
protected int depth = 1;
-
+
protected Source inputSource;
String src;
- private DocumentFactory identityMap;
- private RepositoryManager repositoryManager;
+ private Repository repository;
+
+ private org.apache.lenya.cms.publication.Session session;
/**
* Stores links to process and the referrer links
@@ -221,7 +212,7 @@
public String getReferrer() {
return referrer;
}
-
+
public int getDepth() {
return linkDepth;
}
@@ -234,29 +225,30 @@
/**
* Configure the crawler component.
* <p>
- * Configure can specify which URI to include, and which URI to exclude
- * from crawling. You specify the patterns as regular expressions.
+ * Configure can specify which URI to include, and which URI to exclude from crawling. You
+ * specify the patterns as regular expressions.
* </p>
* <p>
- * Morover you can configure
- * the required content-type of crawling request, and the
- * query-string appended to each crawling request.
+ * Morover you can configure the required content-type of crawling request, and the query-string
+ * appended to each crawling request.
* </p>
- * <pre><tt>
+ *
+ * <pre>
+ * <tt>
* <include>.*\.html?</include> or <include>.*\.html?, .*\.xsp</include>
* <exclude>.*\.gif</exclude> or <exclude>.*\.gif, .*\.jpe?g</exclude>
* <link-content-type> application/x-cocoon-links </link-content-type>
* <link-view-query> ?cocoon-view=links </link-view-query>
* <user-agent> Cocoon </user-agent>
* <accept> text/xml </accept>
- * </tt></pre>
- *
- * @param configuration XML configuration of this avalon component.
- * @exception ConfigurationException is throwing if configuration is invalid.
+ * </tt>
+ * </pre>
+ *
+ * @param configuration XML configuration of this avalon component.
+ * @exception ConfigurationException is throwing if configuration is invalid.
* @since
*/
- public void configure(Configuration configuration)
- throws ConfigurationException {
+ public void configure(Configuration configuration) throws ConfigurationException {
Configuration[] children;
children = configuration.getChildren(INCLUDE_CONFIG);
@@ -271,8 +263,8 @@
this.includeCrawlingURL.add(new RE(tokenized_pattern));
}
} catch (RESyntaxException rese) {
- getLogger().error("Cannot create including regular-expression for " +
- pattern, rese);
+ getLogger().error("Cannot create including regular-expression for " + pattern,
+ rese);
}
}
}
@@ -289,8 +281,8 @@
this.excludeCrawlingURL.add(new RE(tokenized_pattern));
}
} catch (RESyntaxException rese) {
- getLogger().error("Cannot create excluding regular-expression for " +
- pattern, rese);
+ getLogger().error("Cannot create excluding regular-expression for " + pattern,
+ rese);
}
}
} else {
@@ -317,40 +309,31 @@
}
public void setup(SourceResolver resolver, Map objectModel, String src, Parameters par)
- throws ProcessingException, SAXException, IOException {
-
+ throws ProcessingException, SAXException, IOException {
+
Request request = ObjectModelHelper.getRequest(objectModel);
- Session session;
- try {
- session = RepositoryUtil.getSession(getRepositoryManager(), request);
- } catch (RepositoryException e) {
- throw new ProcessingException(e);
- }
- this.identityMap = DocumentUtil.createDocumentFactory(session);
+ this.session = this.repository.getSession(request);
super.setup(resolver, objectModel, src, par);
this.src = src;
this.depth = par.getParameterAsInteger("depth", 1);
-
+
/* Create a reusable attributes for creating nodes */
this.attributes = new AttributesImpl();
}
/**
* Generate XML data.
- *
- * @throws SAXException
- * if an error occurs while outputting the document
- * @throws ProcessingException
- * if the requsted URI wasn't found
- */
- public void generate()
- throws SAXException, ProcessingException {
-
+ *
+ * @throws SAXException if an error occurs while outputting the document
+ * @throws ProcessingException if the requsted URI wasn't found
+ */
+ public void generate() throws SAXException, ProcessingException {
+
crawled = new HashSet();
linksToProcess = new HashSet();
- //this first node should be handled as a cocoon source
+ // this first node should be handled as a cocoon source
String root = this.src;
URL tempurl = null;
linksToProcess.add(new Link(root, "", 0));
@@ -363,7 +346,8 @@
this.contentHandler.startPrefixMapping(PREFIX, URI);
attributes.clear();
- super.contentHandler.startElement(URI, TOP_NODE_NAME, PREFIX + ':' + TOP_NODE_NAME, attributes);
+ super.contentHandler.startElement(URI, TOP_NODE_NAME, PREFIX + ':' + TOP_NODE_NAME,
+ attributes);
while (linksToProcess.size() > 0) {
Iterator i = linksToProcess.iterator();
@@ -393,109 +377,103 @@
this.contentHandler.endPrefixMapping(PREFIX);
this.contentHandler.endDocument();
}
-
+
/**
* Default exclude patterns.
* <p>
- * By default URLs matching following patterns are excluded:
+ * By default URLs matching following patterns are excluded:
* </p>
* <ul>
- * <li>.*\\.gif(\\?.*)?$ - exclude gif images</li>
- * <li>.*\\.png(\\?.*)?$ - exclude png images</li>
- * <li>.*\\.jpe?g(\\?.*)?$ - exclude jpeg images</li>
- * <li>.*\\.js(\\?.*)?$ - exclude javascript </li>
- * <li>.*\\.css(\\?.*)?$ - exclude cascaded stylesheets</li>
+ * <li>.*\\.gif(\\?.*)?$ - exclude gif images</li>
+ * <li>.*\\.png(\\?.*)?$ - exclude png images</li>
+ * <li>.*\\.jpe?g(\\?.*)?$ - exclude jpeg images</li>
+ * <li>.*\\.js(\\?.*)?$ - exclude javascript</li>
+ * <li>.*\\.css(\\?.*)?$ - exclude cascaded stylesheets</li>
* </ul>
- *
+ *
* @since
*/
private void setDefaultExcludeFromCrawling() {
- String[] EXCLUDE_FROM_CRAWLING_DEFAULT = {
- ".*\\.gif(\\?.*)?$",
- ".*\\.png(\\?.*)?$",
- ".*\\.jpe?g(\\?.*)?$",
- ".*\\.js(\\?.*)?$",
- ".*\\.css(\\?.*)?$",
- ".*\\?.*",".*\\@.*"
- };
+ String[] EXCLUDE_FROM_CRAWLING_DEFAULT = { ".*\\.gif(\\?.*)?$", ".*\\.png(\\?.*)?$",
+ ".*\\.jpe?g(\\?.*)?$", ".*\\.js(\\?.*)?$", ".*\\.css(\\?.*)?$", ".*\\?.*",
+ ".*\\@.*" };
for (int i = 0; i < EXCLUDE_FROM_CRAWLING_DEFAULT.length; i++) {
String pattern = EXCLUDE_FROM_CRAWLING_DEFAULT[i];
try {
excludeCrawlingURL.add(new RE(pattern));
} catch (RESyntaxException rese) {
- getLogger().error("Cannot create excluding regular-expression for " +
- pattern, rese);
+ getLogger()
+ .error("Cannot create excluding regular-expression for " + pattern, rese);
}
}
}
-
/**
* Retrieve a list of links of a url
- *
- * @param url_link_string url for requesting links, it is assumed that
- * url_link_string queries the cocoon view links, ie of the form
- * <code>http://host/foo/bar?cocoon-view=links</code>
+ *
+ * @param url_link_string url for requesting links, it is assumed that url_link_string queries
+ * the cocoon view links, ie of the form
+ * <code>http://host/foo/bar?cocoon-view=links</code>
* @param url_of_referrer base url of which links are requested, ie of the form
- * <code>http://host/foo/bar</code>
- * @return List of links from url_of_referrer, as result of requesting url
- * url_link_string
+ * <code>http://host/foo/bar</code>
+ * @return List of links from url_of_referrer, as result of requesting url url_link_string
*/
- protected List getLinksFromConnection(String url_link_string, String url_of_referrer, int referrerDepth) {
+ protected List getLinksFromConnection(String url_link_string, String url_of_referrer,
+ int referrerDepth) {
List url_links = null;
BufferedReader br = null;
try {
- url_links = new ArrayList();
- url_link_string = "cocoon:/" + url_link_string;
+ url_links = new ArrayList();
+ url_link_string = "cocoon:/" + url_link_string;
- inputSource = super.resolver.resolveURI(url_link_string);
- InputStream is = inputSource.getInputStream();
- br = new BufferedReader(new InputStreamReader(is));
-
- // content is supposed to be a list of links,
- // relative to current URL
- String line;
- String referrer = url_of_referrer;
-
- while ((line = br.readLine()) != null) {
- String new_url = line;
- boolean add_url = true;
- // don't add new_url twice
- if (add_url) {
- add_url &= !url_links.contains(new_url);
- }
+ inputSource = super.resolver.resolveURI(url_link_string);
+ InputStream is = inputSource.getInputStream();
+ br = new BufferedReader(new InputStreamReader(is));
+
+ // content is supposed to be a list of links,
+ // relative to current URL
+ String line;
+ String referrer = url_of_referrer;
+
+ while ((line = br.readLine()) != null) {
+ String new_url = line;
+ boolean add_url = true;
+ // don't add new_url twice
+ if (add_url) {
+ add_url &= !url_links.contains(new_url);
+ }
- // don't add new_url if it has been crawled already
- if (add_url) {
- add_url &= !crawled.contains(new_url);
- }
+ // don't add new_url if it has been crawled already
+ if (add_url) {
+ add_url &= !crawled.contains(new_url);
+ }
- Link new_link = new Link(line, referrer, referrerDepth+1);
- if (add_url) {
- add_url &= !linksToProcess.contains(new_link);
- }
+ Link new_link = new Link(line, referrer, referrerDepth + 1);
+ if (add_url) {
+ add_url &= !linksToProcess.contains(new_link);
+ }
- // don't add if is not matched by existing include definition
- if (add_url) {
- add_url &= isIncludedURL(new_url);
- }
-
- //don't add id matched by existing exclude definition
- if (add_url) {
- add_url &= !(isExcludedURL(new_url));
- }
+ // don't add if is not matched by existing include definition
+ if (add_url) {
+ add_url &= isIncludedURL(new_url);
+ }
+
+ // don't add id matched by existing exclude definition
+ if (add_url) {
+ add_url &= !(isExcludedURL(new_url));
+ }
- if (add_url) {
- if (getLogger().isDebugEnabled()) {
- getLogger().debug("Add URL: " + new_url);
- }
- url_links.add(new_link);
+ if (add_url) {
+ if (getLogger().isDebugEnabled()) {
+ getLogger().debug("Add URL: " + new_url);
}
+ url_links.add(new_link);
}
- // now we have a list of URL which should be examined
-
+ }
+ // now we have a list of URL which should be examined
+
} catch (IOException ioe) {
getLogger().warn("Problems get links of " + url_link_string, ioe);
} finally {
@@ -513,11 +491,11 @@
/**
* Generate xml attributes of a url, calculate url for retrieving links
- *
+ *
* @param url to process
* @param referrer of the url
- * @return String url for retrieving links, or null if url is an excluded-url,
- * and not an included-url.
+ * @return String url for retrieving links, or null if url is an excluded-url, and not an
+ * included-url.
*/
protected String processURL(String uri, String referrer, int referrerDepth) throws SAXException {
@@ -531,17 +509,15 @@
if (crawled.contains(uri)) {
return null;
}
-
- //TODO: need to respect robots.txt
+
+ // TODO: need to respect robots.txt
// mark it as crawled
crawled.add(uri);
attributes.clear();
- attributes.addAttribute("", HREF_ATTR_NAME,
- HREF_ATTR_NAME, "CDATA", uri);
- attributes.addAttribute("", REFERRER_ATTR_NAME,
- REFERRER_ATTR_NAME, "CDATA", referrer);
+ attributes.addAttribute("", HREF_ATTR_NAME, HREF_ATTR_NAME, "CDATA", uri);
+ attributes.addAttribute("", REFERRER_ATTR_NAME, REFERRER_ATTR_NAME, "CDATA", referrer);
// Output url, referrer, content-type, status, message for traversable url's
HttpURLConnection h = null;
@@ -555,47 +531,42 @@
url = new URL(uri);
URLConnection links_url_connection = url.openConnection();
h = (HttpURLConnection) links_url_connection;
- h.setRequestMethod("HEAD"); //lets be kind to external sites
+ h.setRequestMethod("HEAD"); // lets be kind to external sites
content_type = links_url_connection.getContentType();
responseMessage = h.getResponseMessage();
responseCode = h.getResponseCode();
} else {
String tempURI = uri;
if (!(uri.startsWith("/"))) {
- String contextURI = referrer.substring(0,referrer.lastIndexOf("/")+1);
+ String contextURI = referrer.substring(0, referrer.lastIndexOf("/") + 1);
tempURI = contextURI + uri;
}
-
- //see if the document exists
- if (this.identityMap.isDocument(tempURI)) {
+
+ // see if the document exists
+ if (this.session.getUriHandler().isDocument(tempURI)) {
content_type = "text/html";
responseMessage = "ok";
responseCode = 200;
newURL = tempURI;
} else {
- //see if the resource exists
+ // see if the resource exists
}
}
- attributes.addAttribute("", CONTENT_ATTR_NAME,
- CONTENT_ATTR_NAME, "CDATA",
- content_type);
+ attributes
+ .addAttribute("", CONTENT_ATTR_NAME, CONTENT_ATTR_NAME, "CDATA", content_type);
- attributes.addAttribute("", MESSAGE_ATTR_NAME,
- MESSAGE_ATTR_NAME, "CDATA",
+ attributes.addAttribute("", MESSAGE_ATTR_NAME, MESSAGE_ATTR_NAME, "CDATA",
responseMessage);
- attributes.addAttribute("", STATUS_ATTR_NAME,
- STATUS_ATTR_NAME, "CDATA",
- String.valueOf(responseCode));
+ attributes.addAttribute("", STATUS_ATTR_NAME, STATUS_ATTR_NAME, "CDATA", String
+ .valueOf(responseCode));
} catch (IOException ioe) {
- attributes.addAttribute("", MESSAGE_ATTR_NAME,
- MESSAGE_ATTR_NAME, "CDATA",
- ioe.getMessage());
+ attributes.addAttribute("", MESSAGE_ATTR_NAME, MESSAGE_ATTR_NAME, "CDATA", ioe
+ .getMessage());
} catch (final Exception e1) {
- attributes.addAttribute("", MESSAGE_ATTR_NAME,
- MESSAGE_ATTR_NAME, "CDATA",
- e1.getMessage());
+ attributes.addAttribute("", MESSAGE_ATTR_NAME, MESSAGE_ATTR_NAME, "CDATA", e1
+ .getMessage());
} finally {
if (h != null) {
h.disconnect();
@@ -606,29 +577,30 @@
// try to get links of a url which is included for crawling
if (!isExcludedURL(uri) && isIncludedURL(uri)) {
// add prefix and query to get data from the linkserializer.
- if(newURL != null) {
+ if (newURL != null) {
if (newURL.indexOf("?") > -1) {
- newURL = newURL.substring(0,newURL.indexOf("?")) + linkViewQuery;
+ newURL = newURL.substring(0, newURL.indexOf("?")) + linkViewQuery;
} else {
newURL = newURL + "?" + linkViewQuery;
}
}
}
- //linkrewriter transformer takes care of internal links
+ // linkrewriter transformer takes care of internal links
if (uri.startsWith("http://")) {
- super.contentHandler.startElement(URI, LINK_NODE_NAME, PREFIX + ':' + LINK_NODE_NAME, attributes);
- super.contentHandler.endElement(URI, LINK_NODE_NAME, PREFIX + ':' + LINK_NODE_NAME);
+ super.contentHandler.startElement(URI, LINK_NODE_NAME, PREFIX + ':' + LINK_NODE_NAME,
+ attributes);
+ super.contentHandler.endElement(URI, LINK_NODE_NAME, PREFIX + ':' + LINK_NODE_NAME);
}
-
+
return newURL;
}
-
+
/**
* check if URL is a candidate for indexing
- *
- * @param url Description of Parameter
- * @return The excludedURL value
+ *
+ * @param url Description of Parameter
+ * @return The excludedURL value
* @since
*/
private boolean isExcludedURL(String url) {
@@ -657,12 +629,11 @@
return false;
}
-
/**
* check if URL is a candidate for indexing
- *
- * @param url Description of Parameter
- * @return The includedURL value
+ *
+ * @param url Description of Parameter
+ * @return The includedURL value
* @since
*/
private boolean isIncludedURL(String url) {
@@ -703,11 +674,8 @@
super.recycle();
}
- public void setRepositoryManager(RepositoryManager repositoryManager) {
- this.repositoryManager = repositoryManager;
+ public void setRepository(Repository repository) {
+ this.repository = repository;
}
- public RepositoryManager getRepositoryManager() {
- return repositoryManager;
- }
}
Modified: lenya/trunk/org.apache.lenya.module.lucene/src/main/java/org/apache/cocoon/components/search/components/impl/IndexManagerImpl.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.module.lucene/src/main/java/org/apache/cocoon/components/search/components/impl/IndexManagerImpl.java?rev=742672&r1=742671&r2=742672&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.module.lucene/src/main/java/org/apache/cocoon/components/search/components/impl/IndexManagerImpl.java (original)
+++ lenya/trunk/org.apache.lenya.module.lucene/src/main/java/org/apache/cocoon/components/search/components/impl/IndexManagerImpl.java Mon Feb 9 18:49:13 2009
@@ -42,13 +42,9 @@
import org.apache.excalibur.source.SourceResolver;
import org.apache.excalibur.source.SourceUtil;
import org.apache.lenya.cms.metadata.MetaDataException;
-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.RepositoryManager;
-import org.apache.lenya.cms.repository.RepositoryUtil;
-import org.apache.lenya.cms.repository.Session;
+import org.apache.lenya.cms.publication.Repository;
+import org.apache.lenya.cms.publication.Session;
import org.apache.lenya.modules.lucene.MetaDataFieldRegistry;
import org.springframework.web.context.WebApplicationContext;
@@ -144,7 +140,7 @@
* Index configuration file
*/
- private RepositoryManager repositoryManager;
+ private Repository repository;
private SourceResolver sourceResolver;
private Map indexMap;
@@ -220,10 +216,9 @@
ProcessInfoProvider process = (ProcessInfoProvider) WebAppContextUtils
.getCurrentWebApplicationContext().getBean(ProcessInfoProvider.ROLE);
HttpServletRequest request = process.getRequest();
- Session session = RepositoryUtil.getSession(this.repositoryManager, request);
- DocumentFactory factory = DocumentUtil.createDocumentFactory(session);
+ Session session = this.repository.getSession(request);
- Publication[] publications = factory.getPublications();
+ Publication[] publications = session.getPublications();
for (int i = 0; i < publications.length; i++) {
String uri = "context://" + Publication.PUBLICATION_PREFIX_URI + "/"
@@ -236,8 +231,6 @@
}
} catch (IOException e) {
throw new RuntimeException("Config file error", e);
- } catch (RepositoryException e) {
- throw new RuntimeException("Repository access error", e);
} finally {
if (confSource != null) {
this.sourceResolver.release(confSource);
@@ -421,12 +414,8 @@
return (Index[]) this.indexes().values().toArray(new Index[indexes().size()]);
}
- public void setRepositoryManager(RepositoryManager repositoryManager) {
- this.repositoryManager = repositoryManager;
- }
-
- public void setSourceResolver(SourceResolver sourceResolver) {
- this.sourceResolver = sourceResolver;
+ public void setRepositoryManager(Repository repository) {
+ this.repository = repository;
}
}
Modified: lenya/trunk/org.apache.lenya.module.lucene/src/main/java/org/apache/lenya/cms/lucene/IndexSite.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.module.lucene/src/main/java/org/apache/lenya/cms/lucene/IndexSite.java?rev=742672&r1=742671&r2=742672&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.module.lucene/src/main/java/org/apache/lenya/cms/lucene/IndexSite.java (original)
+++ lenya/trunk/org.apache.lenya.module.lucene/src/main/java/org/apache/lenya/cms/lucene/IndexSite.java Mon Feb 9 18:49:13 2009
@@ -19,9 +19,9 @@
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.publication.URLInformation;
+import org.apache.lenya.cms.repository.Session;
import org.apache.lenya.cms.usecase.AbstractUsecase;
/**
@@ -36,15 +36,14 @@
URLInformation info = new URLInformation(url);
String pubId = info.getPublicationId();
- DocumentFactory factory = getDocumentFactory();
- Publication pub = factory.getPublication(pubId);
+ Publication pub = getSession().getPublication(pubId);
Area area = pub.getArea(info.getArea());
Document[] docs = area.getDocuments();
for (int i = 0; i < docs.length; i++) {
try {
- getIndexUpdater().index(getSession().getDocumentFactory().getSession(),
+ getIndexUpdater().index((Session) getSession(),
docs[i].getResourceType(), pubId, area.getName(), docs[i].getUUID(),
docs[i].getLanguage());
} catch (Exception e) {
Modified: lenya/trunk/org.apache.lenya.module.lucene/src/main/java/org/apache/lenya/cms/lucene/IndexUpdaterImpl.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.module.lucene/src/main/java/org/apache/lenya/cms/lucene/IndexUpdaterImpl.java?rev=742672&r1=742671&r2=742672&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.module.lucene/src/main/java/org/apache/lenya/cms/lucene/IndexUpdaterImpl.java (original)
+++ lenya/trunk/org.apache.lenya.module.lucene/src/main/java/org/apache/lenya/cms/lucene/IndexUpdaterImpl.java Mon Feb 9 18:49:13 2009
@@ -31,8 +31,6 @@
import org.apache.lenya.cms.observation.ObservationRegistry;
import org.apache.lenya.cms.observation.RepositoryEvent;
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.publication.ResourceType;
import org.apache.lenya.cms.repository.Session;
@@ -115,9 +113,9 @@
public void index(Session session, ResourceType resourceType, String pubId, String area,
String uuid, String language) throws IndexException {
- DocumentFactory factory = DocumentUtil.createDocumentFactory(session);
try {
- Publication pub = factory.getPublication(pubId);
+ org.apache.lenya.cms.publication.Session pubSession = (org.apache.lenya.cms.publication.Session) session;
+ Publication pub = pubSession.getPublication(pubId);
Area areaObj = pub.getArea(area);
if (areaObj.contains(uuid, language)) {
updateIndex("index", resourceType, pubId, area, uuid, language);
Modified: lenya/trunk/org.apache.lenya.module.menubar/src/main/java/org/apache/lenya/modules/menubar/MenuFilterTransformer.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.module.menubar/src/main/java/org/apache/lenya/modules/menubar/MenuFilterTransformer.java?rev=742672&r1=742671&r2=742672&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.module.menubar/src/main/java/org/apache/lenya/modules/menubar/MenuFilterTransformer.java (original)
+++ lenya/trunk/org.apache.lenya.module.menubar/src/main/java/org/apache/lenya/modules/menubar/MenuFilterTransformer.java Mon Feb 9 18:49:13 2009
@@ -30,13 +30,9 @@
import org.apache.cocoon.environment.Request;
import org.apache.cocoon.environment.SourceResolver;
import org.apache.cocoon.transformation.AbstractSAXTransformer;
-import org.apache.lenya.cms.publication.DocumentFactory;
-import org.apache.lenya.cms.publication.DocumentUtil;
+import org.apache.lenya.cms.publication.Repository;
+import org.apache.lenya.cms.publication.Session;
import org.apache.lenya.cms.publication.URLInformation;
-import org.apache.lenya.cms.repository.RepositoryException;
-import org.apache.lenya.cms.repository.RepositoryManager;
-import org.apache.lenya.cms.repository.RepositoryUtil;
-import org.apache.lenya.cms.repository.Session;
import org.apache.lenya.cms.usecase.Usecase;
import org.apache.lenya.cms.usecase.UsecaseResolver;
import org.apache.lenya.cms.usecase.gui.Tab;
@@ -45,8 +41,8 @@
import org.xml.sax.SAXException;
/**
- * Filter menu elements (blocks, items, ...) according to the attributes
- * <em>areas</em> and <em>resourceTypes</em>.
+ * Filter menu elements (blocks, items, ...) according to the attributes <em>areas</em> and
+ * <em>resourceTypes</em>.
*/
public class MenuFilterTransformer extends AbstractSAXTransformer {
@@ -54,8 +50,8 @@
private static final String ATTR_AREAS = "areas";
private static final String ATTR_RESOURCE_TYPES = "resourceTypes";
private Set attributeHandlers;
-
- private RepositoryManager repositoryManager;
+
+ private Repository repository;
public MenuFilterTransformer() {
this.defaultNamespaceURI = NAMESPACE;
@@ -75,17 +71,17 @@
String area = tabGroup != null ? tabGroup : url.getArea();
this.attributeHandlers.add(new AttributeHandler(ATTR_AREAS, area));
-
+
+ Session session = this.repository.getSession(request);
+ String resourceType;
try {
- Session session = RepositoryUtil.getSession(this.repositoryManager, request);
- DocumentFactory factory = DocumentUtil.createDocumentFactory(session);
- String resourceType = factory.isDocument(webappUri) ?
- resourceType = factory.getFromURL(webappUri).getResourceType().getName()
- : null;
- this.attributeHandlers.add(new AttributeHandler(ATTR_RESOURCE_TYPES, resourceType));
- } catch (RepositoryException e) {
+ resourceType = session.getUriHandler().isDocument(webappUri) ? resourceType = session
+ .getUriHandler().getDocument(webappUri).getResourceType().getName()
+ : null;
+ } catch (final Exception e) {
throw new ProcessingException(e);
}
+ this.attributeHandlers.add(new AttributeHandler(ATTR_RESOURCE_TYPES, resourceType));
}
@@ -151,12 +147,8 @@
}
}
- public void setRepositoryManager(RepositoryManager repositoryManager) {
- this.repositoryManager = repositoryManager;
- }
-
- public RepositoryManager getRepositoryManager() {
- return repositoryManager;
+ public void setRepository(Repository repository) {
+ this.repository = repository;
}
/**
Modified: lenya/trunk/org.apache.lenya.module.navigation/src/main/java/org/apache/lenya/modules/navigation/SiteFragmentGenerator.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.module.navigation/src/main/java/org/apache/lenya/modules/navigation/SiteFragmentGenerator.java?rev=742672&r1=742671&r2=742672&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.module.navigation/src/main/java/org/apache/lenya/modules/navigation/SiteFragmentGenerator.java (original)
+++ lenya/trunk/org.apache.lenya.module.navigation/src/main/java/org/apache/lenya/modules/navigation/SiteFragmentGenerator.java Mon Feb 9 18:49:13 2009
@@ -31,12 +31,9 @@
import org.apache.cocoon.generation.ServiceableGenerator;
import org.apache.excalibur.source.Source;
import org.apache.excalibur.source.SourceValidity;
-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.RepositoryManager;
-import org.apache.lenya.cms.repository.RepositoryUtil;
-import org.apache.lenya.cms.repository.Session;
+import org.apache.lenya.cms.publication.Repository;
+import org.apache.lenya.cms.publication.Session;
import org.apache.lenya.cms.site.Link;
import org.apache.lenya.cms.site.SiteException;
import org.apache.lenya.cms.site.SiteNode;
@@ -82,7 +79,7 @@
private String path;
private String selectorPath;
- private RepositoryManager repositoryManager;
+ private Repository repository;
public void setup(org.apache.cocoon.environment.SourceResolver resolver, Map objectModel,
String src, Parameters params) throws ProcessingException, SAXException, IOException {
@@ -98,9 +95,8 @@
this.path = params.getParameter(PARAM_PATH);
this.selectorPath = params.getParameter(PARAM_SELECTOR_PATH, "");
- Session session = RepositoryUtil.getSession(this.repositoryManager, request);
- DocumentFactory factory = DocumentUtil.createDocumentFactory(session);
- Publication pub = factory.getPublication(pubId);
+ Session session = this.repository.getSession(request);
+ Publication pub = session.getPublication(pubId);
this.site = pub.getArea(area).getSite();
this.cacheKey = pubId + "/" + area;
@@ -238,12 +234,8 @@
this.selectorClass = params.getParameter(PARAM_SELECTOR);
}
- public void setRepositoryManager(RepositoryManager repositoryManager) {
- this.repositoryManager = repositoryManager;
- }
-
- public RepositoryManager getRepositoryManager() {
- return repositoryManager;
+ public void setRepository(Repository repository) {
+ this.repository = repository;
}
}
Modified: lenya/trunk/org.apache.lenya.module.navigation/src/main/java/org/apache/lenya/modules/navigation/SiteMetaDataTransformer.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.module.navigation/src/main/java/org/apache/lenya/modules/navigation/SiteMetaDataTransformer.java?rev=742672&r1=742671&r2=742672&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.module.navigation/src/main/java/org/apache/lenya/modules/navigation/SiteMetaDataTransformer.java (original)
+++ lenya/trunk/org.apache.lenya.module.navigation/src/main/java/org/apache/lenya/modules/navigation/SiteMetaDataTransformer.java Mon Feb 9 18:49:13 2009
@@ -35,27 +35,21 @@
import org.apache.lenya.cms.metadata.MetaDataException;
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.DocumentUtil;
-import org.apache.lenya.cms.publication.Publication;
-import org.apache.lenya.cms.publication.URLInformation;
-import org.apache.lenya.cms.repository.RepositoryManager;
-import org.apache.lenya.cms.repository.RepositoryUtil;
-import org.apache.lenya.cms.repository.Session;
+import org.apache.lenya.cms.publication.Repository;
+import org.apache.lenya.cms.publication.Session;
import org.apache.lenya.util.ServletHelper;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.AttributesImpl;
/**
- * Updates navigation nodes according to the site meta data of the corresponding
- * documents.
+ * Updates navigation nodes according to the site meta data of the corresponding documents.
*/
public class SiteMetaDataTransformer extends AbstractSAXTransformer implements Initializable {
private Area area;
private LinkResolver linkResolver;
- private RepositoryManager repositoryManager;
+ private Repository repository;
public void setup(SourceResolver resolver, Map objectModel, String src, Parameters params)
throws ProcessingException, SAXException, IOException {
@@ -63,12 +57,9 @@
Request req = ObjectModelHelper.getRequest(objectModel);
try {
- Session session = RepositoryUtil.getSession(this.repositoryManager, req);
- DocumentFactory factory = DocumentUtil.createDocumentFactory(session);
+ Session session = this.repository.getSession(req);
String webappUrl = ServletHelper.getWebappURI(req);
- URLInformation info = new URLInformation(webappUrl);
- Publication pub = factory.getPublication(info.getPublicationId());
- this.area = pub.getArea(info.getArea());
+ this.area = session.getUriHandler().getArea(webappUrl);
} catch (Exception e) {
throw new RuntimeException(e);
}
@@ -112,7 +103,7 @@
try {
if (href != null && href.startsWith("lenya-document:")) {
LinkTarget target = linkResolver.resolve(this.area.getPublication()
- .getFactory(), getLinkUri(href));
+ .getSession(), getLinkUri(href));
if (target.exists()) {
Document doc = target.getDocument();
int hrefIndex = attrs.getIndex(ATTR_HREF);
@@ -162,12 +153,8 @@
return link.getUri();
}
- public void setRepositoryManager(RepositoryManager repositoryManager) {
- this.repositoryManager = repositoryManager;
- }
-
- public RepositoryManager getRepositoryManager() {
- return repositoryManager;
+ public void setRepository(Repository repository) {
+ this.repository = repository;
}
}
Modified: lenya/trunk/org.apache.lenya.module.notification/src/main/java/org/apache/lenya/inbox/InboxModule.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.module.notification/src/main/java/org/apache/lenya/inbox/InboxModule.java?rev=742672&r1=742671&r2=742672&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.module.notification/src/main/java/org/apache/lenya/inbox/InboxModule.java (original)
+++ lenya/trunk/org.apache.lenya.module.notification/src/main/java/org/apache/lenya/inbox/InboxModule.java Mon Feb 9 18:49:13 2009
@@ -25,9 +25,8 @@
import org.apache.cocoon.environment.ObjectModelHelper;
import org.apache.cocoon.environment.Request;
import org.apache.lenya.ac.User;
-import org.apache.lenya.cms.repository.RepositoryManager;
-import org.apache.lenya.cms.repository.RepositoryUtil;
-import org.apache.lenya.cms.repository.Session;
+import org.apache.lenya.cms.publication.Repository;
+import org.apache.lenya.cms.publication.Session;
/**
* <p>
@@ -46,7 +45,7 @@
protected static final String NEW_MESSAGE_COUNT = "newMessageCount";
private InboxManager inboxManager;
- private RepositoryManager repositoryManager;
+ private Repository repository;
public Object getAttribute(String name, Configuration modeConf, Map objectModel)
throws ConfigurationException {
@@ -55,7 +54,7 @@
if (name.equals(NEW_MESSAGE_COUNT)) {
try {
Request request = ObjectModelHelper.getRequest(objectModel);
- Session session = RepositoryUtil.getSession(this.repositoryManager, request);
+ Session session = this.repository.getSession(request);
User user = session.getIdentity().getUser();
if (user == null) {
return "0";
@@ -89,12 +88,8 @@
return inboxManager;
}
- public void setRepositoryManager(RepositoryManager repositoryManager) {
- this.repositoryManager = repositoryManager;
- }
-
- public RepositoryManager getRepositoryManager() {
- return repositoryManager;
+ public void setRepository(Repository repository) {
+ this.repository = repository;
}
}
Modified: lenya/trunk/org.apache.lenya.module.simplesite/pom.xml
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.module.simplesite/pom.xml?rev=742672&r1=742671&r2=742672&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.module.simplesite/pom.xml (original)
+++ lenya/trunk/org.apache.lenya.module.simplesite/pom.xml Mon Feb 9 18:49:13 2009
@@ -28,5 +28,38 @@
<groupId>org.apache.lenya</groupId>
<artifactId>lenya-module-collection</artifactId>
</dependency>
+
+ <!-- Tests -->
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cocoon</groupId>
+ <artifactId>cocoon-core</artifactId>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.lenya</groupId>
+ <artifactId>lenya-core-impl</artifactId>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.lenya</groupId>
+ <artifactId>lenya-core-api</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <!-- FIXME: This dependency is transitive and should be obtained automatically
+ see http://jira.codehaus.org/browse/MNG-1378 -->
+ <dependency>
+ <groupId>org.apache.cocoon</groupId>
+ <artifactId>cocoon-sitemap-impl</artifactId>
+ <scope>test</scope>
+ <type>test-jar</type>
+ </dependency>
+
</dependencies>
</project>
Modified: lenya/trunk/org.apache.lenya.module.simplesite/src/main/java/org/apache/lenya/cms/site/simple/DocumentStore.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.module.simplesite/src/main/java/org/apache/lenya/cms/site/simple/DocumentStore.java?rev=742672&r1=742671&r2=742672&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.module.simplesite/src/main/java/org/apache/lenya/cms/site/simple/DocumentStore.java (original)
+++ lenya/trunk/org.apache.lenya.module.simplesite/src/main/java/org/apache/lenya/cms/site/simple/DocumentStore.java Mon Feb 9 18:49:13 2009
@@ -106,8 +106,7 @@
String uuid = documentElement.getAttribute(ATTRIBUTE_UUID);
String language = documentElement.getAttribute(ATTRIBUTE_LANGUAGE);
String path = documentElement.getAttribute(ATTRIBUTE_PATH);
- Document document = getDelegate().getFactory().get(getDelegate().getPublication(),
- getDelegate().getArea(), uuid, language);
+ Document document = getDelegate().area().getDocument(uuid, language);
String key = getKey(uuid, language);
if (!this.doc2path.containsKey(key)) {
this.doc2path.put(key, path);
@@ -300,7 +299,7 @@
return false;
}
- public Session getSession() {
- return getRepositoryNode().getSession();
+ public Session getRepositorySession() {
+ return getRepositoryNode().getRepositorySession();
}
}
\ No newline at end of file
Modified: lenya/trunk/org.apache.lenya.module.simplesite/src/main/java/org/apache/lenya/cms/site/simple/DocumentStoreFactory.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.module.simplesite/src/main/java/org/apache/lenya/cms/site/simple/DocumentStoreFactory.java?rev=742672&r1=742671&r2=742672&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.module.simplesite/src/main/java/org/apache/lenya/cms/site/simple/DocumentStoreFactory.java (original)
+++ lenya/trunk/org.apache.lenya.module.simplesite/src/main/java/org/apache/lenya/cms/site/simple/DocumentStoreFactory.java Mon Feb 9 18:49:13 2009
@@ -21,9 +21,7 @@
import org.apache.cocoon.util.AbstractLogEnabled;
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.DocumentManager;
-import org.apache.lenya.cms.publication.DocumentUtil;
import org.apache.lenya.cms.publication.Publication;
import org.apache.lenya.cms.publication.PublicationException;
import org.apache.lenya.cms.repository.RepositoryException;
@@ -62,8 +60,8 @@
String uuid = snippets[2];
DocumentStore store;
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);
String lang = publication.getDefaultLanguage();
Modified: lenya/trunk/org.apache.lenya.module.simplesite/src/main/java/org/apache/lenya/cms/site/simple/SimpleLink.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.module.simplesite/src/main/java/org/apache/lenya/cms/site/simple/SimpleLink.java?rev=742672&r1=742671&r2=742672&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.module.simplesite/src/main/java/org/apache/lenya/cms/site/simple/SimpleLink.java (original)
+++ lenya/trunk/org.apache.lenya.module.simplesite/src/main/java/org/apache/lenya/cms/site/simple/SimpleLink.java Mon Feb 9 18:49:13 2009
@@ -18,7 +18,6 @@
package org.apache.lenya.cms.site.simple;
import org.apache.lenya.cms.publication.DocumentException;
-import org.apache.lenya.cms.publication.DocumentFactory;
import org.apache.lenya.cms.site.AbstractLink;
/**
@@ -26,8 +25,8 @@
*/
public class SimpleLink extends AbstractLink {
- protected SimpleLink(DocumentFactory factory, SimpleSiteNode node, String _label, String language) {
- super(factory, node, _label, language);
+ protected SimpleLink(SimpleSiteNode node, String _label, String language) {
+ super(node, _label, language);
}
public void delete() {
Modified: lenya/trunk/org.apache.lenya.module.simplesite/src/main/java/org/apache/lenya/cms/site/simple/SimpleSiteManager.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.module.simplesite/src/main/java/org/apache/lenya/cms/site/simple/SimpleSiteManager.java?rev=742672&r1=742671&r2=742672&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.module.simplesite/src/main/java/org/apache/lenya/cms/site/simple/SimpleSiteManager.java (original)
+++ lenya/trunk/org.apache.lenya.module.simplesite/src/main/java/org/apache/lenya/cms/site/simple/SimpleSiteManager.java Mon Feb 9 18:49:13 2009
@@ -19,11 +19,12 @@
import org.apache.excalibur.source.SourceResolver;
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.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.Session;
import org.apache.lenya.cms.site.AbstractSiteManager;
import org.apache.lenya.cms.site.SiteException;
import org.apache.lenya.cms.site.SiteNode;
@@ -41,21 +42,12 @@
private DocumentStoreFactory documentStoreFactory;
private SourceResolver sourceResolver;
- /**
- * @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 false;
}
- /**
- * @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 {
return new SiteNode[0];
}
@@ -69,26 +61,21 @@
* @throws SiteException if an error occurs.
*/
private DocumentStore getStore(Document document) throws SiteException {
- Publication publication = document.getPublication();
- String area = document.getArea();
- DocumentFactory map = document.getFactory();
- return getStore(map, publication, area);
+ return getStore(document.area());
}
/**
- * @param map The identity map.
- * @param publication The publication.
* @param area The area.
* @return A document store.
* @throws SiteException if an error occurs.
*/
- protected DocumentStore getStore(DocumentFactory map, Publication publication, String area)
- throws SiteException {
- String key = getKey(publication, area);
+ protected DocumentStore getStore(Area area) throws SiteException {
+ String key = getKey(area);
DocumentStore store;
try {
- store = (DocumentStore) map.getSession().getRepositoryItem(getDocumentStoreFactory(),
- key);
+ org.apache.lenya.cms.repository.Session session = (org.apache.lenya.cms.repository.Session) area
+ .getPublication().getSession();
+ store = (DocumentStore) session.getRepositoryItem(getDocumentStoreFactory(), key);
} catch (Exception e) {
throw new SiteException(e);
}
@@ -123,8 +110,9 @@
* @param area The area.
* @return The key to store sitetree objects in the identity map.
*/
- protected String getKey(Publication publication, String area) {
- return publication.getId() + ":" + area + ":" + getCollectionUuid(publication);
+ protected String getKey(Area area) {
+ return area.getPublication().getId() + ":" + area.getName() + ":"
+ + getCollectionUuid(area.getPublication());
}
/**
@@ -182,13 +170,8 @@
public void setVisibleInNav(Document document, boolean visibleInNav) throws SiteException {
}
- /**
- * @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 identityMap, Publication publication, String area)
- throws SiteException {
- DocumentStore store = getStore(identityMap, publication, area);
+ public Document[] getDocuments(Publication publication, String area) throws SiteException {
+ DocumentStore store = getStore(publication.getArea(area));
try {
return store.getDocuments();
} catch (DocumentException e) {
@@ -196,20 +179,12 @@
}
}
- /**
- * @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 publication, String area)
+ public SiteStructure getSiteStructure(Publication publication, String area)
throws SiteException {
- return getStore(map, publication, area);
+ return getStore(publication.getArea(area));
}
- /**
- * @see org.apache.lenya.cms.site.SiteManager#getAvailableLocator(DocumentFactory,
- * DocumentLocator)
- */
- public DocumentLocator getAvailableLocator(DocumentFactory factory, DocumentLocator document)
+ public DocumentLocator getAvailableLocator(Session session, DocumentLocator document)
throws SiteException {
return document;
}
@@ -226,7 +201,7 @@
}
}
- public DocumentLocator[] getRequiredResources(DocumentFactory map, DocumentLocator locator)
+ public DocumentLocator[] getRequiredResources(Session session, DocumentLocator locator)
throws SiteException {
return new DocumentLocator[0];
}
Modified: lenya/trunk/org.apache.lenya.module.simplesite/src/main/java/org/apache/lenya/cms/site/simple/SimpleSiteNode.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.module.simplesite/src/main/java/org/apache/lenya/cms/site/simple/SimpleSiteNode.java?rev=742672&r1=742671&r2=742672&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.module.simplesite/src/main/java/org/apache/lenya/cms/site/simple/SimpleSiteNode.java (original)
+++ lenya/trunk/org.apache.lenya.module.simplesite/src/main/java/org/apache/lenya/cms/site/simple/SimpleSiteNode.java Mon Feb 9 18:49:13 2009
@@ -38,8 +38,7 @@
}
public Link getLink(String language) throws SiteException {
- DocumentStore store = (DocumentStore) getStructure();
- return new SimpleLink(store.getDelegate().getFactory(), this, "", language);
+ return new SimpleLink(this, "", language);
}
public String getName() {
Modified: lenya/trunk/org.apache.lenya.module.simplesite/src/test/java/org/apache/lenya/cms/site/simple/SimpleSiteManagerTest.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.module.simplesite/src/test/java/org/apache/lenya/cms/site/simple/SimpleSiteManagerTest.java?rev=742672&r1=742671&r2=742672&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.module.simplesite/src/test/java/org/apache/lenya/cms/site/simple/SimpleSiteManagerTest.java (original)
+++ lenya/trunk/org.apache.lenya.module.simplesite/src/test/java/org/apache/lenya/cms/site/simple/SimpleSiteManagerTest.java Mon Feb 9 18:49:13 2009
@@ -15,27 +15,20 @@
* limitations under the License.
*
*/
-package org.apache.lenya.cms.site;
+package org.apache.lenya.cms.site.simple;
-import org.apache.avalon.framework.service.ServiceException;
import org.apache.avalon.framework.service.ServiceSelector;
import org.apache.lenya.ac.impl.AbstractAccessControlTest;
import org.apache.lenya.cms.publication.Document;
-import org.apache.lenya.cms.publication.DocumentBuildException;
-import org.apache.lenya.cms.publication.DocumentFactory;
import org.apache.lenya.cms.publication.DocumentManager;
-import org.apache.lenya.cms.publication.DocumentUtil;
import org.apache.lenya.cms.publication.Publication;
-import org.apache.lenya.cms.publication.PublicationException;
import org.apache.lenya.cms.publication.ResourceType;
-import org.apache.lenya.cms.repository.RepositoryException;
-import org.apache.lenya.cms.repository.Session;
+import org.apache.lenya.cms.publication.Session;
import org.apache.lenya.cms.site.Link;
import org.apache.lenya.cms.site.SiteException;
import org.apache.lenya.cms.site.SiteManager;
import org.apache.lenya.cms.site.SiteNode;
import org.apache.lenya.cms.site.SiteStructure;
-import org.apache.lenya.cms.site.simple.DocumentStore;
public class SimpleSiteManagerTest extends AbstractAccessControlTest {
@@ -44,20 +37,14 @@
protected static final String PARENT_PATH = "/foo";
public void testSimpleSiteManager() throws Exception {
-
Session session = login("lenya");
-
- DocumentFactory factory = DocumentUtil.createDocumentFactory(getManager(), session);
- Publication[] pubs = factory.getPublications();
-
+ Publication[] pubs = session.getPublications();
for (int i = 0; i < pubs.length; i++) {
- checkPublication(session, factory, pubs[i]);
+ checkPublication(pubs[i]);
}
}
- protected void checkPublication(Session session, DocumentFactory factory, Publication pub)
- throws ServiceException, SiteException, DocumentBuildException, PublicationException,
- RepositoryException {
+ protected void checkPublication(Publication pub) throws Exception {
DocumentManager docManager = null;
ServiceSelector selector = null;
SiteManager siteManager = null;
@@ -66,8 +53,7 @@
try {
selector = (ServiceSelector) getManager().lookup(SiteManager.ROLE + "Selector");
siteManager = (SiteManager) selector.select(pub.getSiteManagerHint());
- SiteStructure structure = siteManager.getSiteStructure(factory, pub,
- Publication.AUTHORING_AREA);
+ SiteStructure structure = siteManager.getSiteStructure(pub, Publication.AUTHORING_AREA);
docManager = (DocumentManager) getManager().lookup(DocumentManager.ROLE);
@@ -76,8 +62,8 @@
ResourceType type = (ResourceType) resourceTypeSelector.select("entry");
String contentSourceUri = "context://sitemap.xmap";
- Document doc = docManager.add(factory, type, contentSourceUri, pub,
- Publication.AUTHORING_AREA, "en", "xml");
+ Document doc = docManager.add(type, contentSourceUri, pub, Publication.AUTHORING_AREA,
+ "en", "xml");
structure.add(PATH, doc);
assertTrue(structure.contains(PATH));
@@ -102,12 +88,12 @@
checkLinks(siteManager, node);
}
-
+
doc.getLink().delete();
assertFalse(structure.containsByUuid(doc.getUUID(), doc.getLanguage()));
assertFalse(structure.contains(PATH));
assertFalse(structure.contains(PARENT_PATH));
-
+
} finally {
if (selector != null) {
if (siteManager != null) {
@@ -140,18 +126,18 @@
Link link = node.getLink(languages[i]);
assertEquals(link.getLanguage(), languages[i]);
assertNotNull(link.getLabel());
-
+
if (node.getUuid() != null) {
Document doc = link.getDocument();
assertNotNull(doc);
-
+
String docUuid = doc.getUUID();
String nodeUuid = node.getUuid();
-
+
assertNotNull(doc.getUUID());
assertEquals(docUuid, nodeUuid);
assertEquals(doc.getLanguage(), link.getLanguage());
-
+
// it may not be allowed to insert the doc twice
try {
siteManager.add("/sidebar", doc);
Modified: lenya/trunk/org.apache.lenya.module.sitetree/src/main/java/org/apache/lenya/cms/cocoon/transformation/IconUrlTransformer.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.module.sitetree/src/main/java/org/apache/lenya/cms/cocoon/transformation/IconUrlTransformer.java?rev=742672&r1=742671&r2=742672&view=diff
==============================================================================
--- lenya/trunk/org.apache.lenya.module.sitetree/src/main/java/org/apache/lenya/cms/cocoon/transformation/IconUrlTransformer.java (original)
+++ lenya/trunk/org.apache.lenya.module.sitetree/src/main/java/org/apache/lenya/cms/cocoon/transformation/IconUrlTransformer.java Mon Feb 9 18:49:13 2009
@@ -77,7 +77,7 @@
try {
Link link = getLink(linkUri, pubId, area);
LinkTarget target = IconUrlTransformer.this.linkResolver.resolve(
- IconUrlTransformer.this.session.getDocumentFactory(), link.getUri());
+ IconUrlTransformer.this.session, link.getUri());
if (target.exists()) {
Document doc = target.getDocument();
ResourceType type = doc.getResourceType();
Modified: lenya/trunk/org.apache.lenya.module.sitetree/src/main/java/org/apache/lenya/cms/site/tree/DefaultSiteTree.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.module.sitetree/src/main/java/org/apache/lenya/cms/site/tree/DefaultSiteTree.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/DefaultSiteTree.java (original)
+++ lenya/trunk/org.apache.lenya.module.sitetree/src/main/java/org/apache/lenya/cms/site/tree/DefaultSiteTree.java Mon Feb 9 18:49:13 2009
@@ -28,7 +28,8 @@
import org.apache.cocoon.spring.configurator.WebAppContextUtils;
import org.apache.cocoon.util.AbstractLogEnabled;
import org.apache.commons.logging.Log;
-import org.apache.lenya.cms.publication.DocumentFactory;
+import org.apache.commons.logging.LogFactory;
+import org.apache.lenya.cms.publication.Area;
import org.apache.lenya.cms.publication.Publication;
import org.apache.lenya.cms.repository.NodeFactory;
import org.apache.lenya.cms.repository.RepositoryException;
@@ -53,6 +54,8 @@
*/
public class DefaultSiteTree extends AbstractLogEnabled implements SiteTree {
+ private static final Log logger = LogFactory.getLog(DefaultSiteTree.class);
+
/**
* The sitetree namespace.
*/
@@ -69,7 +72,6 @@
private String area = "";
private Publication pub;
private Document document;
- private DocumentFactory factory;
private org.apache.lenya.cms.repository.Node repositoryNode;
@@ -83,15 +85,13 @@
* @param logger The logger.
* @throws SiteException if an error occurs.
*/
- protected DefaultSiteTree(DocumentFactory factory, Publication publication, String _area,
- Log logger) throws SiteException {
+ protected DefaultSiteTree(Area area) throws SiteException {
setLogger(logger);
- this.factory = factory;
- this.pub = publication;
- this.sourceUri = publication.getSourceURI() + "/content/" + _area + "/"
+ this.pub = area.getPublication();
+ this.sourceUri = this.pub.getSourceURI() + "/content/" + area.getName() + "/"
+ SITE_TREE_FILENAME;
- this.area = _area;
+ this.area = area.getName();
try {
if (getRepositoryNode().exists()) {
this.document = DocumentHelper.readDocument(getRepositoryNode().getInputStream());
@@ -328,7 +328,7 @@
return null;
}
- SiteTreeNode newNode = new SiteTreeNodeImpl(this.factory, this, (Element) node, getLogger());
+ SiteTreeNode newNode = new SiteTreeNodeImpl(this, (Element) node, getLogger());
return newNode;
}
@@ -387,7 +387,7 @@
throw new RuntimeException(e);
}
if (node != null) {
- treeNode = new SiteTreeNodeImpl(this.factory, this, (Element) node, getLogger());
+ treeNode = new SiteTreeNodeImpl(this, (Element) node, getLogger());
} else {
throw new SiteException("No node contained for path [" + path + "]!");
}
@@ -475,7 +475,7 @@
*/
public org.apache.lenya.cms.repository.Node getRepositoryNode() {
if (this.repositoryNode == null) {
- Session session = this.getPublication().getFactory().getSession();
+ Session session = (Session) this.getPublication().getSession();
try {
NodeFactory factory = (NodeFactory) WebAppContextUtils
.getCurrentWebApplicationContext().getBean(NodeFactory.ROLE);
@@ -533,7 +533,7 @@
if (element == null) {
return null;
} else {
- return new SiteTreeNodeImpl(this.factory, this, element, getLogger());
+ return new SiteTreeNodeImpl(this, element, getLogger());
}
} catch (Exception e) {
throw new RuntimeException(e);
@@ -546,7 +546,7 @@
SiteNode[] nodes = new SiteNode[list.getLength()];
for (int i = 0; i < nodes.length; i++) {
Element element = (Element) list.item(i);
- nodes[i] = new SiteTreeNodeImpl(this.factory, this, element, getLogger());
+ nodes[i] = new SiteTreeNodeImpl(this, element, getLogger());
}
return nodes;
} catch (Exception e) {
@@ -563,10 +563,6 @@
return node.getLink(language);
}
- protected DocumentFactory getFactory() {
- return this.factory;
- }
-
public Link add(String path, org.apache.lenya.cms.publication.Document doc)
throws SiteException {
@@ -635,8 +631,8 @@
return false;
}
- public Session getSession() {
- return getRepositoryNode().getSession();
+ public Session getRepositorySession() {
+ return getRepositoryNode().getRepositorySession();
}
public SiteNode[] preOrder() {
Modified: lenya/trunk/org.apache.lenya.module.sitetree/src/main/java/org/apache/lenya/cms/site/tree/SiteTreeFactory.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.module.sitetree/src/main/java/org/apache/lenya/cms/site/tree/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/tree/SiteTreeFactory.java (original)
+++ lenya/trunk/org.apache.lenya.module.sitetree/src/main/java/org/apache/lenya/cms/site/tree/SiteTreeFactory.java Mon Feb 9 18:49:13 2009
@@ -19,8 +19,6 @@
import org.apache.cocoon.util.AbstractLogEnabled;
import org.apache.commons.logging.Log;
-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;
@@ -48,9 +46,9 @@
String area = snippets[1];
DefaultSiteTree tree;
try {
- DocumentFactory factory = DocumentUtil.createDocumentFactory(session);
- Publication publication = factory.getPublication(publicationId);
- tree = new DefaultSiteTree(factory, publication, area, getLogger());
+ org.apache.lenya.cms.publication.Session pubSession = (org.apache.lenya.cms.publication.Session) session;
+ Publication publication = pubSession.getPublication(publicationId);
+ tree = new DefaultSiteTree(publication.getArea(area));
} catch (Exception e) {
throw new RepositoryException(e);
}
Modified: lenya/trunk/org.apache.lenya.module.sitetree/src/main/java/org/apache/lenya/cms/site/tree/SiteTreeLink.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.module.sitetree/src/main/java/org/apache/lenya/cms/site/tree/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/tree/SiteTreeLink.java (original)
+++ lenya/trunk/org.apache.lenya.module.sitetree/src/main/java/org/apache/lenya/cms/site/tree/SiteTreeLink.java Mon Feb 9 18:49:13 2009
@@ -17,7 +17,6 @@
*/
package org.apache.lenya.cms.site.tree;
-import org.apache.lenya.cms.publication.DocumentFactory;
import org.apache.lenya.cms.site.AbstractLink;
import org.apache.lenya.cms.site.SiteNode;
import org.apache.lenya.xml.DocumentHelper;
@@ -28,9 +27,8 @@
*/
public class SiteTreeLink extends AbstractLink {
- protected SiteTreeLink(DocumentFactory factory, SiteNode node, String _language,
- Element element) {
- super(factory, node, "", _language);
+ protected SiteTreeLink(SiteNode node, String _language, Element element) {
+ super(node, "", _language);
this.element = element;
}
@@ -38,7 +36,7 @@
SiteTreeNodeImpl node = (SiteTreeNodeImpl) getNode();
node.removeLabel(getLanguage());
}
-
+
private Element element;
/**
Modified: lenya/trunk/org.apache.lenya.module.sitetree/src/main/java/org/apache/lenya/cms/site/tree/SiteTreeNodeImpl.java
URL: http://svn.apache.org/viewvc/lenya/trunk/org.apache.lenya.module.sitetree/src/main/java/org/apache/lenya/cms/site/tree/SiteTreeNodeImpl.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/SiteTreeNodeImpl.java (original)
+++ lenya/trunk/org.apache.lenya.module.sitetree/src/main/java/org/apache/lenya/cms/site/tree/SiteTreeNodeImpl.java Mon Feb 9 18:49:13 2009
@@ -84,8 +84,6 @@
private Element node = null;
private DefaultSiteTree tree;
- private DocumentFactory factory;
-
/**
* Creates a new SiteTreeNodeImpl object.
* @param factory The document factory.
@@ -95,11 +93,10 @@
*
* @param _node the node which is to be wrapped by this SiteTreeNode
*/
- protected SiteTreeNodeImpl(DocumentFactory factory, DefaultSiteTree tree, Element node, Log logger) {
+ protected SiteTreeNodeImpl(DefaultSiteTree tree, Element node, Log logger) {
setLogger(logger);
this.node = node;
this.tree = tree;
- this.factory = factory;
}
public String getName() {
@@ -175,8 +172,7 @@
labelLanguage = languageAttribute.getNodeValue();
}
- labels.add(new SiteTreeLink(this.factory, this, labelLanguage,
- (Element) child));
+ labels.add(new SiteTreeLink(this, labelLanguage, (Element) child));
}
}
@@ -292,8 +288,7 @@
Element[] elements = helper.getChildren((Element) this.node, SiteTreeNodeImpl.NODE_NAME);
for (int i = 0; i < elements.length; i++) {
- SiteTreeNode newNode = new SiteTreeNodeImpl(this.factory, getTree(), elements[i],
- getLogger());
+ SiteTreeNode newNode = new SiteTreeNodeImpl(getTree(), elements[i], getLogger());
childElements.add(newNode);
}
@@ -309,8 +304,7 @@
Element[] elements = helper.getChildren((Element) this.node, SiteTreeNodeImpl.NODE_NAME);
for (int i = 0; i < elements.length; i++) {
this.node.removeChild(elements[i]);
- SiteTreeNode newNode = new SiteTreeNodeImpl(this.factory, getTree(), elements[i],
- getLogger());
+ SiteTreeNode newNode = new SiteTreeNodeImpl(getTree(), elements[i], getLogger());
childElements.add(newNode);
}
return (SiteTreeNode[]) childElements.toArray(new SiteTreeNode[childElements.size()]);
@@ -327,8 +321,7 @@
.getNextSiblings((Element) this.node, SiteTreeNodeImpl.NODE_NAME);
for (int i = 0; i < elements.length; i++) {
- SiteTreeNode newNode = new SiteTreeNodeImpl(this.factory, getTree(), elements[i],
- getLogger());
+ SiteTreeNode newNode = new SiteTreeNodeImpl(getTree(), elements[i], getLogger());
siblingElements.add(newNode);
}
@@ -346,8 +339,7 @@
SiteTreeNodeImpl.NODE_NAME);
for (int i = 0; i < elements.length; i++) {
- SiteTreeNode newNode = new SiteTreeNodeImpl(this.factory, getTree(), elements[i],
- getLogger());
+ SiteTreeNode newNode = new SiteTreeNodeImpl(getTree(), elements[i], getLogger());
siblingElements.add(newNode);
}
@@ -442,8 +434,7 @@
Node parentNode = this.node.getParentNode();
if (parentNode.getNodeType() == Node.ELEMENT_NODE
&& parentNode.getLocalName().equals(NODE_NAME)) {
- parent = new SiteTreeNodeImpl(this.factory, getTree(), (Element) parentNode,
- getLogger());
+ parent = new SiteTreeNodeImpl(getTree(), (Element) parentNode, getLogger());
} else {
throw new SiteException("The node [" + this + "] has no parent.");
}
@@ -595,7 +586,7 @@
public boolean isTopLevel() {
return getPath().lastIndexOf("/") == 0;
}
-
+
protected void save() {
try {
((DefaultSiteTree) getTree()).saveDocument();
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.