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 2005/04/07 11:31:49 UTC

svn commit: r160397 - in lenya/trunk/src/java/org/apache/lenya/cms: cocoon/source/RepositorySource.java cocoon/source/TransactionableSource.java repository/ repository/Node.java repository/SourceNode.java repository/SourceNodeFactory.java site/SiteStructure.java

Author: andreas
Date: Thu Apr  7 02:31:47 2005
New Revision: 160397

URL: http://svn.apache.org/viewcvs?view=rev&rev=160397
Log:
Introduced lightweigt repository layer using RepositorySource which is resolved by the lenya:// protocol. This allows transparent transaction handling in the source layer. The implementation is currently done using context:// sources, this can be changed to JCR later on.

Added:
    lenya/trunk/src/java/org/apache/lenya/cms/cocoon/source/RepositorySource.java
    lenya/trunk/src/java/org/apache/lenya/cms/cocoon/source/TransactionableSource.java
    lenya/trunk/src/java/org/apache/lenya/cms/repository/
    lenya/trunk/src/java/org/apache/lenya/cms/repository/Node.java
    lenya/trunk/src/java/org/apache/lenya/cms/repository/SourceNode.java
    lenya/trunk/src/java/org/apache/lenya/cms/repository/SourceNodeFactory.java
    lenya/trunk/src/java/org/apache/lenya/cms/site/SiteStructure.java

Added: lenya/trunk/src/java/org/apache/lenya/cms/cocoon/source/RepositorySource.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/cms/cocoon/source/RepositorySource.java?view=auto&rev=160397
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/cocoon/source/RepositorySource.java (added)
+++ lenya/trunk/src/java/org/apache/lenya/cms/cocoon/source/RepositorySource.java Thu Apr  7 02:31:47 2005
@@ -0,0 +1,299 @@
+/*
+ * Created on 03.04.2005
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package org.apache.lenya.cms.cocoon.source;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.PipedInputStream;
+import java.io.PipedOutputStream;
+import java.net.MalformedURLException;
+
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
+import org.apache.avalon.framework.logger.Logger;
+import org.apache.avalon.framework.service.ServiceManager;
+import org.apache.excalibur.source.ModifiableSource;
+import org.apache.excalibur.source.SourceException;
+import org.apache.excalibur.source.SourceNotFoundException;
+import org.apache.excalibur.source.impl.AbstractSource;
+import org.apache.lenya.cms.repository.Node;
+import org.apache.lenya.cms.repository.SourceNodeFactory;
+import org.apache.lenya.transaction.IdentityMap;
+import org.apache.lenya.transaction.TransactionException;
+import org.apache.lenya.xml.DocumentHelper;
+import org.w3c.dom.Document;
+
+/**
+ * Repository source.
+ * 
+ * @version $Id:$
+ */
+public class RepositorySource extends AbstractSource implements ModifiableSource,
+        TransactionableSource {
+
+    private ServiceManager manager;
+    private Node node;
+    private IdentityMap identityMap;
+    private Logger logger;
+    protected static final String SCHEME = "lenya";
+
+    /**
+     * @param manager The service manager.
+     * @param uri The source URI.
+     * @param map The identity map.
+     * @param logger The logger.
+     * @throws SourceException if an error occurs.
+     * @throws MalformedURLException if an error occurs.
+     */
+    public RepositorySource(ServiceManager manager, String uri, IdentityMap map, Logger logger)
+            throws SourceException, MalformedURLException {
+        this.manager = manager;
+        this.logger = logger;
+        this.identityMap = map;
+
+        if (uri == null) {
+            throw new MalformedURLException("The source URI must not be null!");
+        }
+
+        setSystemId(uri);
+
+        // Scheme
+        int start = 0;
+        int end = uri.indexOf(':');
+        if (end == -1)
+            throw new MalformedURLException(
+                    "Malformed uri for xmodule source (cannot find scheme) : " + uri);
+
+        String scheme = uri.substring(start, end);
+        if (!SCHEME.equals(scheme))
+            throw new MalformedURLException("Malformed uri for a xmodule source : " + uri);
+
+        setScheme(scheme);
+
+        if (map.getFactory(Node.TRANSACTIONABLE_TYPE) == null) {
+            map.setFactory(Node.TRANSACTIONABLE_TYPE, new SourceNodeFactory(this.manager, logger));
+        }
+
+        this.node = (Node) map.get(Node.TRANSACTIONABLE_TYPE, uri);
+
+    }
+
+    protected Logger getLogger() {
+        return this.logger;
+    }
+
+    /**
+     * @see org.apache.excalibur.source.ModifiableSource#getOutputStream()
+     */
+    public OutputStream getOutputStream() throws IOException {
+        try {
+            this.identityMap.getUnitOfWork().registerDirty(this.node);
+            if (!this.node.isLocked()) {
+                throw new RuntimeException("Cannot write to source [" + getURI() + "]: not locked!");
+            }
+            return new DOMOutputStream();
+        } catch (TransactionException e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    /**
+     * @see org.apache.excalibur.source.ModifiableSource#delete()
+     */
+    public void delete() {
+        try {
+            if (!this.node.isCheckedOut()) {
+                throw new RuntimeException("Cannot delete source [" + getURI()
+                        + "]: not checked out!");
+            } else {
+                this.node.delete();
+            }
+        } catch (TransactionException e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    /**
+     * @see org.apache.excalibur.source.ModifiableSource#canCancel(java.io.OutputStream)
+     */
+    public boolean canCancel(OutputStream arg0) {
+        return false;
+    }
+
+    /**
+     * @see org.apache.excalibur.source.ModifiableSource#cancel(java.io.OutputStream)
+     */
+    public void cancel(OutputStream arg0) throws IOException {
+    }
+
+    /**
+     * @see org.apache.excalibur.source.Source#exists()
+     */
+    public boolean exists() {
+        try {
+            return this.node.exists();
+        } catch (TransactionException e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    /**
+     * @see org.apache.excalibur.source.Source#getInputStream()
+     */
+    public InputStream getInputStream() throws IOException, SourceNotFoundException {
+        if (!exists()) {
+            throw new SourceNotFoundException("The source [" + getURI() + "] does not exist!");
+        }
+        try {
+            Document doc = this.node.getDocument();
+            return convert(doc);
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    protected InputStream convert(org.w3c.dom.Document edoc) throws IOException {
+
+        final org.w3c.dom.Document doc = edoc;
+        final PipedOutputStream pos = new PipedOutputStream();
+        PipedInputStream pis = new PipedInputStream();
+        pis.connect(pos);
+
+        (new Thread(new Runnable() {
+
+            public void run() {
+                try {
+                    transform(doc, pos);
+                } catch (TransformerException e) {
+                    throw new RuntimeException(
+                            "Failed to tranform org.w3c.dom.Document to PipedOutputStream", e);
+                } finally {
+                    try {
+                        pos.close();
+                    } catch (IOException ignore) {
+                    }
+                }
+            }
+        }, getClass().getName() + ".convert(org.w3c.dom.Document edoc)")).start();
+
+        return pis;
+    }
+
+    private void transform(org.w3c.dom.Document edoc, PipedOutputStream pos)
+            throws TransformerException {
+
+        TransformerFactory tFactory = TransformerFactory.newInstance();
+        Transformer transformer = tFactory.newTransformer();
+
+        transformer.setOutputProperty("encoding", "UTF-8");
+        transformer.setOutputProperty("indent", "yes");
+
+        transformer.transform(new DOMSource(edoc), new StreamResult(pos));
+
+    }
+
+    /**
+     * DOM output stream.
+     */
+    private class DOMOutputStream extends ByteArrayOutputStream {
+        /**
+         * @see java.io.OutputStream#close()
+         */
+        public void close() throws IOException {
+            byte[] content = super.toByteArray();
+            InputStream in = new ByteArrayInputStream(content);
+            Document document;
+            try {
+                document = DocumentHelper.readDocument(in);
+            } catch (Exception e) {
+                throw new RuntimeException(e);
+            }
+            RepositorySource.this.node.setDocument(document);
+            super.close();
+        }
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.apache.lenya.cms.cocoon.source.TransactionableSource#checkout()
+     */
+    public void checkout() throws TransactionException {
+        // TODO Auto-generated method stub
+
+    }
+
+    /*
+     * (non-Javadoc)
+     * @see org.apache.lenya.cms.cocoon.source.TransactionableSource#checkin()
+     */
+    public void checkin() throws TransactionException {
+        // TODO Auto-generated method stub
+
+    }
+
+    /**
+     * @see org.apache.lenya.cms.cocoon.source.TransactionableSource#lock()
+     */
+    public void lock() throws TransactionException {
+        if (this.identityMap.getUnitOfWork() != null) {
+            try {
+                this.node.lock();
+            } catch (TransactionException e) {
+                throw new RuntimeException("Locking source [" + getURI() + "] failed.");
+            }
+        }
+    }
+
+    /**
+     * @see org.apache.lenya.cms.cocoon.source.TransactionableSource#unlock()
+     */
+    public void unlock() throws TransactionException {
+        if (this.identityMap.getUnitOfWork() != null) {
+            try {
+                this.node.unlock();
+            } catch (TransactionException e) {
+                throw new RuntimeException("Locking source [" + getURI() + "] failed.");
+            }
+        }
+    }
+
+    protected boolean isLocked() throws TransactionException {
+        if (this.identityMap.getUnitOfWork() != null) {
+            try {
+                return this.node.isLocked();
+            } catch (TransactionException e) {
+                throw new RuntimeException("Locking source [" + getURI() + "] failed.");
+            }
+        }
+        return false;
+    }
+    
+    public Document getDocument() {
+        return this.node.getDocument();
+    }
+    
+    public void setDocument(Document document) {
+        this.node.setDocument(document);
+        try {
+            registerDirty();
+        } catch (TransactionException e) {
+            throw new RuntimeException(e);
+        }
+    }
+    
+    public void registerDirty() throws TransactionException {
+        this.identityMap.getUnitOfWork().registerDirty(this.node);
+    }
+
+}
\ No newline at end of file

Added: lenya/trunk/src/java/org/apache/lenya/cms/cocoon/source/TransactionableSource.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/cms/cocoon/source/TransactionableSource.java?view=auto&rev=160397
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/cocoon/source/TransactionableSource.java (added)
+++ lenya/trunk/src/java/org/apache/lenya/cms/cocoon/source/TransactionableSource.java Thu Apr  7 02:31:47 2005
@@ -0,0 +1,35 @@
+/*
+ * Created on 03.04.2005
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package org.apache.lenya.cms.cocoon.source;
+
+import org.apache.excalibur.source.Source;
+import org.apache.lenya.transaction.TransactionException;
+
+/**
+ * Transactionable source.
+ *
+ * @version $Id:$
+ */
+public interface TransactionableSource extends Source {
+
+    /**
+     * Checks the source out.
+     * @throws TransactionException if an error occurs.
+     */
+    void checkout() throws TransactionException;
+    
+    /**
+     * Checks the source in.
+     * @throws TransactionException if an error occurs.
+     */
+    void checkin() throws TransactionException;
+    
+    void lock() throws TransactionException;
+    
+    void unlock() throws TransactionException;
+    
+}

Added: lenya/trunk/src/java/org/apache/lenya/cms/repository/Node.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/cms/repository/Node.java?view=auto&rev=160397
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/repository/Node.java (added)
+++ lenya/trunk/src/java/org/apache/lenya/cms/repository/Node.java Thu Apr  7 02:31:47 2005
@@ -0,0 +1,29 @@
+/*
+ * Created on 06.04.2005
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package org.apache.lenya.cms.repository;
+
+import org.apache.lenya.transaction.TransactionException;
+import org.apache.lenya.transaction.Transactionable;
+import org.w3c.dom.Document;
+
+/**
+ * @author nobby
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public interface Node extends Transactionable {
+
+    Document getDocument();
+    
+    void setDocument(Document document);
+    
+    String TRANSACTIONABLE_TYPE = "node";
+    
+    boolean exists() throws TransactionException;
+    
+}

Added: lenya/trunk/src/java/org/apache/lenya/cms/repository/SourceNode.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/cms/repository/SourceNode.java?view=auto&rev=160397
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/repository/SourceNode.java (added)
+++ lenya/trunk/src/java/org/apache/lenya/cms/repository/SourceNode.java Thu Apr  7 02:31:47 2005
@@ -0,0 +1,307 @@
+/*
+ * Created on 06.04.2005
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package org.apache.lenya.cms.repository;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.apache.avalon.framework.logger.AbstractLogEnabled;
+import org.apache.avalon.framework.logger.Logger;
+import org.apache.avalon.framework.service.ServiceManager;
+import org.apache.excalibur.source.Source;
+import org.apache.excalibur.source.SourceResolver;
+import org.apache.lenya.ac.Identity;
+import org.apache.lenya.ac.User;
+import org.apache.lenya.cms.cocoon.source.SourceUtil;
+import org.apache.lenya.cms.publication.Publication;
+import org.apache.lenya.cms.publication.PublicationFactory;
+import org.apache.lenya.cms.rc.RCEnvironment;
+import org.apache.lenya.cms.rc.RevisionController;
+import org.apache.lenya.transaction.IdentityMap;
+import org.apache.lenya.transaction.Lock;
+import org.apache.lenya.transaction.TransactionException;
+import org.w3c.dom.Document;
+
+/**
+ * A repository node.
+ * 
+ * @version $Id:$
+ */
+public class SourceNode extends AbstractLogEnabled implements Node {
+
+    private Document document;
+    private String sourceUri;
+    private ServiceManager manager;
+    private IdentityMap identityMap;
+
+    /**
+     * Ctor.
+     * @param map
+     * @param sourceUri
+     * @param manager
+     * @param logger
+     */
+    public SourceNode(IdentityMap map, String sourceUri, ServiceManager manager, Logger logger) {
+        this.sourceUri = sourceUri;
+        this.manager = manager;
+        enableLogging(logger);
+        this.identityMap = map;
+    }
+
+    /**
+     * @see org.apache.lenya.cms.repository.Node#getDocument()
+     */
+    public Document getDocument() {
+        try {
+            if (this.document == null && SourceUtil.exists(getRealSourceURI(), this.manager)) {
+                this.document = SourceUtil.readDOM(getRealSourceURI(), this.manager);
+            }
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+        return this.document;
+    }
+
+    protected String getUserId() {
+        String userId = null;
+        Identity identity = this.identityMap.getUnitOfWork().getIdentity();
+        if (identity != null) {
+            User user = identity.getUser();
+            if (user != null) {
+                userId = user.getId();
+            }
+        }
+        return userId;
+    }
+
+    protected String getRealSourceURI() {
+        return "context://" + this.sourceUri.substring("lenya://".length());
+    }
+
+    /**
+     * @see org.apache.lenya.transaction.Transactionable#checkin()
+     */
+    public void checkin() throws TransactionException {
+        if (!isCheckedOut()) {
+            throw new TransactionException("Cannot check in node [" + this.sourceUri
+                    + "]: not checked out!");
+        }
+
+        try {
+            String userName = getUserId();
+            boolean newVersion = this.identityMap.getUnitOfWork().isDirty(this);
+            getRevisionController().reservedCheckIn(getRCPath(), userName, true, newVersion);
+            this.isCheckedOut = false;
+        } catch (Exception e) {
+            throw new TransactionException(e);
+        }
+    }
+
+    private boolean isCheckedOut = false;
+
+    /**
+     * @see org.apache.lenya.transaction.Transactionable#isCheckedOut()
+     */
+    public boolean isCheckedOut() throws TransactionException {
+        return isCheckedOut;
+    }
+
+    /**
+     * @see org.apache.lenya.transaction.Transactionable#checkout()
+     */
+    public void checkout() throws TransactionException {
+        if (!isCheckedOut()) {
+            try {
+                getRevisionController().reservedCheckOut(getRCPath(), getUserId());
+                this.isCheckedOut = true;
+            } catch (Exception e) {
+                throw new TransactionException(e);
+            }
+        }
+    }
+
+    /**
+     * @return The path to use for the revision controller.
+     * @throws IOException if an error occurs.
+     */
+    protected String getRCPath() throws IOException {
+        String publicationsPath = this.sourceUri.substring("lenya://lenya/pubs/".length());
+        String publicationId = publicationsPath.split("/")[0];
+        String path = publicationsPath + "/" + publicationId + "/content/";
+        return this.sourceUri.substring(path.length());
+    }
+
+    /**
+     * @see org.apache.lenya.transaction.Transactionable#delete()
+     */
+    public void delete() throws TransactionException {
+        try {
+            if (!isCheckedOut()) {
+                throw new RuntimeException("Cannot delete source [" + this.sourceUri
+                        + "]: not checked out!");
+            } else {
+                SourceUtil.delete(getRealSourceURI(), this.manager);
+            }
+        } catch (Exception e) {
+            throw new TransactionException(e);
+        }
+    }
+
+    private RevisionController revisionController;
+
+    protected RevisionController getRevisionController() throws TransactionException {
+        if (this.revisionController == null) {
+            try {
+                String publicationsPath = this.sourceUri.substring("lenya://lenya/pubs/".length());
+                String publicationId = publicationsPath.split("/")[0];
+
+                Source contextSource = null;
+                SourceResolver resolver = null;
+                try {
+                    resolver = (SourceResolver) this.manager.lookup(SourceResolver.ROLE);
+                    contextSource = resolver.resolveURI("context://");
+                    File context = org.apache.excalibur.source.SourceUtil.getFile(contextSource);
+                    PublicationFactory factory = PublicationFactory.getInstance(getLogger());
+                    Publication pub = factory.getPublication(publicationId, context
+                            .getAbsolutePath());
+
+                    String publicationPath = pub.getDirectory().getCanonicalPath();
+                    RCEnvironment rcEnvironment = RCEnvironment.getInstance(pub.getServletContext()
+                            .getCanonicalPath());
+                    String rcmlDirectory = publicationPath + File.separator
+                            + rcEnvironment.getRCMLDirectory();
+                    String backupDirectory = publicationPath + File.separator
+                            + rcEnvironment.getBackupDirectory();
+                    this.revisionController = new RevisionController(rcmlDirectory,
+                            backupDirectory, publicationPath);
+                } finally {
+                    if (resolver != null) {
+                        if (contextSource != null) {
+                            resolver.release(contextSource);
+                        }
+                        this.manager.release(resolver);
+                    }
+                }
+
+            } catch (Exception e) {
+                throw new TransactionException(e);
+            }
+        }
+        return this.revisionController;
+    }
+
+    private Lock lock;
+
+    /**
+     * @see org.apache.lenya.transaction.Transactionable#hasChanged()
+     */
+    public boolean hasChanged() throws TransactionException {
+        try {
+            int currentVersion = getRevisionController().getLatestVersion(getRCPath());
+            int lockVersion = getLock().getVersion();
+            return currentVersion > lockVersion;
+        } catch (Exception e) {
+            throw new TransactionException(e);
+        }
+    }
+
+    /**
+     * @see org.apache.lenya.transaction.Transactionable#save()
+     */
+    public void save() throws TransactionException {
+        if (!isCheckedOut()) {
+            throw new TransactionException("Cannot save node [" + this.sourceUri
+                    + "]: not checked out!");
+        }
+        try {
+            if (getLogger().isDebugEnabled()) {
+                getLogger().debug("Saving document [" + document.getDocumentElement().getNodeName()
+                        + "] to source [" + getRealSourceURI() + "]");
+            }
+            SourceUtil.writeDOM(this.document, getRealSourceURI(), this.manager);
+        } catch (Exception e) {
+            throw new TransactionException(e);
+        }
+    }
+
+    /**
+     * @see org.apache.lenya.transaction.Transactionable#create()
+     */
+    public void create() throws TransactionException {
+    }
+
+    /**
+     * @see org.apache.lenya.transaction.Transactionable#lock()
+     */
+    public void lock() throws TransactionException {
+        System.out.println("Locking " + this);
+        new Exception().printStackTrace();
+        int currentVersion;
+        try {
+            currentVersion = getRevisionController().getLatestVersion(getRCPath());
+        } catch (TransactionException e) {
+            throw e;
+        } catch (Exception e) {
+            throw new TransactionException(e);
+        }
+        this.lock = new Lock(currentVersion);
+    }
+
+    /**
+     * @see org.apache.lenya.transaction.Transactionable#getLock()
+     */
+    public Lock getLock() {
+        return this.lock;
+    }
+
+    /**
+     * @see org.apache.lenya.transaction.Transactionable#unlock()
+     */
+    public void unlock() throws TransactionException {
+        this.lock = null;
+    }
+
+    /**
+     * @see org.apache.lenya.transaction.Transactionable#isLocked()
+     */
+    public boolean isLocked() throws TransactionException {
+        return this.lock != null;
+    }
+
+    /**
+     * @see org.apache.lenya.transaction.Transactionable#getTransactionableType()
+     */
+    public String getTransactionableType() {
+        return Node.TRANSACTIONABLE_TYPE;
+    }
+
+    /**
+     * @see org.apache.lenya.cms.repository.Node#setDocument(org.w3c.dom.Document)
+     */
+    public void setDocument(Document document) {
+        if (getLogger().isDebugEnabled()) {
+            getLogger().debug("Setting document [" + document.getDocumentElement().getNodeName()
+                    + "]");
+        }
+        this.document = document;
+    }
+
+    /**
+     * @see org.apache.lenya.cms.repository.Node#exists()
+     */
+    public boolean exists() throws TransactionException {
+        return getDocument() != null;
+    }
+
+    /**
+     * @see java.lang.Object#toString()
+     */
+    public String toString() {
+        return "node " + this.sourceUri;
+    }
+    
+}
\ No newline at end of file

Added: lenya/trunk/src/java/org/apache/lenya/cms/repository/SourceNodeFactory.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/cms/repository/SourceNodeFactory.java?view=auto&rev=160397
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/repository/SourceNodeFactory.java (added)
+++ lenya/trunk/src/java/org/apache/lenya/cms/repository/SourceNodeFactory.java Thu Apr  7 02:31:47 2005
@@ -0,0 +1,43 @@
+/*
+ * Created on 06.04.2005
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+package org.apache.lenya.cms.repository;
+
+import org.apache.avalon.framework.logger.AbstractLogEnabled;
+import org.apache.avalon.framework.logger.Logger;
+import org.apache.avalon.framework.service.ServiceManager;
+import org.apache.lenya.transaction.IdentityMap;
+import org.apache.lenya.transaction.Transactionable;
+import org.apache.lenya.transaction.TransactionableFactory;
+
+/**
+ * @author nobby
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class SourceNodeFactory extends AbstractLogEnabled implements TransactionableFactory {
+
+    private ServiceManager manager;
+    
+    /**
+     * Ctor.
+     * @param manager
+     * @param logger
+     */
+    public SourceNodeFactory(ServiceManager manager, Logger logger) {
+        this.manager = manager;
+        enableLogging(logger);
+    }
+    
+    /**
+     * @see org.apache.lenya.transaction.TransactionableFactory#build(org.apache.lenya.transaction.IdentityMap, java.lang.String)
+     */
+    public Transactionable build(IdentityMap map, String key) throws Exception {
+        return new SourceNode(map, key, this.manager, getLogger());
+    }
+
+}

Added: lenya/trunk/src/java/org/apache/lenya/cms/site/SiteStructure.java
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/cms/site/SiteStructure.java?view=auto&rev=160397
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/site/SiteStructure.java (added)
+++ lenya/trunk/src/java/org/apache/lenya/cms/site/SiteStructure.java Thu Apr  7 02:31:47 2005
@@ -0,0 +1,28 @@
+/*
+ * Copyright  1999-2004 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+package org.apache.lenya.cms.site;
+
+import org.apache.lenya.transaction.Transactionable;
+
+/**
+ * Object to hold a site structure information.
+ *
+ * @version $Id:$
+ */
+public interface SiteStructure extends Transactionable {
+
+}



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org