Skip to content

Commit

Permalink
JavaDoc fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
rion18 committed Aug 25, 2016
1 parent a73e935 commit ff82560
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ public class AsyncAndroidPushService extends AsyncPushServiceBase {
private static final String BUILDER_OBJECT = Message.Builder.class.getSimpleName();

/**
* @see com.devsu.push.sender.service.sync.SyncAndroidPushService#AndroidPushService(String)
* Single param constructor.
* @param gcmApiKey The GCM API Key (also known as Sender ID).
*/
public AsyncAndroidPushService(String gcmApiKey){
super(new SyncAndroidPushService(gcmApiKey), null);
Expand All @@ -34,8 +35,6 @@ public AsyncAndroidPushService(String gcmApiKey, PushCallback pushCallback) {
* Sends a single push message.
* @param msgBuilder The Message.Builder object.
* @param token The push token.
* @return <i>true</i> if the push message request was sent.
* @throws Exception
*/
public void sendPush(final Message.Builder msgBuilder, final String token) {
ExecutorService executorService = Executors.newSingleThreadExecutor();
Expand All @@ -61,9 +60,7 @@ public void run() {
/**
* Sends a bulk push message.
* @param msgBuilder The Message.Builder object.
* @param token The push token.
* @return <i>true</i> if the push message request was sent.
* @throws Exception
* @param tokens The push tokens.
*/
public void sendPushInBulk(final Message.Builder msgBuilder, final String... tokens) {
ExecutorService executorService = Executors.newSingleThreadExecutor();
Expand All @@ -87,56 +84,66 @@ public void run() {
}

/**
* @see com.devsu.push.sender.service.sync.SyncAndroidPushService#setMaxRetries(int)
* Sets the number of max retries when sending a push message.
* @param maxRetries The number of max retries when sending a push message.
*/
public void setMaxRetries(int maxRetries) {
((SyncAndroidPushService)pushService).setMaxRetries(maxRetries);
}

/**
* @see com.devsu.push.sender.service.sync.SyncAndroidPushService#setMessageKey(java.lang.String)
* Sets the message key that will store the key-value pair for the push message content.
* @param messageKey The message key that will store the key-value pair for the push message content.
*/
public void setMessageKey(String messageKey) {
((SyncAndroidPushService)pushService).setMessageKey(messageKey);
}

/**
* @see com.devsu.push.sender.service.sync.SyncAndroidPushService#setTitleKey(java.lang.String)
* Sets the title key that will store the key-value pair for the push message title.
* @param titleKey The title key that will store the key-value pair for the push message title.
*/
public void setTitleKey(String titleKey) {
((SyncAndroidPushService)pushService).setTitleKey(titleKey);
}

/**
* @see com.devsu.push.sender.service.sync.SyncAndroidPushService#setMaxBulkSize(int)
* Sets the quantity of push messages to be sent simultaneously on multicast requests.
* <b>NOTE:</b> As of December 2016, GCM states that there's a max limit of 1.000 simultaneous
* registration ids on multicast requests. See the <i>registration_ids</i> parameter <a href="https://developers.google.com/cloud-messaging/http-server-ref">here</a>.
* @param maxBulkSize The quantity of push messages to be sent simultaneously on multicast requests. Has a max value of 1000.
*/
public void setMaxBulkSize(int maxBulkSize) {
((SyncAndroidPushService)pushService).setMaxBulkSize(maxBulkSize);
}

/**
* @see com.devsu.push.sender.service.sync.SyncAndroidPushService#setCollapseKeySingle(java.lang.String)
* Sets the collapse key for identifying single messages.
* @param collapseKeySingle The collapse key for identifying single messages.
*/
public void setCollapseKeySingle(String collapseKeySingle) {
((SyncAndroidPushService)pushService).setCollapseKeySingle(collapseKeySingle);
}

/**
* @see com.devsu.push.sender.service.sync.SyncAndroidPushService#setCollapseKeyBulk(java.lang.String)
/**
* Sets the collapse key for identifying bulk messages.
* @param collapseKeyBulk The collapse key for identifying bulk messages.
*/
public void setCollapseKeyBulk(String collapseKeyBulk) {
((SyncAndroidPushService)pushService).setCollapseKeyBulk(collapseKeyBulk);
}

/**
* @see com.devsu.push.sender.service.sync.SyncAndroidPushService#setGcmApiKey(java.lang.String)
* Sets the GCM API Key (also known as Sender ID).
* @param gcmApiKey The GCM API Key (also known as Sender ID).
*/
public void setGcmApiKey(String gcmApiKey) {
((SyncAndroidPushService)pushService).setGcmApiKey(gcmApiKey);
}

/**
* @see com.devsu.push.sender.service.sync.SyncPushServiceBase#setPushEnabled(boolean)
* Enables/disables this service.
* @param pushEnabled The parameter that enables/disables this service.
*/
public void setPushEnabled(boolean pushEnabled) {
((SyncAndroidPushService)pushService).setPushEnabled(pushEnabled);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,12 @@ public class AsyncApplePushService extends AsyncPushServiceBase {
private static final String BUILDER_OBJECT = PayloadBuilder.class.getSimpleName();

/**
* @see com.devsu.push.sender.service.sync.SyncApplePushService#ApplePushService(String, String, boolean)
* 3 param constructor.
* @param certificatePath The path of the p12 certificate file.
* @param certificatePassword The password for the p12 certificate.
* @param useProductionServer Indicates if the services uses a Production environment or a Sandbox environment.
* @throws RuntimeIOException An IO exception.
* @throws InvalidSSLConfig Certificates are corrupted, wrong or password is wrong.
*/
public AsyncApplePushService(String certificatePath, String certificatePassword, boolean useProductionServer)
throws RuntimeIOException, InvalidSSLConfig {
Expand All @@ -32,8 +37,8 @@ public AsyncApplePushService(String certificatePath, String certificatePassword,
* @param certificatePassword The password for the p12 certificate.
* @param useProductionServer Indicates if the services uses a Production environment or a Sandbox environment.
* @param pushCallback The push callback.
* @throws RuntimeIOException
* @throws InvalidSSLConfig
* @throws RuntimeIOException An IO exception.
* @throws InvalidSSLConfig Certificates are corrupted, wrong or password is wrong.
*/
public AsyncApplePushService(String certificatePath, String certificatePassword, boolean useProductionServer, PushCallback pushCallback)
throws RuntimeIOException, InvalidSSLConfig {
Expand All @@ -44,8 +49,6 @@ public AsyncApplePushService(String certificatePath, String certificatePassword,
* Sends a single push message.
* @param msgBuilder The PayloadBuilder object.
* @param token The push token.
* @return <i>true</i> if the push message request was sent.
* @throws Exception
*/
public void sendPush(final PayloadBuilder msgBuilder, final String token) {
ExecutorService executorService = Executors.newSingleThreadExecutor();
Expand All @@ -71,9 +74,7 @@ public void run() {
/**
* Sends a bulk push message.
* @param msgBuilder The Message.Builder object.
* @param token The push token.
* @return <i>true</i> if the push message request was sent.
* @throws Exception
* @param tokens The push token.
*/
public void sendPushInBulk(final PayloadBuilder msgBuilder, final String... tokens) {
ExecutorService executorService = Executors.newSingleThreadExecutor();
Expand All @@ -97,26 +98,39 @@ public void run() {
}

/**
* @see com.devsu.push.sender.service.sync.SyncApplePushService#setupDevelopmentServer(java.lang.String, java.lang.String)
* Sets up the APNS Sandbox environment.
* @param certificatePath The path of the p12 certificate file.
* @param certificatePassword The password for the p12 certificate.
* @throws RuntimeIOException An IO exception.
* @throws InvalidSSLConfig Certificates are corrupted, wrong or password is wrong.
*/
public void setupDevelopmentServer(String certificatePath, String certificatePassword) throws RuntimeIOException, InvalidSSLConfig {
((SyncApplePushService)pushService).setupDevelopmentServer(certificatePath, certificatePassword);
}

/**
* @see com.devsu.push.sender.service.sync.SyncApplePushService#setupProductionServer(java.lang.String, java.lang.String)
* Sets up the APNS Production environment.
* @param certificatePath The path of the p12 certificate file.
* @param certificatePassword The password for the p12 certificate.
* @throws RuntimeIOException An IO exception.
* @throws InvalidSSLConfig Certificates are corrupted, wrong or password is wrong.
*/
public void setupProductionServer(String certificatePath, String certificatePassword) throws RuntimeIOException, InvalidSSLConfig {
((SyncApplePushService)pushService).setupProductionServer(certificatePath, certificatePassword);
}

/**
* @see com.devsu.push.sender.service.sync.SyncPushServiceBase#setPushEnabled(boolean)
* Enables/disables this service.
* @param pushEnabled The parameter that enables/disables this service.
*/
public void setPushEnabled(boolean pushEnabled) {
((SyncApplePushService)pushService).setPushEnabled(pushEnabled);
}

/**
* Gets a map of inactive devices.
* @return a map of inactive devices.
*/
public Map<String, Date> getInactiveDevices() {
return ((SyncApplePushService)pushService).getInactiveDevices();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public boolean sendPush(final String title, final String message, final Map<Stri
* @param msgBuilder The Message.Builder object.
* @param token The push token.
* @return <i>true</i> if the push message request was sent.
* @throws Exception
* @throws Exception Any exception that may arise.
*/
public boolean sendPush(Message.Builder msgBuilder, String token) throws Exception {
if (!validateToken(log, token)) {
Expand Down Expand Up @@ -129,9 +129,9 @@ public boolean sendPushInBulk(final String title, final String message,
/**
* Sends a bulk push message.
* @param msgBuilder The Message.Builder object.
* @param token The push token.
* @param tokens The push token.
* @return <i>true</i> if the push message request was sent.
* @throws Exception
* @throws Exception Any exception that may arise.
*/
public boolean sendPushInBulk(Message.Builder msgBuilder, String... tokens) throws Exception {
boolean booleanResult = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ public class SyncApplePushService extends SyncPushServiceBase {
* @param certificatePath The path of the p12 certificate file.
* @param certificatePassword The password for the p12 certificate.
* @param useProductionServer Indicates if the services uses a Production environment or a Sandbox environment.
* @throws RuntimeIOException
* @throws InvalidSSLConfig
* @throws RuntimeIOException An IO exception.
* @throws InvalidSSLConfig Certificates are corrupted, wrong or password is wrong.
*/
public SyncApplePushService(String certificatePath, String certificatePassword, boolean useProductionServer)
throws RuntimeIOException, InvalidSSLConfig {
Expand Down Expand Up @@ -77,7 +77,7 @@ public boolean sendPush(String title, String message, Map<String, String> additi
* @param msgBuilder The PayloadBuilder object.
* @param token The push token.
* @return <i>true</i> if the push message request was sent.
* @throws Exception
* @throws Exception Any exception that may arise.
*/
public boolean sendPush(PayloadBuilder msgBuilder, String token) throws Exception {
if (!validateToken(log, token)) {
Expand Down Expand Up @@ -111,9 +111,9 @@ public boolean sendPushInBulk(String title, String message,
/**
* Sends a bulk push message.
* @param msgBuilder The PayloadBuilder object.
* @param token The push token.
* @param tokens The push token.
* @return <i>true</i> if the push message request was sent.
* @throws Exception
* @throws Exception Any exception that may arise.
*/
public boolean sendPushInBulk(PayloadBuilder msgBuilder, String... tokens) throws Exception {
apnsService.start();
Expand Down Expand Up @@ -146,8 +146,8 @@ private PayloadBuilder generateBuilder(String title, String message, Map<String,
* Sets up the APNS Sandbox environment.
* @param certificatePath The path of the p12 certificate file.
* @param certificatePassword The password for the p12 certificate.
* @throws RuntimeIOException
* @throws InvalidSSLConfig
* @throws RuntimeIOException An IO exception.
* @throws InvalidSSLConfig Certificates are corrupted, wrong or password is wrong.
*/
public void setupDevelopmentServer(String certificatePath, String certificatePassword) throws RuntimeIOException, InvalidSSLConfig {
apnsService = APNS.newService().withCert(certificatePath, certificatePassword).withSandboxDestination().build();
Expand All @@ -158,8 +158,8 @@ public void setupDevelopmentServer(String certificatePath, String certificatePas
* Sets up the APNS Production environment.
* @param certificatePath The path of the p12 certificate file.
* @param certificatePassword The password for the p12 certificate.
* @throws RuntimeIOException
* @throws InvalidSSLConfig
* @throws RuntimeIOException An IO exception.
* @throws InvalidSSLConfig Certificates are corrupted, wrong or password is wrong.
*/
public void setupProductionServer(String certificatePath, String certificatePassword) throws RuntimeIOException, InvalidSSLConfig {
apnsService = APNS.newService().withCert(certificatePath, certificatePassword).withProductionDestination().build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public interface SyncPushService {
* @param message The push message content.
* @param token The push token.
* @return <i>true</i> if the push message request was sent.
* @throws Exception
* @throws Exception Any exception that may arise.
*/
boolean sendPush(String message, String token) throws Exception;

Expand All @@ -19,7 +19,7 @@ public interface SyncPushService {
* @param message The push message content.
* @param token The push token.
* @return <i>true</i> if the push message request was sent.
* @throws Exception
* @throws Exception Any exception that may arise.
*/
boolean sendPush(String title, String message, String token) throws Exception;

Expand All @@ -30,7 +30,7 @@ public interface SyncPushService {
* @param additionalFields The additional fields sent on the push message.
* @param token The push token.
* @return <i>true</i> if the push message request was sent.
* @throws Exception
* @throws Exception Any exception that may arise.
*/
boolean sendPush(String title, String message, Map<String, String> additionalFields, String token) throws Exception;

Expand All @@ -39,7 +39,7 @@ public interface SyncPushService {
* @param message The push message content.
* @param tokens The push tokens.
* @return <i>true</i> if the push message request was sent.
* @throws Exception
* @throws Exception Any exception that may arise.
*/
boolean sendPushInBulk(String message, String... tokens) throws Exception;

Expand All @@ -49,7 +49,7 @@ public interface SyncPushService {
* @param message The push message content.
* @param tokens The push tokens.
* @return <i>true</i> if the push message request was sent.
* @throws Exception
* @throws Exception Any exception that may arise.
*/
boolean sendPushInBulk(String title, String message, String... tokens) throws Exception;

Expand All @@ -60,7 +60,7 @@ public interface SyncPushService {
* @param additionalFields The additional fields sent on the push message.
* @param tokens The push tokens.
* @return <i>true</i> if the push message request was sent.
* @throws Exception
* @throws Exception Any exception that may arise.
*/
boolean sendPushInBulk(String title, String message, Map<String, String> additionalFields, String... tokens) throws Exception;
}
1 change: 1 addition & 0 deletions src/main/java/com/devsu/push/sender/util/ArrayUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ public class ArrayUtil {

/**
* Splits an array in a list of subarrays of size <i>maxSubArraySize</i>.
* @param <T> The class of the elements in the array.
* @param elementArray The array to be split.
* @param maxSubArraySize The final size of the subarrays.
* @return The list containing the subarrays.
Expand Down

0 comments on commit ff82560

Please sign in to comment.