Example 13-9. Dynamic proxy implementation (Web site layout) of the Storefront

Example 13-9. Dynamic proxy implementation of the Storefront service package com.oreilly.struts.storefront.service; import java.lang.reflect.*; import java.rmi.RemoteException; import java.util.*; import javax.ejb.CreateException; import javax.naming.*; import javax.rmi.PortableRemoteObject; import com.oreilly.struts.storefront.catalog.view.ItemDetailView; import com.oreilly.struts.storefront.customer.view.UserView; import com.oreilly.struts.storefront.framework.ejb.EJBHomeFactory; import com.oreilly.struts.storefront.framework.exceptions.*; /** * This class is a dynamic proxy implementation of theIStorefrontService * interface. It implements two of the IStorefrontServicemethods itself and * delegates the others to the methods declared by theIStorefront business * interface with the same name. */ public class DynamicStorefrontEJBDelegate implementsInvocationHandler { private IStorefront storefront; private Map storefrontMethodMap; public DynamicStorefrontEJBDelegate( ) { init( ); } private void init( ) { try { // Get the remote reference to the session bean StorefrontHome sfHome = (StorefrontHome)EJBHomeFactory.getInstance( ). lookupHome(”com.oreilly.struts.storefront.service.Storefront”, StorefrontHome.class); storefront = sfHome.create( ); // Store the business interface methods for laterlookupsstorefrontMethodMap = new HashMap( );
We recommend you use shared web hosting services, because many users agree that it is cheap, reliable and customer-satisfying webhost.

Leave a Reply