Thread: [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 |
|
From: Marcel G. <gl...@ne...> - 2003-05-26 08:21:13
|
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 |
|
From: Gerald B. <ge...@va...> - 2003-05-21 15:34:33
|
Servus Marcel, > 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. Thanks for your kind words. > 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? Well, as far as I remember if you use Apollo you don't need to get the Web Start dev pack and set up your classpath to include the javax.jnlp package because Apollo includes duplicate interfaces in its own package hierachy. > - Why did you remove the Method "Object > lookup(String s)" from your > version of the ServiceManger? To promote type-safe simpler methods such as BasicService lookupBasicService() instead of Object lookup( "javax.jnlp.BasicService" ). > - Is it possible to change the existing apollo > classes so that my > workaround throws no ClassCastException? Sure. Adding a generic lookup method isn't a big deal. I'm not sure how to handle the javax.jnlp interfaces issue. You're more than welcome to try out some solutions. That's why the code is GPL'ed so that you can change it to fit your own needs. You might also want to create a somewhat more lightweight toolkit with no extras by just duplicating all interfaces 1:1 using the Apollo codebase as a start. > And one last question in German: > Kann man auch auf deutsch in dieser Mailingliste > schreiben? Ich brech > mir n鄝lich mit meinem schlechten Englisch ganz > sch霵 einen ab und > besonders besucht scheint die ML eh nicht zu sein > ;-)??? I hope you don't mind if I answer in English: You're more than welcome to send questions in German. However, please give me a couple of days so I can setup a new mailing list for discussions in German such as ajax-user-deutsch. Please, check the project site @ http://sourceforge.net/mail/?group_id=68538 to see if the German mailing list is up and running. - Gerald |
|
From: Gerald B. <ge...@va...> - 2003-05-22 02:48:47
|
Servus Marcel, > You're more than welcome to send questions in > German. However, please give me a couple of days so > I can setup a new mailing list for discussions in > German such as ajax-user-deutsch. Please, check the > project site @ http://sourceforge.net/mail/?group_id=68538 > to see if the German mailing list is up and running. As an add-on the new ajax-deutsch mailing list for discussion in German about all Ajax projects such as Apollo, Caramel, Salsa and so on is now online. Please, see http://lists.sourceforge.net/lists/listinfo/ajax-deutsch for details and be the first to post. I have already subscribed. - Gerald |