[ajax-user] Apollo design question
Brought to you by:
vamp201
From: Marcel G. <gl...@ne...> - 2003-05-21 14:24:30
|
Hi, I was looking at Apollo (http://ajax.sourceforge.net/apollo/) and I found it very useful for developing purposes. My goal was to enhance the developing process of our web start application. We don't want to deploy our web app after changing one row of our code. Apollon does exactly that what we were looking for. Except this point: We don't want to use Apollo in our deployed system. The package shall not be deployed with the rest of our application. In my development environment I want to use the Apollo-JNLP-Services but in my Runtime-Env I want to use the JNLP services by SUN. I started to program a workaround that looks as follows: public class WebStartHelper { private static Logger logger = Logger.getLogger(WebStartHelper.class); public static Object lookup(String s) throws UnavailableServiceException { try { Class apolloServiceManager = Class.forName("apollo.ServiceManager"); String methodName = null; if (s.equals(FileOpenService.class.getName())) { methodName = "lookupFileOpenService"; } // add additional code here... if (methodName != null) { Method method = apolloServiceManager.getMethod(methodName, null); Object result = method.invoke(null, null); logger.debug("apollo.ServiceManager successfully used"); return result; } else { logger.debug("no method found"); } } catch (ClassNotFoundException e) { } catch (SecurityException e) { } catch (NoSuchMethodException e) { } catch (IllegalArgumentException e) { } catch (InvocationTargetException e) { } catch (IllegalAccessException e) { } logger.debug("using " + ServiceManager.class.getName()); return ServiceManager.lookup(s); } } Using WebStartHelper: // ... import javax.jnlp.FileOpenService; // ... // *** this throws a ClassCastException! FileOpenService fos = WebStartHelper.lookup(FileOpenService.class.getName()); The BIG PROBLEM is, that apollo.FileOpenService is NOT the same as or extending the interface javax.jnlp.FileOpenService. So my class WebStartHelper fails at the line marked with ***. My question is: - Why did you implement your own interfaces that are a copy of the jnlp-Interfaces? - Why did you remove the Method "Object lookup(String s)" from your version of the ServiceManger? - Is it possible to change the existing apollo classes so that my workaround throws no ClassCastException? And one last question in German: Kann man auch auf deutsch in dieser Mailingliste schreiben? Ich brech mir nämlich mit meinem schlechten Englisch ganz schön einen ab und besonders besucht scheint die ML eh nicht zu sein ;-)??? -- Best regards, Marcel Gleis Netz-Profis GbR Tel: 0231/3988072 Emil-Figge-Str. 80 44227 Dortmund Web: http://www.netz-profis.de |