1 29 30 package com.caucho.naming; 31 32 import javax.naming.NamingException ; 33 import java.util.List ; 34 35 38 abstract public class AbstractModel { 39 protected AbstractModel create() 40 { 41 throw new UnsupportedOperationException (); 42 } 43 44 49 public AbstractModel copy() 50 throws NamingException 51 { 52 AbstractModel copy = create(); 53 54 List names = list(); 55 for (int i = 0; i < names.size(); i++) { 56 String name = (String ) names.get(i); 57 Object value = lookup(name); 58 59 if (value instanceof AbstractModel) 60 copy.bind(name, ((AbstractModel) value).copy()); 61 else 62 copy.bind(name, value); 63 } 64 65 return copy; 66 } 67 68 75 public Object lookup(String name) 76 throws NamingException 77 { 78 throw new UnsupportedOperationException (); 79 } 80 81 84 public void bind(String name, Object obj) 85 throws NamingException 86 { 87 throw new UnsupportedOperationException (getClass().getName()); 88 } 89 90 93 public void unbind(String name) 94 throws NamingException 95 { 96 throw new UnsupportedOperationException (getClass().getName()); 97 } 98 99 102 public AbstractModel createSubcontext(String name) 103 throws NamingException 104 { 105 throw new UnsupportedOperationException (); 106 } 107 108 111 public List list() 112 throws NamingException 113 { 114 throw new UnsupportedOperationException (); 115 } 116 } 117 | Popular Tags |