Russ Leong wrote: > Hi, > I am attempting to add a new SubjectNode to Slide. > -------------------- > NamespaceAccessToken tok = dom.accessNamespace(new SecurityToken(""), "version"); > Structure struct = tok.getStructureHelper(); > SlideToken token = new SlideTokenImpl(new CredentialsToken(new String("root"))); > struct.create(token, new SubjectNode(), "/users/tom"); > -------------------- > > In the database, user root has inheritable non-negative permission "/actions" on "/" >and "/users" > but on executing the code I will get this : > -------------------- > org.apache.slide.common.SlideException - DEBUG - >org.apache.slide.structure.ObjectNotFoundException: No object found at /users/tom > at >slidestore.reference.JDBCDescriptorsStore.retrieveObject(JDBCDescriptorsStore.java:584) > at >org.apache.slide.store.StandardStore.retrieveObject(StandardStore.java:171) > at org.apache.slide.structure.StructureImpl.create(StructureImpl.java:322) > at testing.TestSlide.init(TestSlide.java:55) > at __jspPage1_testing_jsp._jspService(__jspPage1_testing_jsp.java:69) > at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:54) > at >com.evermind.server.http.HttpApplication.serviceJSP(HttpApplication.java:5458) > at com.evermind.server.http.JSPServlet.service(JSPServlet.java:31) > at >com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:501) > at >com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:170) > at >com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:576) > at >com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:189) > at com.evermind.util.ThreadPoolThread.run(ThreadPoolThread.java:62) > > org.apache.slide.common.Domain - DEBUG - Checking basic permissions on new object > org.apache.slide.common.Domain - DEBUG - Basic permissions granted for user root > WARNING - WARNING: No active transaction > WARNING - WARNING: No active transaction > -------------------- > > Is there something wrong with my code? Any help is appreciated. > > Russ
Hi Russ, Please post slide use questions on slide user list. You have to add node properties to content store. Here is a static method you may use to create users : /** * Method used to create user's nodes. * * @param uri node's uri. * @param password user's password. * @param structure slide's structure helper. * @param content slide's content helper. * @param st slide's token. */ public static void createUser(String uri, String password, Structure structure, Content content, SlideToken st) throws AccessDeniedException, ObjectAlreadyExistsException, ObjectNotFoundException, LinkedObjectNotFoundException, RevisionAlreadyExistException, ServiceAccessException, ObjectLockedException { // create object ObjectNode node = new slideroles.basic.UserRoleImpl(uri); // create object's properties NodeRevisionDescriptor revision = new NodeRevisionDescriptor(0); NodeProperty property = new NodeProperty("resourcetype", "<collection/>", true); revision.setProperty(property); Date date = new Date(); revision.setCreationDate(date); revision.setLastModified(date); property = new NodeProperty("getcontentlength", "0", true); revision.setProperty(property); property = new NodeProperty("source", "", true); revision.setProperty(property); String owner = Token.getOwner(st); property = new NodeProperty("owner", owner, true); revision.setProperty(property); property = new NodeProperty("password", password, NodeProperty.SLIDE_NAMESPACE); revision.setProperty(property); // store object structure.create(st, node, uri); content.create(st, uri, revision, null); } An here is a sample call from a Servlet, st being the SlideToken : // access namespace NamespaceAccessToken nat = Domain.accessNamespace(new SecurityToken(getServletContext()), "slide"); if(nat == null) return; // get the helpers Structure structure = nat.getStructureHelper(); Content content = nat.getContentHelper(); // feed user's node String uri = "/users/foobar"; String password = "hisPassword"; // begin transaction try { try { nat.begin(); // create a user node createUser(uri, password, structure, content, st); ... // commit transaction nat.commit(); } // catch exceptions catch(ObjectAlreadyExistsException e) { // duplicate name throw e; } } catch(Exception e) { // rollback the transaction try { nat.rollback(); } catch(SystemException se) { // jta error } } finally { Domain.closeNamespace(nat); } jp -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>