In a later refatoring we can then "templatize" it to:
public Class<T> getBeanByClassReference(Class<T> beanClass) {
try {
if (ScopeApplicationAdapter.initComplete) {
return WebApplicationContextUtils
.getWebApplicationContext(getServletContext())
.getBean(beanClass);
}
} catch (Exception err) {
log.error("[getBeanByClassReference]", err);
}
return null
}
ANd write in the code:
getBeanByClassReference(SessiondataDao.class).doWhatever();
But for the moment I am fine with just doing the first iteration of the
refactoring to get rid of the hardcoded strings in our code.
Sebastian
2013/2/15 [email protected] <[email protected]>
> That is true.
> I would like to do one more refactoring :)
>
> I would like to fix all Servlets that load a Bean by a String to load it
> by the class reference.
>
> Example, replace:
> ApplicationContext context = WebApplicationContextUtils
> .getWebApplicationContext(getServletContext());
> return (SessiondataDao) context.getBean("sessionManagement");
>
>
> With:
> return WebApplicationContextUtils
> .getWebApplicationContext(getServletContext())
> .getBean(SessiondataDao.class);
>
> The big advantage is that there is no "bean-name-bundling", so you can
> rename the Beans name in the application context and refactor the code,
> Eclipse will take care about references.
> Currently you would need to do a File based search+replace and fix every
> file manually if you rename the Spring bean.
>
> Is that okay if I commit that change to trunk?
>
> Sebastian
>
>
>
> 2013/2/15 Maxim Solodovnik <[email protected]>
>
>> I would like to remind about "feature freeze" period we currently have ...
>> To prepare release we should stop adding new features and perform heavy
>> refactorings
>> On Feb 15, 2013 7:06 AM, "[email protected]" <[email protected]>
>> wrote:
>>
>> > Hi Vieri,
>> >
>> > sorry but I can't apply that patch 1:1. If you add a new property to the
>> > admin shell installer, the same option should be available to the
>> > web-installer (through the Install-Servlet). That is the same for all
>> > options during installation. The admin installer from command line is
>> only
>> > an alternative to the Web installer. The only exception for that is the
>> > backup (as you can install that way without duplicating the user_id 1
>> that
>> > you would need if you install via web-installer + goto Admin > Backup
>> and
>> > run the backup import).
>> >
>> > If you create a patch, please right click in Eclipse on the top project
>> and
>> > make a patch with the project root as reference. Not for each file (some
>> > subversion plugin will even include binary this way).
>> >
>> > If added a WebService call in the UserWebService:
>> > http://openmeetings.apache.org/UserService.html#addOrganisation
>> >
>> > Sebastian
>> >
>> >
>> > 2013/2/15 [email protected] <[email protected]>
>> >
>> > > Is it a SQL? Cause that will not work. You would need to restart red5
>> > > after each query (and shut down before the query is executed)
>> > >
>> > > Sebastian
>> > > Am 15.02.2013 09:51 schrieb "Vieri" <[email protected]>:
>> > >
>> > > Re-attaching the patch as it didn't seem to go through...
>> > >>
>> > >> --- On Thu, 2/14/13, Vieri <[email protected]> wrote:
>> > >>
>> > >> > Hi,
>> > >> >
>> > >> > Attaching a quick patch so an admin can create additional
>> > >> > user groups from the command line.
>> > >> > Just a thought but maybe the admins could find this useful.
>> > >> >
>> > >> > Best option would be to do it via SOAP calls though...
>> > >> >
>> > >> > Vieri
>> > >> >
>> > >> > --- On Thu, 2/14/13, Vieri <[email protected]>
>> > >> > wrote:
>> > >> >
>> > >> > > Other than using the web UI of
>> > >> > > course...
>> > >> > >
>> > >> > > --- On Thu, 2/14/13, Vieri <[email protected]>
>> > >> > > wrote:
>> > >> > >
>> > >> > > > Hi,
>> > >> > > >
>> > >> > > > What is the correct way to create a new
>> > >> > > organization/user
>> > >> > > > group?
>> > >> > > >
>> > >> > > > Should I simply insert it directly in the
>> > >> > database
>> > >> > > (table
>> > >> > > > 'organisation') or is there a specific SOAP call
>> > >> > for
>> > >> > > this?
>> > >> > > >
>> > >> > > > Thanks,
>> > >> > > >
>> > >> > > > Vieri
>> > >> > > >
>> > >> > > >
>> > >> > >
>> > >
>> > >
>> >
>> >
>> > --
>> > Sebastian Wagner
>> > https://twitter.com/#!/dead_lock
>> > http://www.webbase-design.de
>> > http://www.wagner-sebastian.com
>> > [email protected]
>> >
>>
>
>
>
> --
> Sebastian Wagner
> https://twitter.com/#!/dead_lock
> http://www.webbase-design.de
> http://www.wagner-sebastian.com
> [email protected]
>
--
Sebastian Wagner
https://twitter.com/#!/dead_lock
http://www.webbase-design.de
http://www.wagner-sebastian.com
[email protected]