1 22 package org.jboss.ejb.plugins.keygenerator.uuid; 23 24 import javax.naming.Context ; 25 import javax.naming.InitialContext ; 26 27 import org.jboss.system.ServiceMBeanSupport; 28 import org.jboss.naming.Util; 29 30 import org.jboss.ejb.plugins.keygenerator.KeyGeneratorFactory; 31 32 42 public class UUIDKeyGeneratorFactoryService 43 extends ServiceMBeanSupport 44 implements UUIDKeyGeneratorFactoryServiceMBean 45 { 46 47 49 50 KeyGeneratorFactory keyGeneratorFactory; 51 52 54 public void startService() 55 { 56 try 58 { 59 keyGeneratorFactory = new UUIDKeyGeneratorFactory(); 60 } 61 catch( Exception e ) { 62 log.error( "Caught exception during startService()", e ); 63 } 65 66 try 68 { 69 Context ctx = (Context ) new InitialContext (); 70 Util.rebind( ctx, keyGeneratorFactory.getFactoryName(), 71 keyGeneratorFactory ); 72 } 73 catch( Exception e ) { 74 log.error( "Caught exception during startService()", e ); 75 } 77 } 78 79 public void stopService() 80 { 81 try 83 { 84 Context ctx = (Context ) new InitialContext (); 85 Util.unbind( ctx, keyGeneratorFactory.getFactoryName() ); 86 } 87 catch( Exception e ) { 88 log.error( "Caught exception during stopService()", e ); 89 } 91 } 92 } 93 | Popular Tags |