KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > portal > cms > NodeFactory


1 /*****************************************
2  * *
3  * JBoss Portal: The OpenSource Portal *
4  * *
5  * Distributable under LGPL license. *
6  * See terms of license at gnu.org. *
7  * *
8  *****************************************/

9 package org.jboss.portal.cms;
10
11 import org.apache.slide.common.NamespaceAccessToken;
12
13 import javax.transaction.TransactionManager JavaDoc;
14
15 /**
16  * @author <a HREF="mailto:julien@jboss.org">Julien Viet</a>
17  * @version $Revision: 1.3 $
18  */

19 public class NodeFactory
20 {
21
22    /** The object that gives nodes. */
23    private NamespaceAccessToken nat;
24
25    NodeFactory(NamespaceAccessToken nat)
26    {
27       this.nat = nat;
28    }
29
30    void close()
31    {
32       nat = null;
33    }
34
35    /**
36     * @deprecated
37     */

38    public Node getNode(NamespaceAccessToken nat, String JavaDoc uri) throws NodeException
39    {
40       return new Node(nat, uri, null, "root");
41    }
42
43    /**
44     * @throws IllegalStateException if the factory is closed
45     */

46    public TransactionManager JavaDoc getTransactionManager() throws IllegalStateException JavaDoc
47    {
48       NamespaceAccessToken nat = this.nat;
49       if (nat == null)
50       {
51          throw new IllegalStateException JavaDoc("Factory closed");
52       }
53       return nat.getTransactionManager();
54    }
55
56    /**
57     * @param uri the node uri
58     * @throws IllegalStateException if the factory is closed
59     */

60    public Node getNode(String JavaDoc uri) throws NodeException, IllegalStateException JavaDoc
61    {
62       NamespaceAccessToken nat = this.nat;
63       if (nat == null)
64       {
65          throw new IllegalStateException JavaDoc("Factory closed");
66       }
67       return new Node(nat, uri, null, "root");
68    }
69
70 }
71
Popular Tags