ttomcat-1778514358873.zip-extract/apache-tomcat-11.0.18-src/java/org/apache/naming/factory/OpenEjbFactory.java

Path
ttomcat-1778514358873.zip-extract/apache-tomcat-11.0.18-src/java/org/apache/naming/factory/OpenEjbFactory.java
Status
scanned
Type
file
Name
OpenEjbFactory.java
Extension
.java
Programming language
Java
Mime type
text/plain
File type
ASCII text, with CRLF line terminators
Tag

      
    
Rootfs path

      
    
Size
2655 (2.6 KB)
MD5
8b959faa82a42a9b23b0d9a1f86a7d46
SHA1
05426d2bff5558c09b3ae6e75d738a976dcf78fc
SHA256
0124b1d56a44a6cf39d884469cab426629a665c70dec1bdb1e1da64bd058ef4e
SHA512

      
    
SHA1_git
e79cf4c105eaa9636a1ca4f1acce99a0d65249b9
Is binary

      
    
Is text
True
Is archive

      
    
Is media

      
    
Is legal

      
    
Is manifest

      
    
Is readme

      
    
Is top level

      
    
Is key file

      
    
OpenEjbFactory.java | 2.6 KB |

/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.naming.factory; import java.util.Hashtable; import java.util.Properties; import javax.naming.Context; import javax.naming.InitialContext; import javax.naming.Name; import javax.naming.RefAddr; import javax.naming.spi.ObjectFactory; import org.apache.naming.EjbRef; /** * Object factory for EJBs. */ public class OpenEjbFactory implements ObjectFactory { protected static final String DEFAULT_OPENEJB_FACTORY = "org.openejb.client.LocalInitialContextFactory"; /** * Create a new EJB instance using OpenEJB. * * @param obj The reference object describing the DataSource * @param name the bound name * @param nameCtx unused * @param environment unused * * @return the object instance * * @throws Exception if an error occur creating the instance */ @Override public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable<?,?> environment) throws Exception { Object beanObj = null; if (obj instanceof EjbRef ref) { String factory = DEFAULT_OPENEJB_FACTORY; RefAddr factoryRefAddr = ref.get("openejb.factory"); if (factoryRefAddr != null) { // Retrieving the OpenEJB factory factory = factoryRefAddr.getContent().toString(); } Properties env = new Properties(); env.put(Context.INITIAL_CONTEXT_FACTORY, factory); RefAddr linkRefAddr = ref.get("openejb.link"); if (linkRefAddr != null) { String ejbLink = linkRefAddr.getContent().toString(); beanObj = (new InitialContext(env)).lookup(ejbLink); } } return beanObj; } }
Detected license expression
apache-2.0
Detected license expression (SPDX)
Apache-2.0
Percentage of license text
40.75
Copyrights

      
    
Holders

      
    
Authors

      
    
License detections License expression License expression SPDX
apache_2_0-4bde3f57-78aa-4201-96bf-531cba09e7de apache-2.0 Apache-2.0
URL Start line End line
http://www.apache.org/licenses/LICENSE-2.0 9 9