1/* 2 * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23package util; 24 25import java.util.Hashtable; 26import javax.naming.Binding; 27import javax.naming.Context; 28import javax.naming.Name; 29import javax.naming.NameClassPair; 30import javax.naming.NameParser; 31import javax.naming.NamingEnumeration; 32import javax.naming.NamingException; 33 34@SuppressWarnings("unchecked") 35public class StubContext implements Context { 36 37 @Override 38 public Object lookup(Name name) throws NamingException { 39 return null; 40 } 41 42 @Override 43 public Object lookup(String name) throws NamingException { 44 return null; 45 } 46 47 @Override 48 public void bind(Name name, Object obj) throws NamingException { 49 50 } 51 52 @Override 53 public void bind(String name, Object obj) throws NamingException { 54 55 } 56 57 @Override 58 public void rebind(Name name, Object obj) throws NamingException { 59 60 } 61 62 @Override 63 public void rebind(String name, Object obj) throws NamingException { 64 65 } 66 67 @Override 68 public void unbind(Name name) throws NamingException { 69 70 } 71 72 @Override 73 public void unbind(String name) throws NamingException { 74 75 } 76 77 @Override 78 public void rename(Name oldName, Name newName) throws NamingException { 79 80 } 81 82 @Override 83 public void rename(String oldName, String newName) throws NamingException { 84 85 } 86 87 @Override 88 public NamingEnumeration<NameClassPair> list(Name name) throws NamingException { 89 return new NamingEnumerationStub(); 90 } 91 92 @Override 93 public NamingEnumeration<NameClassPair> list(String name) throws NamingException { 94 return new NamingEnumerationStub(); 95 } 96 97 @Override 98 public NamingEnumeration<Binding> listBindings(Name name) throws NamingException { 99 return new NamingEnumerationStub(); 100 } 101 102 @Override 103 public NamingEnumeration<Binding> listBindings(String name) throws NamingException { 104 return new NamingEnumerationStub(); 105 } 106 107 @Override 108 public void destroySubcontext(Name name) throws NamingException { 109 110 } 111 112 @Override 113 public void destroySubcontext(String name) throws NamingException { 114 115 } 116 117 @Override 118 public Context createSubcontext(Name name) throws NamingException { 119 return null; 120 } 121 122 @Override 123 public Context createSubcontext(String name) throws NamingException { 124 return null; 125 } 126 127 @Override 128 public Object lookupLink(Name name) throws NamingException { 129 return null; 130 } 131 132 @Override 133 public Object lookupLink(String name) throws NamingException { 134 return null; 135 } 136 137 @Override 138 public NameParser getNameParser(Name name) throws NamingException { 139 return new NameParserStub(); 140 } 141 142 @Override 143 public NameParser getNameParser(String name) throws NamingException { 144 return new NameParserStub(); 145 } 146 147 @Override 148 public Name composeName(Name name, Name prefix) throws NamingException { 149 return null; 150 } 151 152 @Override 153 public String composeName(String name, String prefix) throws NamingException { 154 return null; 155 } 156 157 @Override 158 public Object addToEnvironment(String propName, Object propVal) throws NamingException { 159 return null; 160 } 161 162 @Override 163 public Object removeFromEnvironment(String propName) throws NamingException { 164 return null; 165 } 166 167 @Override 168 public Hashtable<?, ?> getEnvironment() throws NamingException { 169 return new Hashtable(); 170 } 171 172 @Override 173 public void close() throws NamingException { 174 175 } 176 177 @Override 178 public String getNameInNamespace() throws NamingException { 179 return null; 180 } 181 182 class NamingEnumerationStub implements NamingEnumeration { 183 184 @Override 185 public Object next() throws NamingException { 186 return null; 187 } 188 189 @Override 190 public boolean hasMore() throws NamingException { 191 return false; 192 } 193 194 @Override 195 public void close() throws NamingException { 196 197 } 198 199 @Override 200 public boolean hasMoreElements() { 201 return false; 202 } 203 204 @Override 205 public Object nextElement() { 206 return null; 207 } 208 209 } 210 211 class NameParserStub implements NameParser { 212 213 @Override 214 public Name parse(String name) throws NamingException { 215 return null; 216 } 217 218 } 219 220} 221