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