Lloyd Chambers wrote:
> I notice we have a DuckTyped getModules() for Applications, but not
> SystemApplications.
>
> Anyone know if we intend these two to have the same facilities?
I sure hope so.
At the moment, there is only one system application -- admin console.
-Kedar
> Lloyd
> ---------------
>
> @Configured
> public interface SystemApplications extends ConfigBeanProxy, Injectable {
>
> /**
> * Gets the value of the
> lifecycleModuleOrJ2EeApplicationOrEjbModuleOrWebModuleOrConnectorModuleOrAppclientModuleOrMbeanOrExtensionModuleorApplication property.
>
> * Objects of the following type(s) are allowed in the list
> * {_at_link LifecycleModule }
> * {_at_link J2EeApplication }
> * {_at_link EjbModule }
> * {_at_link WebModule }
> * {_at_link ConnectorModule }
> * {_at_link AppclientModule }
> * {_at_link Mbean }
> * {_at_link ExtensionModule }
> * {_at_link Application }
> */
> @Element("*")
> public List<Module> getModules();
>
> }
>
> --------------
>
> @Configured
> public interface Applications extends ConfigBeanProxy, Injectable {
>
> /**
> * Gets the value of the
> lifecycleModuleOrJ2EeApplicationOrEjbModuleOrWebModuleOrConnectorModuleOrAppclientModuleOrMbeanOrExtensionModuleorApplication property.
>
> * Objects of the following type(s) are allowed in the list
> * {_at_link LifecycleModule }
> * {_at_link J2eeApplication }
> * {_at_link EjbModule }
> * {_at_link WebModule }
> * {_at_link ConnectorModule }
> * {_at_link AppclientModule }
> * {_at_link Mbean }
> * {_at_link ExtensionModule }
> * {_at_link Application }
> */
> @Element("*")
> public List<Module> getModules();
>
> /**
> * Gets a subset of {_at_link #getModules()} that has the given type.
> */
> @DuckTyped
> <T> List<T> getModules(Class<T> type);
>
> @DuckTyped
> <T> T getModule(Class<T> type, String moduleID);
>
> public class Duck {
> public static <T> List<T> getModules(Applications apps, Class<T>
> type) {
> List<T> modules = new ArrayList<T>();
> for (Object module : apps.getModules()) {
> if (type.isInstance(module)) {
> modules.add(type.cast(module));
> }
> }
> return modules;
> }
>
> public static <T> T getModule(Applications apps, Class<T> type,
> String moduleID) {
> if (moduleID == null) {
> return null;
> }
>
> for (Module module : apps.getModules())
> if (type.isInstance(module) &&
> module.getName().equals(moduleID))
> return type.cast(module);
>
> return null;
>
> }
> }
> }
>
>
>
> ..............................................
> Lloyd Chambers
> lloyd.chambers_at_sun.com
> GlassFish team, LSARC member
>
>
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: admin-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: admin-help_at_glassfish.dev.java.net
>