jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "kazim_ssuet@yahoo.com" <kazim_ss...@yahoo.com>
Subject Local vs Remote access while creating Namespace and Node Types
Date Wed, 13 Oct 2010 15:07:57 GMT

I have following code that creates a new namespace:

NamespaceRegistry nsReg = session.getWorkspace().getNamespaceRegistry();
nsReg.registerNamespace("csi", "http://www.csi.com");

I created namespace using local access (creating repository using
repository.xml location and repository folder).

Question 1: This namespace (created as local access) is not visible in
remote access when I run standalone server and use RMI API, why?

I had to register namespace again using remote repository access through
RMI.

Question 2: Why do I have to create namespace in same repository for each
access type? it is same repository no matter how you access it, right?

Then I tried to create new node types using following code:

JackrabbitNodeTypeManager  manager = (JackrabbitNodeTypeManager )
session.getWorkspace().getNodeTypeManager();
manager.registerNodeTypes(new FileInputStream(cndFileName),
JackrabbitNodeTypeManager.TEXT_X_JCR_CND);

Turned out I couldn't register node types using above code through RMI, so
ran it using local access. Nodes types were loaded fine. But still those
node types created through local access are not available remotely.

Question 3: If there is no way to create node types remotely, and node types
created locally are no visible remotely, then how can I create node types
that are available remotely?

I tried creating node (using local access) of newly created node types
locally and was able to create nodes then I tried to browse repository using
http://localhost:8080/ provided by standalone server and there was nothing
in standalone server's repository. I could fetch nodes through API (using
local access), so nodes are there.

Question 4: Why nodes created using local API access are not visible through
standalone server's http access?

Seems like standalone server and locally accessed API are running against
different repositories? Is it possible? I must be doing something wrong

In case I am doing something wrong while getting repositories I am posting
the code that I use to get local and remote repository below.

My repository.xml is at:
C:\JCR\jackrabbit\repository.xml

My standalone server is at:
C:\JCR\jackrabbit-standalone.jar

Standalone server created this folder when ran first time:
C:\JCR\jackrabbit

Here are the two methods that I use to get local and remote repositories:

private static Repository getRemoteRepository() throws MalformedURLException
{
	return (Repository) new URLRemoteRepository("http://localhost:8080/rmi");
}
	
private static Repository getLocalRepository() throws NamingException,
RepositoryException
{
	String configFile = "C:\\JCR\\jackrabbit\\repository.xml";
	String repHomeDir = "C:\\JCR\\jackrabbit\\repository";

	Hashtable env = new Hashtable();

	env.put(Context.INITIAL_CONTEXT_FACTORY,
 		 "org.apache.jackrabbit.core.jndi" +
 		 ".provider.DummyInitialContextFactory");

	env.put(Context.PROVIDER_URL, "localhost");

	InitialContext ctx = new InitialContext(env);

	RegistryHelper.registerRepository(ctx,
			 "repo",
			 configFile,
			 repHomeDir,
			 true);

	return (Repository) ctx.lookup("repo");
}

I am cluless, please help.
-- 
View this message in context: http://jackrabbit.510166.n4.nabble.com/Local-vs-Remote-access-while-creating-Namespace-and-Node-Types-tp2993831p2993831.html
Sent from the Jackrabbit - Dev mailing list archive at Nabble.com.

Mime
View raw message