01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: *
15: * See the License for the specific language governing permissions and
16: * limitations under the License.
17: */
18:
19: /**
20: * @author Vasily Zakharov
21: * @version $Revision: 1.1.2.3 $
22: */package org.apache.harmony.jndi.provider.rmi.registry;
23:
24: import java.util.Properties;
25:
26: import javax.naming.CompoundName;
27: import javax.naming.Name;
28: import javax.naming.NameParser;
29: import javax.naming.NamingException;
30:
31: /**
32: * Parser for flat case-sensitive atomic names used by {@link RegistryContext}.
33: */
34: public class AtomicNameParser implements NameParser {
35:
36: /**
37: * Syntax, defines a flat case-sensitive context, initialized in static
38: * initialization block.
39: */
40: private static final Properties syntax = new Properties();
41:
42: /**
43: * Static initializer for {@link #syntax}.
44: */
45: static {
46: syntax.put("jndi.syntax.direction", "flat"); //$NON-NLS-1$ //$NON-NLS-2$
47: }
48:
49: /**
50: * Creates instance of this class.
51: */
52: public AtomicNameParser() {
53: }
54:
55: /**
56: * Returns flat {@link CompoundName} constructed from the specified string.
57: *
58: * @param name
59: * Name to parse, cannot be <code>null</code>.
60: *
61: * @return Flat {@link CompoundName} constructed from the specified string.
62: *
63: * @throws NamingException
64: * If some error occured.
65: */
66: public Name parse(String name) throws NamingException {
67: return new CompoundName(name, syntax);
68: }
69:
70: }
|