You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@devicemap.apache.org by Reza <re...@yahoo.com.INVALID> on 2014/07/29 00:29:04 UTC

DeviceMap Java examples

So I finished the servlet and Spring example. They actually turned out different in the fact that the servlet example is as minimal as possible and the Spring example is normal.

So the servlet example is 40kb packaged, only has the java client dependency, loads the data over URL, and uses the DeviceMapFactory to initialize the client (singleton):

http://svn.apache.org/viewvc/incubator/devicemap/trunk/examples/servlet/


Spring example has several dependencies, puts the client into a bean, logging, mvc pattern, etc:

http://svn.apache.org/viewvc/incubator/devicemap/trunk/examples/spring/


They are deployed on the vm:

http://devicemap-vm.apache.org/dmap-servlet/

http://devicemap-vm.apache.org/dmap-spring/


So my next steps are going to be to start writing some documentation and javadoc.

Re: DeviceMap Java examples

Posted by Werner Keil <we...@gmail.com>.
>So generally I mark tasks as resolved. So you should be able to re-open
the task if its not done.

I could, but the "create examples" one was very generic, since there are a
few different examples now, it can't hurt to have individual tasks for them
where something should be done.

>So im just going to change getInstance() to getClient()... sound good? So
I was going to name the factory DeviceMapClientFactory, but it seemed kind
of long winded, so I trimmed it to >DeviceMapFactory. Regardless, im open
to changes on this, better to get it right the first time :)

Sounds good.

 Werner

On Tue, Jul 29, 2014 at 4:42 PM, Reza <re...@yahoo.com.invalid>
wrote:

> >> Since the old "umbrella" task was closed
>
> So generally I mark tasks as resolved. So you should be able to re-open
> the task if its not done.
>
> >> A more practical usage for this factory
>
> So im just going to change getInstance() to getClient()... sound good? So
> I was going to name the factory DeviceMapClientFactory, but it seemed kind
> of long winded, so I trimmed it to DeviceMapFactory. Regardless, im open to
> changes on this, better to get it right the first time :)
>
>
> ________________________________
>  From: Werner Keil <we...@gmail.com>
> To: "devicemap-dev@incubator.apache.org" <
> devicemap-dev@incubator.apache.org>; Reza <re...@yahoo.com>
> Sent: Monday, July 28, 2014 7:03 PM
> Subject: Re: DeviceMap Java examples
>
>
> I added a bit more logic to the console example, so you may also pass a
> "ua" similar to the forms in the web-based examples.
> Please see the newly assigned ticket, as DeviceMapFactory mixes up the
> singleton pattern which in all known cases returnns an instance of ITSELF
> via getInstance(), of(), etc. not a different object. So a minimal fix
> would be calling the static methods getClient() instead of getInstance().
>
> A more practical usage for this factory would of course be to have actual
> (non-static) methods, like getClient(), then one might inject it via
> Spring, CDI, etc. which won't work with the static approach.
>
> The console example is relatively self-descriptive, it can be just called
> via Maven, using the default unless you passed an argument to the Maven
> call (that's probably a further room for improvement) Since the old
> "umbrella" task was closed, there's an Examples epic to hold various bugs
> or tasks for these examples together.
>
> Cheers,
> Werner
>
>
> On Tue, Jul 29, 2014 at 12:29 AM, Reza <re...@yahoo.com.invalid>
> wrote:
>
> > So I finished the servlet and Spring example. They actually turned out
> > different in the fact that the servlet example is as minimal as possible
> > and the Spring example is normal.
> >
> > So the servlet example is 40kb packaged, only has the java client
> > dependency, loads the data over URL, and uses the DeviceMapFactory to
> > initialize the client (singleton):
> >
> > http://svn.apache.org/viewvc/incubator/devicemap/trunk/examples/servlet/
> >
> >
> > Spring example has several dependencies, puts the client into a bean,
> > logging, mvc pattern, etc:
> >
> > http://svn.apache.org/viewvc/incubator/devicemap/trunk/examples/spring/
> >
> >
> > They are deployed on the vm:
> >
> > http://devicemap-vm.apache.org/dmap-servlet/
> >
> > http://devicemap-vm.apache.org/dmap-spring/
> >
> >
> > So my next steps are going to be to start writing some documentation and
> > javadoc.
> >
>

Re: DeviceMap Java examples

Posted by Reza <re...@yahoo.com.INVALID>.
>> Since the old "umbrella" task was closed

So generally I mark tasks as resolved. So you should be able to re-open the task if its not done.

>> A more practical usage for this factory 

So im just going to change getInstance() to getClient()... sound good? So I was going to name the factory DeviceMapClientFactory, but it seemed kind of long winded, so I trimmed it to DeviceMapFactory. Regardless, im open to changes on this, better to get it right the first time :)


________________________________
 From: Werner Keil <we...@gmail.com>
To: "devicemap-dev@incubator.apache.org" <de...@incubator.apache.org>; Reza <re...@yahoo.com> 
Sent: Monday, July 28, 2014 7:03 PM
Subject: Re: DeviceMap Java examples
 

I added a bit more logic to the console example, so you may also pass a
"ua" similar to the forms in the web-based examples.
Please see the newly assigned ticket, as DeviceMapFactory mixes up the
singleton pattern which in all known cases returnns an instance of ITSELF
via getInstance(), of(), etc. not a different object. So a minimal fix
would be calling the static methods getClient() instead of getInstance().

A more practical usage for this factory would of course be to have actual
(non-static) methods, like getClient(), then one might inject it via
Spring, CDI, etc. which won't work with the static approach.

The console example is relatively self-descriptive, it can be just called
via Maven, using the default unless you passed an argument to the Maven
call (that's probably a further room for improvement) Since the old
"umbrella" task was closed, there's an Examples epic to hold various bugs
or tasks for these examples together.

Cheers,
Werner


On Tue, Jul 29, 2014 at 12:29 AM, Reza <re...@yahoo.com.invalid>
wrote:

> So I finished the servlet and Spring example. They actually turned out
> different in the fact that the servlet example is as minimal as possible
> and the Spring example is normal.
>
> So the servlet example is 40kb packaged, only has the java client
> dependency, loads the data over URL, and uses the DeviceMapFactory to
> initialize the client (singleton):
>
> http://svn.apache.org/viewvc/incubator/devicemap/trunk/examples/servlet/
>
>
> Spring example has several dependencies, puts the client into a bean,
> logging, mvc pattern, etc:
>
> http://svn.apache.org/viewvc/incubator/devicemap/trunk/examples/spring/
>
>
> They are deployed on the vm:
>
> http://devicemap-vm.apache.org/dmap-servlet/
>
> http://devicemap-vm.apache.org/dmap-spring/
>
>
> So my next steps are going to be to start writing some documentation and
> javadoc.
>

Re: DeviceMap Java examples

Posted by Werner Keil <we...@gmail.com>.
I added a bit more logic to the console example, so you may also pass a
"ua" similar to the forms in the web-based examples.
Please see the newly assigned ticket, as DeviceMapFactory mixes up the
singleton pattern which in all known cases returnns an instance of ITSELF
via getInstance(), of(), etc. not a different object. So a minimal fix
would be calling the static methods getClient() instead of getInstance().

A more practical usage for this factory would of course be to have actual
(non-static) methods, like getClient(), then one might inject it via
Spring, CDI, etc. which won't work with the static approach.

The console example is relatively self-descriptive, it can be just called
via Maven, using the default unless you passed an argument to the Maven
call (that's probably a further room for improvement) Since the old
"umbrella" task was closed, there's an Examples epic to hold various bugs
or tasks for these examples together.

Cheers,
Werner

On Tue, Jul 29, 2014 at 12:29 AM, Reza <re...@yahoo.com.invalid>
wrote:

> So I finished the servlet and Spring example. They actually turned out
> different in the fact that the servlet example is as minimal as possible
> and the Spring example is normal.
>
> So the servlet example is 40kb packaged, only has the java client
> dependency, loads the data over URL, and uses the DeviceMapFactory to
> initialize the client (singleton):
>
> http://svn.apache.org/viewvc/incubator/devicemap/trunk/examples/servlet/
>
>
> Spring example has several dependencies, puts the client into a bean,
> logging, mvc pattern, etc:
>
> http://svn.apache.org/viewvc/incubator/devicemap/trunk/examples/spring/
>
>
> They are deployed on the vm:
>
> http://devicemap-vm.apache.org/dmap-servlet/
>
> http://devicemap-vm.apache.org/dmap-spring/
>
>
> So my next steps are going to be to start writing some documentation and
> javadoc.
>