My web server - // Call the method on the remote interface

// Call the method on the remote interface return storefrontMethod.invoke( storefront, args ); } else { throw new NoSuchMethodException(”The Storefront doesnot implement ” + method.getName( )); } } } catch( InvocationTargetException ex ) { if (ex.getTargetException( ) instanceof RemoteException) { // RemoteException isn’t declared by the IStorefrontmethod that was // called, so we have to catch it and throw somethingthat is throw DatastoreException.datastoreError(ex.getTargetException( )); } else { throw ex.getTargetException( ); } } } } The intent behind DynamicStorefrontEJBDelegate is for a dynamic proxy that is created as an implementation of the IStorefrontService interface to delegate all those calls to the invoke( )method declared here. Notice that this delegate class is not declared to implement IStorefrontService. In fact, the only business methods from IStorefrontService that appear in this class are the logout( )and destroy( )methods that aren’t implemented by our session bean. To use the dynamic proxy-based delegate, we need to modify our approach for obtaining an implementation of the service interface from the factory. Rather than devising something elegant for a small part of this example, we’ll just hardcode the new approach we need. This is shown in the following version of the createService( ) method of StorefrontServiceFactory: public IStorefrontService createService( ){ Class[] serviceInterface = new Class[] { IStorefrontService.class }; IStorefrontService proxy = (IStorefrontService)Proxy.newProxyInstance( Thread.currentThread().getContextClassLoader( ), serviceInterface, new DynamicStorefrontEJBDelegate( ) ); return proxy; }
Note: If you are looking for cheap and reliable webhost to host and run your mysql application check mysql web server services.

Leave a Reply