You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-dev@jakarta.apache.org by SomchaiDion <ls...@k3.dion.ne.jp> on 2003/06/10 21:37:29 UTC

Namespace.RegisterStore() should have setNamespace()

Dear sir,
    I try to write a dynamic store loading as the code in method addStore()
below. I use the Namespace#registerStore() that I think it should do
everything but it doesn't.
    First problem is, the adding store does not initialize.
    Second, every children store of the adding store do not set the
namespace (the scope is set) which the NullPointerException error occur when
I try to create a node as attach below.
    And, the last problem is, I have to create a new subject node for this
store event it already has. May be, I have to call some other method but I
don't know. So, this way work for me. If I don't create, the
content/structure of the adding store will not recognize. However, this way
will throw the ObjectNodeAlreadyExistException, but work.
    I don't know what should the Namespace#registerStore() realy do. It may
be a bug or may be has other better way to do. Please advice me.

Regards,
Somchai

===== part of code for dynamic loading store =====
    public static void addStore(String namespaceName) {
        Namespace namespace = Domain.getNamespace(namespaceName);
        NamespaceAccessToken token = Domain.accessNamespace(new
SecurityToken(""), namespaceName);
        SlideToken slideToken = new SlideTokenImpl(new
CredentialsToken("root"));
        try {
            Scope scope = new Scope("/config");
            String cfgpath = getConfigPath();
            System.out.println("Config path = "+cfgpath);
            JDBCDescriptorsStore ds = new JDBCDescriptorsStore();
            Hashtable dsparam = new Hashtable();
            dsparam.put("driver","org.hsqldb.jdbcDriver");
            dsparam.put("url","jdbc:hsqldb:"+cfgpath+"\\descriptor");
            dsparam.put("user","sa");
            dsparam.put("password","");
            ds.setParameters(dsparam);

            JDBCContentStore cs = new JDBCContentStore();
            Hashtable csparam = new Hashtable();
            csparam.put("driver","org.hsqldb.jdbcDriver");
            csparam.put("url","jdbc:hsqldb:"+cfgpath+"\\content");
            csparam.put("user","sa");
            csparam.put("password","");
            cs.setParameters(csparam);

            Hashtable childstore = new Hashtable();
            childstore.put(Namespace.NODE_STORE,ds);
            childstore.put(Namespace.CONTENT_STORE,cs);


namespace.registerStore("jdbc",org.apache.slide.store.StandardStore.class,
                                    new Hashtable(),scope,childstore);
            Store store = namespace.getStore(scope);
            //store.setNamespace(namespace);
            store.initialize(token);
            token.getStructureHelper().create(slideToken, new SubjectNode(),
"/config");
            logInfo(Main.class,"Register store. OK");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

===== NullPointerException because the namespace does not set =====

11 Jun 2003 03:42:07 - org.apache.slide.common.Domain - INFO - Initializing
Domain
11 Jun 2003 03:42:07 - org.apache.slide.common.Domain - INFO - Domain
configuration : {org.apache.slide.lock=true,
org.apache.slide.versioncontrol=true, org.apache.slide.debug=false,
org.apache.slide.search=true, org.apache.slide.security=true}
11 Jun 2003 03:42:07 - org.apache.slide.common.Domain - INFO - Domain
parameters: {logger-level=6,
logger=org.apache.slide.util.logger.SimpleLogger, default=slide}
11 Jun 2003 03:42:07 - org.apache.slide.common.Domain - INFO - Initializing
namespace : slide
11 Jun 2003 03:42:08 - org.apache.slide.common.Domain - WARNING - Loading of
create_store_listener class failed: org.apache.slide.webdav.util.UriHandler
11 Jun 2003 03:42:08 - org.apache.slide.common.Namespace - INFO - Loading
namespace slide parameters
11 Jun 2003 03:42:08 - org.apache.slide.common.Domain - WARNING - Loading of
standard live properties class failed:
org.apache.slide.webdav.util.resourcekind.AbstractResourceKind
11 Jun 2003 03:42:08 - org.apache.slide.common.Namespace - INFO - Loading
namespace definition
11 Jun 2003 03:42:09 - org.apache.slide.common.Namespace - INFO - Node
store: slidestore.reference.MemoryDescriptorsStore
11 Jun 2003 03:42:09 - org.apache.slide.common.Namespace - INFO - Security
store references nodestore
11 Jun 2003 03:42:09 - org.apache.slide.common.Namespace - INFO - Lock store
store references nodestore
11 Jun 2003 03:42:09 - org.apache.slide.common.Namespace - INFO - Revision
descriptors store references nodestore
11 Jun 2003 03:42:09 - org.apache.slide.common.Namespace - INFO - Revision
descriptor store references nodestore
11 Jun 2003 03:42:09 - org.apache.slide.common.Namespace - INFO - Content
store: slidestore.reference.FileContentStore
11 Jun 2003 03:42:09 - org.apache.slide.common.Namespace - INFO -
Registering Store memory (class org.apache.slide.store.StandardStore) with
parameters {} on scope /
11 Jun 2003 03:42:09 - org.apache.slide.common.Namespace - INFO -
Initializing Store memory(org.apache.slide.store.StandardStore)
11 Jun 2003 03:42:10 - org.apache.slide.common.Domain - WARNING - Loading of
redirector class failed: org.apache.slide.webdav.util.DeltavUriRedirector
11 Jun 2003 03:42:11 - INFO - FileContentStore rootpath:
D:\s1studio\ce\bin\contentstore
11 Jun 2003 03:42:11 - org.apache.slide.common.Namespace - INFO - Loading
namespace slide base data
11 Jun 2003 03:42:11 - org.apache.slide.common.Namespace - INFO - Init
namespace slide configuration
11 Jun 2003 03:42:11 - org.apache.slide.common.Namespace - INFO - Import
data into namespace slide
11 Jun 2003 03:42:11 - org.apache.slide.common.XMLUnmarshaller - INFO -
Loading object /
11 Jun 2003 03:42:11 - org.apache.slide.common.XMLUnmarshaller - INFO -
Loading object /users
11 Jun 2003 03:42:11 - org.apache.slide.common.XMLUnmarshaller - INFO -
Loading object /users/groupA
11 Jun 2003 03:42:12 - org.apache.slide.common.XMLUnmarshaller - INFO -
Loading object /users/groupA/john
11 Jun 2003 03:42:12 - org.apache.slide.common.XMLUnmarshaller - INFO -
Loading object /users/groupA/root
11 Jun 2003 03:42:12 - org.apache.slide.common.XMLUnmarshaller - INFO -
Loading object /users/groupA/singleGroupMember
11 Jun 2003 03:42:12 - org.apache.slide.common.XMLUnmarshaller - INFO -
Loading object /users/root
11 Jun 2003 03:42:12 - org.apache.slide.common.XMLUnmarshaller - INFO -
Loading object /users/john
11 Jun 2003 03:42:12 - org.apache.slide.common.XMLUnmarshaller - INFO -
Loading object /users/guest
11 Jun 2003 03:42:12 - org.apache.slide.common.XMLUnmarshaller - INFO -
Loading object /actions
11 Jun 2003 03:42:12 - org.apache.slide.common.XMLUnmarshaller - INFO -
Loading object /actions/read
11 Jun 2003 03:42:12 - org.apache.slide.common.XMLUnmarshaller - INFO -
Loading object /actions/write
11 Jun 2003 03:42:12 - org.apache.slide.common.XMLUnmarshaller - INFO -
Loading object /actions/manage
11 Jun 2003 03:42:12 - org.apache.slide.common.XMLUnmarshaller - INFO -
Loading object /files
11 Jun 2003 03:42:12 - org.apache.slide.common.Namespace - INFO - Finish
init namespace slide configuration
11 Jun 2003 03:42:12 - org.apache.slide.common.Namespace - INFO - Loading
namespace slide configuration
11 Jun 2003 03:42:12 - org.apache.slide.common.Domain - INFO - Namespace
configuration complete
11 Jun 2003 03:42:12 - org.vsl.webdbobject.Main - INFO - Initialize default
domain from config path complete.
Config path = D:\Somchai\Config
11 Jun 2003 03:42:12 - slidestore.reference.JDBCDescriptorsStore - INFO -
Loading and registering driver: org.hsqldb.jdbcDriver
11 Jun 2003 03:42:12 - INFO - FileContentStore rootpath:
D:\s1studio\ce\bin\.
11 Jun 2003 03:42:12 - slidestore.reference.JDBCContentStore - INFO -
Loading and registering driver: org.hsqldb.jdbcDriver
java.lang.NullPointerException
        at
org.apache.slide.common.AbstractServiceBase.getLogger(AbstractServiceBase.ja
va:124)
        at
slidestore.reference.JDBCDescriptorsStore.connect(JDBCDescriptorsStore.java:
313)
        at
org.apache.slide.common.AbstractServiceBase.connect(AbstractServiceBase.java
:157)
        at
org.apache.slide.store.AbstractStore.connect(AbstractStore.java:240)
        at
org.apache.slide.common.AbstractServiceBase.connectIfNeeded(AbstractServiceB
ase.java:229)
        at
org.apache.slide.common.Namespace.connectService(Namespace.java:535)
        at
org.apache.slide.common.Namespace.retrieveStore(Namespace.java:634)
        at org.apache.slide.common.Uri.parseUri(Uri.java:370)
        at org.apache.slide.common.Uri.<init>(Uri.java:106)
        at org.apache.slide.common.Namespace.getUri(Namespace.java:682)
        at org.apache.slide.common.Namespace.getUri(Namespace.java:662)
        at org.apache.slide.common.Namespace.getUri(Namespace.java:650)
        at
org.apache.slide.common.UriTokenizer.nextUri(UriTokenizer.java:233)
        at
org.apache.slide.structure.StructureImpl.create(StructureImpl.java:319)
        at org.vsl.webdbobject.Main.addStore(Main.java:187)
        at org.vsl.webdbobject.Main.loadDefaultDomain(Main.java:237)
        at org.vsl.webdbobject.Main.main(Main.java:65)
11 Jun 2003 03:42:30 - org.vsl.webdbobject.ui.MainUI - INFO - Set access
'slide' namespace by 'root' user



---------------------------------------------------------------------
To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-dev-help@jakarta.apache.org