1 package org.sapia.soto.ubik; 2 3 import org.sapia.soto.Layer; 4 import org.sapia.soto.ServiceMetaData; 5 6 import javax.naming.ConfigurationException ; 7 8 9 21 public class UbikLayer implements Layer { 22 private NamingService _svc; 23 private String _name; 24 25 28 public UbikLayer() { 29 super(); 30 } 31 32 38 public void setNamingService(NamingService svc) { 39 _svc = svc; 40 } 41 42 46 public void setJndiName(String name) { 47 _name = name; 48 } 49 50 53 public void init(ServiceMetaData meta) throws Exception { 54 if (_svc == null) { 55 throw new ConfigurationException ("This layer expects a " + 56 NamingService.class.getName() + 57 " instance to be passed to it in a <namingService> element"); 58 } 59 60 if (_name == null) { 61 if (meta.getServiceID() == null) { 62 throw new org.sapia.soto.ConfigurationException( 63 "No 'jndiName' specified under which to bind the service: " + 64 meta.getService().getClass().getName()); 65 } 66 67 System.out.println("binding: " + meta.getServiceID()); 68 _svc.bind(meta.getServiceID(), meta.getService()); 69 } else { 70 _svc.bind(_name, meta.getService()); 71 } 72 } 73 74 77 public void start(ServiceMetaData meta) throws Exception { 78 } 79 80 83 public void dispose() { 84 } 85 } 86 | Popular Tags |