001    /**
002     *  Licensed to the Apache Software Foundation (ASF) under one or more
003     *  contributor license agreements.  See the NOTICE file distributed with
004     *  this work for additional information regarding copyright ownership.
005     *  The ASF licenses this file to You under the Apache License, Version 2.0
006     *  (the "License"); you may not use this file except in compliance with
007     *  the License.  You may obtain a copy of the License at
008     *
009     *     http://www.apache.org/licenses/LICENSE-2.0
010     *
011     *  Unless required by applicable law or agreed to in writing, software
012     *  distributed under the License is distributed on an "AS IS" BASIS,
013     *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014     *  See the License for the specific language governing permissions and
015     *  limitations under the License.
016     */
017    
018    package org.apache.geronimo.j2ee.deployment;
019    
020    import java.util.Map;
021    import java.util.List;
022    import java.util.HashMap;
023    
024    import org.apache.geronimo.common.DeploymentException;
025    import org.apache.geronimo.kernel.config.Configuration;
026    import org.apache.geronimo.kernel.repository.Environment;
027    import org.apache.geronimo.deployment.AbstractNamespaceBuilder;
028    import org.apache.geronimo.j2ee.annotation.Injection;
029    import org.apache.geronimo.j2ee.annotation.Holder;
030    import org.apache.geronimo.gbean.AbstractName;
031    import org.apache.xmlbeans.QNameSet;
032    import org.apache.xmlbeans.XmlObject;
033    
034    /**
035     * @version $Rev: 535381 $ $Date: 2007-05-04 17:04:18 -0400 (Fri, 04 May 2007) $
036     */
037    public interface NamingBuilder extends AbstractNamespaceBuilder {
038    
039        XmlObject[] NO_REFS = new XmlObject[] {};
040        String ENV = "env/";
041    
042        Key<Map<String, Object>> JNDI_KEY = new Key<Map<String, Object>>() {
043    
044            public Map<String, Object> get(Map context) {
045                Map<String, Object> result = (Map<String, Object>) context.get(this);
046                if (result == null) {
047                    result = new HashMap<String, Object>();
048                    context.put(this, result);
049                }
050                return result;
051            }
052        };
053        Key<Holder> INJECTION_KEY = new Key<Holder>() {
054    
055            public Holder get(Map context) {
056                Holder result = (Holder) context.get(this);
057                if (result == null) {
058                    result = new Holder();
059                    context.put(this, result);
060                }
061                return result;
062            }
063        };
064        Key<AbstractName> GBEAN_NAME_KEY = new Key<AbstractName>() {
065    
066            public AbstractName get(Map context) {
067                return (AbstractName) context.get(this);
068            }
069        };
070    
071        void buildEnvironment(XmlObject specDD, XmlObject plan, Environment environment) throws DeploymentException;
072    
073        void initContext(XmlObject specDD, XmlObject plan, Module module) throws DeploymentException;
074        
075        void buildNaming(XmlObject specDD, XmlObject plan, Module module, Map componentContext) throws DeploymentException;
076    
077        public interface Key<T> {
078            T get(Map context);
079        }
080    
081    
082    
083    }