Home » geronimo-2.2-source-release » org.apache.geronimo.corba.deployment » [javadoc | source]

    1   /**
    2    *  Licensed to the Apache Software Foundation (ASF) under one or more
    3    *  contributor license agreements.  See the NOTICE file distributed with
    4    *  this work for additional information regarding copyright ownership.
    5    *  The ASF licenses this file to You under the Apache License, Version 2.0
    6    *  (the "License"); you may not use this file except in compliance with
    7    *  the License.  You may obtain a copy of the License at
    8    *
    9    *     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    *  See the License for the specific language governing permissions and
   15    *  limitations under the License.
   16    */
   17   
   18   package org.apache.geronimo.corba.deployment;
   19   
   20   import java.util.Collection;
   21   import java.util.Map;
   22   
   23   import org.apache.xmlbeans.XmlObject;
   24   import org.apache.xmlbeans.QNameSet;
   25   import org.apache.geronimo.kernel.repository.Artifact;
   26   import org.apache.geronimo.kernel.repository.Environment;
   27   import org.apache.geronimo.j2ee.deployment.Module;
   28   import org.apache.geronimo.j2ee.deployment.CorbaGBeanNameSource;
   29   import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
   30   import org.apache.geronimo.naming.reference.ORBReference;
   31   import org.apache.geronimo.naming.reference.HandleDelegateReference;
   32   import org.apache.geronimo.naming.deployment.AbstractNamingBuilder;
   33   import org.apache.geronimo.common.DeploymentException;
   34   import org.apache.geronimo.gbean.GBeanInfo;
   35   import org.apache.geronimo.gbean.GBeanInfoBuilder;
   36   import org.apache.geronimo.gbean.AbstractNameQuery;
   37   import org.apache.geronimo.gbean.SingleElementCollection;
   38   
   39   /**
   40    * @version $Rev: 535381 $ $Date: 2007-05-04 14:04:18 -0700 (Fri, 04 May 2007) $
   41    */
   42   public class CorbaRefBuilder extends AbstractNamingBuilder {
   43   
   44       private final SingleElementCollection corbaGBeanNameSourceCollection;
   45   
   46       public CorbaRefBuilder(Environment defaultEnvironment, Collection corbaGBeanNameSource) {
   47           super(defaultEnvironment);
   48           this.corbaGBeanNameSourceCollection = new SingleElementCollection(corbaGBeanNameSource);
   49       }
   50   
   51       protected boolean willMergeEnvironment(XmlObject specDD, XmlObject plan) throws DeploymentException {
   52   //        if (OpenEjbCorbaRefBuilder.hasCssRefs(plan) || TSSLinkBuilder.hasTssLinks(plan)) {
   53               return true;
   54   //        }
   55   //        return false;
   56       }
   57   
   58       public void buildNaming(XmlObject specDD, XmlObject plan, Module module, Map componentContext) throws DeploymentException {
   59           if (matchesDefaultEnvironment(module.getEnvironment())) {
   60               CorbaGBeanNameSource corbaGBeanNameSource = (CorbaGBeanNameSource) corbaGBeanNameSourceCollection.getElement();
   61               if (corbaGBeanNameSource != null) {
   62                   AbstractNameQuery corbaName = corbaGBeanNameSource.getCorbaGBeanName();
   63                   if (corbaName != null) {
   64                       Artifact[] moduleId = module.getConfigId();
   65                       Map context = getJndiContextMap(componentContext);
   66                       context.put("ORB", new ORBReference(moduleId, corbaName));
   67                       context.put("HandleDelegate", new HandleDelegateReference(moduleId, corbaName));
   68                   }
   69               }
   70           }
   71       }
   72   
   73       public QNameSet getSpecQNameSet() {
   74           return QNameSet.EMPTY;
   75       }
   76   
   77       public QNameSet getPlanQNameSet() {
   78           return QNameSet.EMPTY;
   79       }
   80   
   81       public static final GBeanInfo GBEAN_INFO;
   82   
   83       static {
   84           GBeanInfoBuilder infoBuilder = GBeanInfoBuilder.createStatic(CorbaRefBuilder.class, NameFactory.MODULE_BUILDER);
   85           infoBuilder.addAttribute("defaultEnvironment", Environment.class, true, true);
   86           infoBuilder.addReference("CorbaGBeanNameSource", CorbaGBeanNameSource.class);
   87           infoBuilder.setConstructor(new String[]{"defaultEnvironment", "CorbaGBeanNameSource"});
   88           GBEAN_INFO = infoBuilder.getBeanInfo();
   89       }
   90   
   91       public static GBeanInfo getGBeanInfo() {
   92           return GBEAN_INFO;
   93       }
   94   
   95   }

Home » geronimo-2.2-source-release » org.apache.geronimo.corba.deployment » [javadoc | source]