User: starksm
Date: 02/03/11 17:41:49
Modified: src/main/org/jboss/security/srp SRPService.java
Log:
Support jndi names with subcontexts and cleanup bindings on shutdown
Revision Changes Path
1.8 +24 -10 jbosssx/src/main/org/jboss/security/srp/SRPService.java
Index: SRPService.java
===================================================================
RCS file: /cvsroot/jboss/jbosssx/src/main/org/jboss/security/srp/SRPService.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- SRPService.java 8 Mar 2002 05:32:16 -0000 1.7
+++ SRPService.java 12 Mar 2002 01:41:49 -0000 1.8
@@ -29,7 +29,7 @@
system described in RFC2945.
@author [EMAIL PROTECTED]
- @version $Revision: 1.7 $
+ @version $Revision: 1.8 $
*/
public class SRPService extends ServiceMBeanSupport
implements SRPServiceMBean, SRPServerListener
@@ -212,11 +212,7 @@
return "SRPService";
}
- public void initService() throws Exception
- {
- }
-
- public void startService() throws Exception
+ protected void startService() throws Exception
{
loadStore();
server = new SRPRemoteServer(verifierStore, serverPort,
@@ -228,17 +224,35 @@
Class[] interfaces = {SRPServerInterface.class};
Object proxy = Proxy.newProxyInstance(loader, interfaces, proxyHandler);
InitialContext ctx = new InitialContext();
+ Name name = ctx.getNameParser("").parse(serverJndiName);
+ if( name.size() > 1 )
+ {
+ int size = name.size();
+ Name prefix = name.getPrefix(size-1);
+ org.jboss.naming.Util.createSubcontext(ctx, prefix);
+ }
ctx.rebind(serverJndiName, proxy);
- log.info("Bound SRPServerProxy at "+serverJndiName);
+ log.debug("Bound SRPServerProxy at "+serverJndiName);
// The type of cache needs to be externalized...
cachePolicy = new TimedCachePolicy(cacheTimeout, true, cacheResolution);
cachePolicy.create();
cachePolicy.start();
// Bind a reference to store using NonSerializableFactory as the ObjectFactory
- Name name = ctx.getNameParser("").parse(cacheJndiName);
- NonSerializableFactory.rebind(name, cachePolicy);
- log.info("Bound AuthenticationCache at "+cacheJndiName);
+ name = ctx.getNameParser("").parse(cacheJndiName);
+ NonSerializableFactory.rebind(name, cachePolicy, true);
+ log.debug("Bound AuthenticationCache at "+cacheJndiName);
+ }
+
+ protected void stopService() throws Exception
+ {
+ // Bind a reference to store using NonSerializableFactory as the ObjectFactory
+ InitialContext ctx = new InitialContext();
+ ctx.unbind(serverJndiName);
+ log.debug("Unbound SRPServerProxy at "+serverJndiName);
+ NonSerializableFactory.unbind(cacheJndiName);
+ ctx.unbind(cacheJndiName);
+ log.debug("Unbound AuthenticationCache at "+cacheJndiName);
}
private void loadStore() throws NamingException
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development