jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stefan Guggisberg" <stefan.guggisb...@gmail.com>
Subject Re: New Workspace Initialization & Jackrabbit Resource Adapter
Date Thu, 08 Feb 2007 11:27:09 GMT
hi daniel,

On 2/5/07, Daniel Bloomfield Ramagem <daniel.ramagem@gmail.com> wrote:
> I'm trying to create a new workspace from within a servlet that has a
> reference to the Jackrabbit Resource Adapter (RAR).  The new workspace
> directory seems to get only partially initialized however--there is only the
> workspace.xml file inside of the newly created workspace.
> For example, before running my code I have the normal default workspace:
> /jackrabbit-repo/workspaces/default/blobs
> /jackrabbit-repo/workspaces/default/db
> /jackrabbit-repo/workspaces/default/index
> /jackrabbit-repo/workspaces/default/locks
> /jackrabbit-repo/workspaces/default/workspace.xml
> But after creation of a new "foo" workspace I only have the following for
> this new workspace:
> /jackrabbit-repo/workspaces/foo/workspace.xml

that's correct and fine.

> In the logs I also don't see the typical initialization messages I see for
> "default":
> INFO  [RepositoryImpl] initializing workspace 'default'...
> INFO  [LocalFileSystem] LocalFileSystem initialized at path
> C:\jackrabbit-repo\workspaces\default
> INFO  [LocalFileSystem] LocalFileSystem initialized at path
> C:\jackrabbit-repo\workspaces\default\blobs
> INFO  [RepositoryImpl] workspace 'default' initialized
> INFO  [SearchIndex] Index initialized: C:/jackrabbit-repo/repository/index
> INFO  [SearchIndex] Index initialized:
> C:\jackrabbit-repo\workspaces\default/index
> Am I missing something?  I thought creation of a new workspace basically
> involved casting a workspace into JackrabbitWorkspace and calling the
> "createWorkspace" method.  Then, upon first login into the new workspace all
> of the workspace structures would get created.

again correct and fine. a workspace is initialized on first access. i.e.
creating a workspace just creates the configuration. once you first
access the workspace (by logging in to it) the workspace is initialized
according to its configuration.

> It's almost as if with the RAR it's delaying the initialization of the
> workspace?  How do I "force" initialization of this new workspace?

by logging in to the new workspace. however, i don't understand why
you want/need to force the initialization. a workspace is intentionally
lazily initialized. does this cause any issue with your app?


> This is my code:
> Context ctx = new InitialContext();
> Repository repository = (Repository) ctx.lookup("java:comp/env/jackrabbit");
> Credentials credentials = new SimpleCredentials("username",
> "password".toCharArray());
> Session session = repository.login(credentials);
> Workspace workspace = session.getWorkspace();
> JackrabbitWorkspace jws = (JackrabbitWorkspace) workspace;
> jws.createWorkspace(workspaceName);
> // login to force the initalization of the workspace now rather than later
> session = repository.login(credentials, workspaceName);
> Node root = session.getRootNode();
> Thanks,
> Daniel.

View raw message