author | Jaroslav Tulach <jtulach@netbeans.org> |
Sat, 15 Nov 2008 13:12:46 +0100 | |
changeset 300 | b704be5f8463 |
permissions | -rw-r--r-- |
jtulach@294 | 1 |
package org.apidesign.aserverinfo.builder; |
jtulach@294 | 2 |
|
jtulach@294 | 3 |
import org.apidesign.aserverinfo.spi.NameProvider; |
jtulach@294 | 4 |
import org.apidesign.aserverinfo.spi.ResetHandler; |
jtulach@294 | 5 |
import org.apidesign.aserverinfo.spi.URLProvider; |
jtulach@294 | 6 |
import java.net.URL; |
jtulach@294 | 7 |
import org.apidesign.aserverinfo.spi.ShutdownHandler; |
jtulach@294 | 8 |
|
jtulach@294 | 9 |
// BEGIN: aserverinfo.builder.api |
jtulach@294 | 10 |
public final class ServerConnector { |
jtulach@294 | 11 |
public String getName() { |
jtulach@294 | 12 |
return name == null ? "noname" : name.getName(); |
jtulach@294 | 13 |
} |
jtulach@294 | 14 |
|
jtulach@294 | 15 |
public URL getURL() { |
jtulach@294 | 16 |
return url == null ? null : url.getURL(); |
jtulach@294 | 17 |
} |
jtulach@294 | 18 |
|
jtulach@294 | 19 |
public void reset() { |
jtulach@294 | 20 |
if (reset != null) { |
jtulach@294 | 21 |
reset.reset(); |
jtulach@294 | 22 |
} |
jtulach@294 | 23 |
} |
jtulach@294 | 24 |
|
jtulach@294 | 25 |
/** Additional method for API clients not available from first version. |
jtulach@294 | 26 |
* @since 2.0 |
jtulach@294 | 27 |
*/ |
jtulach@294 | 28 |
public void shutdown() { |
jtulach@294 | 29 |
if (shutdown != null) { |
jtulach@294 | 30 |
shutdown.shutdown(); |
jtulach@294 | 31 |
} |
jtulach@294 | 32 |
} |
jtulach@294 | 33 |
// FINISH: aserverinfo.builder.api |
jtulach@294 | 34 |
|
jtulach@294 | 35 |
// |
jtulach@294 | 36 |
// private part |
jtulach@294 | 37 |
// |
jtulach@294 | 38 |
|
jtulach@294 | 39 |
private final NameProvider name; |
jtulach@294 | 40 |
private final URLProvider url; |
jtulach@294 | 41 |
private final ResetHandler reset; |
jtulach@294 | 42 |
private final ShutdownHandler shutdown; |
jtulach@294 | 43 |
|
jtulach@294 | 44 |
ServerConnector( |
jtulach@294 | 45 |
NameProvider name, URLProvider url, |
jtulach@294 | 46 |
ResetHandler reset, ShutdownHandler shutdown |
jtulach@294 | 47 |
) { |
jtulach@294 | 48 |
this.name = name; |
jtulach@294 | 49 |
this.url = url; |
jtulach@294 | 50 |
this.reset = reset; |
jtulach@294 | 51 |
this.shutdown = shutdown; |
jtulach@294 | 52 |
} |
jtulach@294 | 53 |
} |