On May 18, 2009, at 6:12 PM, Jerome Dochez wrote:
>>>> Looked at the new APIs and couple of questions ...
>>>>
>>>> 1). I think creating a Server from ServerInfo is not intuitive.
>>>> Do you know of any precedents ?
>
> not sure what you mean here... Server server = serverInfo.create();
> is the API, is this the non intuitive part ?
>
Intuitively I would have expected the Server building functionality to
be part of the Server itself. I suppose the name "Info" does not
really click with the concept of creation, perhaps Builder or Factory ?
Maybe it would make sense for the ServerInfo to be an inner static
class of Server? or can Server be an abstract class ? (i am not sure
on the restrictions of the provider annotated classes).
>>>>
>>>> 2). How do I deploy the archive now ? Server.getDeployer() is not
>>>> available.
>
> yeah the API is far from complete but it should look like this :
>
> // default server configuration
> ServerInfo info = ServerInfo.getServerInfo("MyEmbeddedGF");
>
> // configure and add the web container, with port 8080
> WebContainer web =
> server.addContainer(server.createConfig(WebContainerInfo.class));
> web.setHttpPort(server.createPort("8080"));
>
> // deploy the app to any configured embedded container...
> server.getDeployer().deploy("foo.war");
>
Seems a fair bit of work for a very common case i.e. embedded Web
deployment.
How about:
WebServer s = WebServerInfo.port(8080);
s.getDeployer().("foo.war");
where WebServer extends Server.
?
Paul.