001// -------------------------------------------------------------------------------- 002// Copyright 2002-2025 Echo Three, LLC 003// 004// Licensed under the Apache License, Version 2.0 (the "License"); 005// you may not use this file except in compliance with the License. 006// You may obtain a copy of the License at 007// 008// http://www.apache.org/licenses/LICENSE-2.0 009// 010// Unless required by applicable law or agreed to in writing, software 011// distributed under the License is distributed on an "AS IS" BASIS, 012// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013// See the License for the specific language governing permissions and 014// limitations under the License. 015// -------------------------------------------------------------------------------- 016 017package com.echothree.control.user.invoice.common; 018 019import com.echothree.control.user.invoice.server.InvoiceLocal; 020import com.echothree.util.common.control.InitialContextUtils; 021import javax.naming.NamingException; 022 023public class InvoiceUtil { 024 025 private static InvoiceLocal cachedLocal = null; 026 private static InvoiceRemote cachedRemote = null; 027 028 @SuppressWarnings("BanJNDI") 029 public static InvoiceLocal getLocalHome() 030 throws NamingException { 031 if(cachedLocal == null) { 032 var ctx = InitialContextUtils.getInstance().getInitialContext(); 033 034 cachedLocal = (InvoiceLocal)ctx.lookup("ejb:echothree/echothree-server/InvoiceBean!com.echothree.control.user.invoice.server.InvoiceLocal"); 035 } 036 037 return cachedLocal; 038 } 039 040 @SuppressWarnings("BanJNDI") 041 public static InvoiceRemote getHome() 042 throws NamingException { 043 if(cachedRemote == null) { 044 var ctx = InitialContextUtils.getInstance().getInitialContext(); 045 046 cachedRemote = (InvoiceRemote)ctx.lookup("ejb:echothree/echothree-server/InvoiceBean!com.echothree.control.user.invoice.common.InvoiceRemote"); 047 } 048 049 return cachedRemote; 050 } 051 052}