27.03.2013 Views

JBoss Enterprise Application Platform Common Criteria Certification ...

JBoss Enterprise Application Platform Common Criteria Certification ...

JBoss Enterprise Application Platform Common Criteria Certification ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

36 Chapter 6. The JNDI Naming Service<br />

<br />

ReadOnlyAccessFilter<br />

org.jboss.invocation.http.servlet.ReadOnlyAccessFilter<br />

<br />

readOnlyContext<br />

readonly<br />

The top level JNDI context the filter will enforce<br />

read-only access on. If specified only Context.lookup operations<br />

will be allowed on this context. Another other operations or<br />

lookups on any other context will fail. Do not associate this<br />

filter with the JMXInvokerServlets if you want unrestricted<br />

access. <br />

<br />

<br />

invokerName<br />

jboss:service=Naming<br />

The JMX ObjectName of the naming service mbean<br />

<br />

<br />

<br />

<br />

ReadOnlyAccessFilter<br />

/readonly/*<br />

<br />

<br />

<br />

<br />

JMXInvokerServlet<br />

/readonly/JMXInvokerServlet/*<br />

<br />

The readOnlyContext parameter is set to readonly which means that when you access <strong>JBoss</strong><br />

through the ReadOnlyJNDIFactory, you will only be able to access data in the readonly context.<br />

Here is a code fragment that illustrates the usage:<br />

Properties env = new Properties();<br />

env.setProperty(Context.INITIAL_CONTEXT_FACTORY,<br />

"org.jboss.naming.HttpNamingContextFactory");<br />

env.setProperty(Context.PROVIDER_URL,<br />

"http://localhost:8080/invoker/ReadOnlyJNDIFactory");<br />

Context ctx2 = new InitialContext(env);<br />

Object data = ctx2.lookup("readonly/data");<br />

Attempts to look up any objects outside of the readonly context will fail. Note that <strong>JBoss</strong> doesn't ship with<br />

any data in the readonly context, so the readonly context won't be bound usable unless you create it.<br />

6.5. Additional Naming MBeans<br />

In addition to the NamingService MBean that configures an embedded <strong>JBoss</strong>NS server within <strong>JBoss</strong>,<br />

there are several additional MBean services related to naming that ship with <strong>JBoss</strong>. They are<br />

JndiBindingServiceMgr, NamingAlias, ExternalContext, and JNDIView.<br />

6.5.1. JNDI Binding Manager<br />

The JNDI binding manager service allows you to quickly bind objects into JNDI for use by application<br />

code. The MBean class for the binding service is org.jboss.naming.JNDIBindingServiceMgr. It<br />

has a single attribute, BindingsConfig, which accepts an XML document that conforms to the jndibinding-service_1_0.xsd<br />

schema. The content of the BindingsConfig attribute is<br />

unmarshalled using the <strong>JBoss</strong>XB framework. The following is an MBean definition that shows the most<br />

basic form usage of the JNDI binding manager service.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!