77import com .pubnub .api .endpoints .Time ;
88import com .pubnub .api .endpoints .access .Audit ;
99import com .pubnub .api .endpoints .access .Grant ;
10- import com .pubnub .api .endpoints .channel_groups .*;
10+ import com .pubnub .api .endpoints .channel_groups .AddChannelChannelGroup ;
11+ import com .pubnub .api .endpoints .channel_groups .AllChannelsChannelGroup ;
12+ import com .pubnub .api .endpoints .channel_groups .DeleteChannelGroup ;
13+ import com .pubnub .api .endpoints .channel_groups .RemoveChannelChannelGroup ;
14+ import com .pubnub .api .endpoints .channel_groups .ListAllChannelGroup ;
1115import com .pubnub .api .endpoints .presence .GetState ;
1216import com .pubnub .api .endpoints .presence .HereNow ;
1317import com .pubnub .api .endpoints .presence .SetState ;
1418import com .pubnub .api .endpoints .presence .WhereNow ;
1519import com .pubnub .api .endpoints .pubsub .Publish ;
16- import com .pubnub .api .endpoints .push .*;
20+ import com .pubnub .api .endpoints .push .AddChannelsToPush ;
21+ import com .pubnub .api .endpoints .push .RemoveChannelsFromPush ;
22+ import com .pubnub .api .endpoints .push .RemoveAllPushChannelsForDevice ;
23+ import com .pubnub .api .endpoints .push .ListPushProvisions ;
1724import com .pubnub .api .managers .BasePathManager ;
1825import com .pubnub .api .managers .PublishSequenceManager ;
1926import com .pubnub .api .managers .SubscriptionManager ;
@@ -43,11 +50,14 @@ public class PubNub {
4350
4451 private String sdkVersion ;
4552
53+ private static final int TIMESTAMP_DIVIDER = 1000 ;
54+ private static final int MAX_SEQUENCE = 65535 ;
55+
4656 public PubNub (final PNConfiguration initialConfig ) {
4757 this .configuration = initialConfig ;
4858 this .subscriptionManager = new SubscriptionManager (this );
4959 this .basePathManager = new BasePathManager (initialConfig );
50- this .publishSequenceManager = new PublishSequenceManager (65535 );
60+ this .publishSequenceManager = new PublishSequenceManager (MAX_SEQUENCE );
5161
5262 sdkVersion = fetchSDKVersion ();
5363 }
@@ -70,7 +80,9 @@ public final SubscribeBuilder subscribe() {
7080 return new SubscribeBuilder (this .subscriptionManager );
7181 }
7282
73- public final UnsubscribeBuilder unsubscribe () { return new UnsubscribeBuilder (this .subscriptionManager ); }
83+ public final UnsubscribeBuilder unsubscribe () {
84+ return new UnsubscribeBuilder (this .subscriptionManager );
85+ }
7486
7587 // start push
7688
@@ -95,6 +107,7 @@ public final ListPushProvisions auditPushChannelProvisions() {
95107 public final WhereNow whereNow () {
96108 return new WhereNow (this );
97109 }
110+
98111 public final HereNow hereNow () {
99112 return new HereNow (this );
100113 }
@@ -103,19 +116,23 @@ public final Time time() {
103116 return new Time (this );
104117 }
105118
106- public final History history () { return new History (this ); }
119+ public final History history () {
120+ return new History (this );
121+ }
107122
108123
109124 public final Audit audit () {
110125 return new Audit (this );
111126 }
127+
112128 public final Grant grant () {
113129 return new Grant (this );
114130 }
115131
116132 public final GetState getPresenceState () {
117133 return new GetState (this );
118134 }
135+
119136 public final SetState setPresenceState () {
120137 return new SetState (this , subscriptionManager );
121138 }
@@ -148,6 +165,7 @@ public final DeleteChannelGroup deleteChannelGroup() {
148165
149166 /**
150167 * Perform Cryptographic decryption of an input string using cipher key provided by PNConfiguration
168+ *
151169 * @param inputString String to be encrypted
152170 * @return String containing the encryption of inputString using cipherKey
153171 */
@@ -161,10 +179,11 @@ public final String decrypt(String inputString) throws PubNubException {
161179
162180 /**
163181 * Perform Cryptographic decryption of an input string using the cipher key
182+ *
164183 * @param inputString String to be encrypted
165- * @param cipherKey cipher key to be used for encryption
166- * @throws PubNubException throws exception in case of failed encryption
184+ * @param cipherKey cipher key to be used for encryption
167185 * @return String containing the encryption of inputString using cipherKey
186+ * @throws PubNubException throws exception in case of failed encryption
168187 */
169188 public final String decrypt (final String inputString , final String cipherKey ) throws PubNubException {
170189 if (inputString == null ) {
@@ -176,6 +195,7 @@ public final String decrypt(final String inputString, final String cipherKey) th
176195
177196 /**
178197 * Perform Cryptographic encryption of an input string and the cipher key provided by PNConfiguration
198+ *
179199 * @param inputString String to be encrypted
180200 * @return String containing the encryption of inputString using cipherKey
181201 */
@@ -189,10 +209,11 @@ public final String encrypt(final String inputString) throws PubNubException {
189209
190210 /**
191211 * Perform Cryptographic encryption of an input string and the cipher key.
212+ *
192213 * @param inputString String to be encrypted
193- * @param cipherKey cipher key to be used for encryption
194- * @throws PubNubException throws exception in case of failed encryption
214+ * @param cipherKey cipher key to be used for encryption
195215 * @return String containing the encryption of inputString using cipherKey
216+ * @throws PubNubException throws exception in case of failed encryption
196217 */
197218 public final String encrypt (final String inputString , final String cipherKey ) throws PubNubException {
198219 if (inputString == null ) {
@@ -203,7 +224,7 @@ public final String encrypt(final String inputString, final String cipherKey) th
203224 }
204225
205226 public int getTimestamp () {
206- return (int ) ((new Date ().getTime ()) / 1000 );
227+ return (int ) ((new Date ().getTime ()) / TIMESTAMP_DIVIDER );
207228 }
208229
209230 /**
@@ -229,6 +250,7 @@ public final void reconnect() {
229250
230251 /**
231252 * fetch the SDK version from the resource files.
253+ *
232254 * @return Stringified representation of the SDK version.
233255 */
234256 private String fetchSDKVersion () {
0 commit comments