javapns.communication
Class AppleServerBasicImpl

java.lang.Object
  extended by javapns.communication.AppleServerBasicImpl
All Implemented Interfaces:
AppleServer
Direct Known Subclasses:
AppleFeedbackServerBasicImpl, AppleNotificationServerBasicImpl

public abstract class AppleServerBasicImpl
extends Object
implements AppleServer

A basic and abstract implementation of the AppleServer interface intended to facilitate rapid deployment.

Author:
Sylvain Pedneault

Constructor Summary
AppleServerBasicImpl(Object keystore, String password, String type)
          Constructs a AppleServerBasicImpl object.
 
Method Summary
 String getKeystorePassword()
          Returns the keystore's password.
 InputStream getKeystoreStream()
          Returns a stream to a keystore.
 String getKeystoreType()
          Returns the format used to produce the keystore (typically PKCS12).
 String getProxyAuthorization()
          Get the proxy authorization (if any) currently configured for this specific server.
 String getProxyHost()
          Get the proxy host address currently configured for this specific server.
 int getProxyPort()
          Get the proxy port currently configured for this specific server.
 void setProxy(String proxyHost, int proxyPort)
          Configure a proxy to use for this specific server.
 void setProxyAuthorization(String proxyAuthorization)
          Configure the proxy authorization to use for this specific server.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AppleServerBasicImpl

public AppleServerBasicImpl(Object keystore,
                            String password,
                            String type)
                     throws KeystoreException
Constructs a AppleServerBasicImpl object.

Parameters:
keystore - The keystore to use (can be a File, an InputStream, a String for a file path, or a byte[] array)
password - The keystore's password
type - The keystore type (typically PKCS12)
Throws:
KeystoreException - thrown if an error occurs when loading the keystore
Method Detail

getKeystoreStream

public InputStream getKeystoreStream()
                              throws InvalidKeystoreReferenceException
Description copied from interface: AppleServer
Returns a stream to a keystore.

Specified by:
getKeystoreStream in interface AppleServer
Returns:
an InputStream
Throws:
InvalidKeystoreReferenceException

getKeystorePassword

public String getKeystorePassword()
Description copied from interface: AppleServer
Returns the keystore's password.

Specified by:
getKeystorePassword in interface AppleServer
Returns:
a password matching the keystore

getKeystoreType

public String getKeystoreType()
Description copied from interface: AppleServer
Returns the format used to produce the keystore (typically PKCS12).

Specified by:
getKeystoreType in interface AppleServer
Returns:
a valid keystore format identifier

getProxyHost

public String getProxyHost()
Description copied from interface: AppleServer
Get the proxy host address currently configured for this specific server. A proxy might still be configured at the library or JVM levels. Refer to ProxyManager for more information.

Specified by:
getProxyHost in interface AppleServer
Returns:
a proxy host, or null if none is configured

getProxyPort

public int getProxyPort()
Description copied from interface: AppleServer
Get the proxy port currently configured for this specific server. A proxy might still be configured at the library or JVM levels. Refer to ProxyManager for more information.

Specified by:
getProxyPort in interface AppleServer
Returns:
a network port, or 0 if no proxy is configured

setProxy

public void setProxy(String proxyHost,
                     int proxyPort)
Description copied from interface: AppleServer
Configure a proxy to use for this specific server. Use ProxyManager to configure a proxy for the entire library instead.

Specified by:
setProxy in interface AppleServer
Parameters:
proxyHost - proxy host address
proxyPort - proxy host port

setProxyAuthorization

public void setProxyAuthorization(String proxyAuthorization)
Description copied from interface: AppleServer
Configure the proxy authorization to use for this specific server. Use ProxyManager to configure a proxy for the entire library instead.

Specified by:
setProxyAuthorization in interface AppleServer
Parameters:
proxyAuthorization - encoded proxy authorization

getProxyAuthorization

public String getProxyAuthorization()
Description copied from interface: AppleServer
Get the proxy authorization (if any) currently configured for this specific server. A proxy might still be configured at the library or JVM levels. Refer to ProxyManager for more information.

Specified by:
getProxyAuthorization in interface AppleServer
Returns:
a proxy authorization, or null if none is configured