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.associate.common; 018 019import com.echothree.control.user.associate.server.AssociateLocal; 020import com.echothree.util.common.control.InitialContextUtils; 021import javax.naming.NamingException; 022 023public class AssociateUtil { 024 025 private static AssociateLocal cachedLocal = null; 026 private static AssociateRemote cachedRemote = null; 027 028 @SuppressWarnings("BanJNDI") 029 public static AssociateLocal getLocalHome() 030 throws NamingException { 031 if(cachedLocal == null) { 032 var ctx = InitialContextUtils.getInstance().getInitialContext(); 033 034 cachedLocal = (AssociateLocal)ctx.lookup("ejb:echothree/echothree-server/AssociateBean!com.echothree.control.user.associate.server.AssociateLocal"); 035 } 036 037 return cachedLocal; 038 } 039 040 @SuppressWarnings("BanJNDI") 041 public static AssociateRemote getHome() 042 throws NamingException { 043 if(cachedRemote == null) { 044 var ctx = InitialContextUtils.getInstance().getInitialContext(); 045 046 cachedRemote = (AssociateRemote)ctx.lookup("ejb:echothree/echothree-server/AssociateBean!com.echothree.control.user.associate.common.AssociateRemote"); 047 } 048 049 return cachedRemote; 050 } 051 052}