Skip to content

Commit

Permalink
KAA-462: change SyncRequest to use sdk_token instead of EndpointVersi…
Browse files Browse the repository at this point in the history
…onInfo
  • Loading branch information
batytskyy committed Apr 14, 2015
1 parent a697d8b commit 1fd82aa
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 32 deletions.
Expand Up @@ -61,7 +61,7 @@ public ProfileSyncRequest createProfileRequest() throws IOException {
request.setEndpointPublicKey(ByteBuffer.wrap(clientState.getPublicKey().getEncoded())); request.setEndpointPublicKey(ByteBuffer.wrap(clientState.getPublicKey().getEncoded()));
} }
request.setProfileBody(ByteBuffer.wrap(serializedProfile)); request.setProfileBody(ByteBuffer.wrap(serializedProfile));
request.setVersionInfo(properties.getVersionInfo()); request.setSdkToken(properties.getSdkToken());
return request; return request;
} else { } else {
LOG.info("Profile is up to date"); LOG.info("Profile is up to date");
Expand Down
2 changes: 1 addition & 1 deletion common/endpoint-shared/src/main/avro/endpoint.avsc
Expand Up @@ -270,7 +270,7 @@
"fields": [ "fields": [
{"name": "endpointPublicKey", "type": ["bytes", "null"]}, {"name": "endpointPublicKey", "type": ["bytes", "null"]},
{"name": "profileBody", "type": "bytes"}, {"name": "profileBody", "type": "bytes"},
{"name": "versionInfo", "type": "org.kaaproject.kaa.common.endpoint.gen.EndpointVersionInfo"}, {"name": "sdkToken", "type": "string"},
{"name": "endpointAccessToken", "type": ["string", "null"]} {"name": "endpointAccessToken", "type": ["string", "null"]}
] ]
}, },
Expand Down
Expand Up @@ -7,11 +7,11 @@
@SuppressWarnings("all") @SuppressWarnings("all")
@org.apache.avro.specific.AvroGenerated @org.apache.avro.specific.AvroGenerated
public class ProfileSyncRequest extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord { public class ProfileSyncRequest extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord {
public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"ProfileSyncRequest\",\"namespace\":\"org.kaaproject.kaa.common.endpoint.gen\",\"fields\":[{\"name\":\"endpointPublicKey\",\"type\":[\"bytes\",\"null\"]},{\"name\":\"profileBody\",\"type\":\"bytes\"},{\"name\":\"versionInfo\",\"type\":{\"type\":\"record\",\"name\":\"EndpointVersionInfo\",\"fields\":[{\"name\":\"configVersion\",\"type\":\"int\"},{\"name\":\"profileVersion\",\"type\":\"int\",\"default\":1},{\"name\":\"systemNfVersion\",\"type\":\"int\",\"default\":0},{\"name\":\"userNfVersion\",\"type\":\"int\",\"default\":0},{\"name\":\"eventFamilyVersions\",\"type\":[{\"type\":\"array\",\"items\":{\"type\":\"record\",\"name\":\"EventClassFamilyVersionInfo\",\"fields\":[{\"name\":\"name\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"version\",\"type\":\"int\"}],\"direction\":\"out\"}},\"null\"]},{\"name\":\"logSchemaVersion\",\"type\":\"int\",\"default\":0}],\"direction\":\"out\"}},{\"name\":\"endpointAccessToken\",\"type\":[{\"type\":\"string\",\"avro.java.string\":\"String\"},\"null\"]}],\"direction\":\"out\"}"); public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"ProfileSyncRequest\",\"namespace\":\"org.kaaproject.kaa.common.endpoint.gen\",\"fields\":[{\"name\":\"endpointPublicKey\",\"type\":[\"bytes\",\"null\"]},{\"name\":\"profileBody\",\"type\":\"bytes\"},{\"name\":\"sdkToken\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"endpointAccessToken\",\"type\":[{\"type\":\"string\",\"avro.java.string\":\"String\"},\"null\"]}],\"direction\":\"out\"}");
public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; } public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; }
private java.nio.ByteBuffer endpointPublicKey; private java.nio.ByteBuffer endpointPublicKey;
private java.nio.ByteBuffer profileBody; private java.nio.ByteBuffer profileBody;
private org.kaaproject.kaa.common.endpoint.gen.EndpointVersionInfo versionInfo; private java.lang.String sdkToken;
private java.lang.String endpointAccessToken; private java.lang.String endpointAccessToken;


/** /**
Expand All @@ -24,10 +24,10 @@ public ProfileSyncRequest() {}
/** /**
* All-args constructor. * All-args constructor.
*/ */
public ProfileSyncRequest(java.nio.ByteBuffer endpointPublicKey, java.nio.ByteBuffer profileBody, org.kaaproject.kaa.common.endpoint.gen.EndpointVersionInfo versionInfo, java.lang.String endpointAccessToken) { public ProfileSyncRequest(java.nio.ByteBuffer endpointPublicKey, java.nio.ByteBuffer profileBody, java.lang.String sdkToken, java.lang.String endpointAccessToken) {
this.endpointPublicKey = endpointPublicKey; this.endpointPublicKey = endpointPublicKey;
this.profileBody = profileBody; this.profileBody = profileBody;
this.versionInfo = versionInfo; this.sdkToken = sdkToken;
this.endpointAccessToken = endpointAccessToken; this.endpointAccessToken = endpointAccessToken;
} }


Expand All @@ -37,7 +37,7 @@ public java.lang.Object get(int field$) {
switch (field$) { switch (field$) {
case 0: return endpointPublicKey; case 0: return endpointPublicKey;
case 1: return profileBody; case 1: return profileBody;
case 2: return versionInfo; case 2: return sdkToken;
case 3: return endpointAccessToken; case 3: return endpointAccessToken;
default: throw new org.apache.avro.AvroRuntimeException("Bad index"); default: throw new org.apache.avro.AvroRuntimeException("Bad index");
} }
Expand All @@ -48,7 +48,7 @@ public void put(int field$, java.lang.Object value$) {
switch (field$) { switch (field$) {
case 0: endpointPublicKey = (java.nio.ByteBuffer)value$; break; case 0: endpointPublicKey = (java.nio.ByteBuffer)value$; break;
case 1: profileBody = (java.nio.ByteBuffer)value$; break; case 1: profileBody = (java.nio.ByteBuffer)value$; break;
case 2: versionInfo = (org.kaaproject.kaa.common.endpoint.gen.EndpointVersionInfo)value$; break; case 2: sdkToken = (java.lang.String)value$; break;
case 3: endpointAccessToken = (java.lang.String)value$; break; case 3: endpointAccessToken = (java.lang.String)value$; break;
default: throw new org.apache.avro.AvroRuntimeException("Bad index"); default: throw new org.apache.avro.AvroRuntimeException("Bad index");
} }
Expand Down Expand Up @@ -85,18 +85,18 @@ public void setProfileBody(java.nio.ByteBuffer value) {
} }


/** /**
* Gets the value of the 'versionInfo' field. * Gets the value of the 'sdkToken' field.
*/ */
public org.kaaproject.kaa.common.endpoint.gen.EndpointVersionInfo getVersionInfo() { public java.lang.String getSdkToken() {
return versionInfo; return sdkToken;
} }


/** /**
* Sets the value of the 'versionInfo' field. * Sets the value of the 'sdkToken' field.
* @param value the value to set. * @param value the value to set.
*/ */
public void setVersionInfo(org.kaaproject.kaa.common.endpoint.gen.EndpointVersionInfo value) { public void setSdkToken(java.lang.String value) {
this.versionInfo = value; this.sdkToken = value;
} }


/** /**
Expand Down Expand Up @@ -137,7 +137,7 @@ public static class Builder extends org.apache.avro.specific.SpecificRecordBuild


private java.nio.ByteBuffer endpointPublicKey; private java.nio.ByteBuffer endpointPublicKey;
private java.nio.ByteBuffer profileBody; private java.nio.ByteBuffer profileBody;
private org.kaaproject.kaa.common.endpoint.gen.EndpointVersionInfo versionInfo; private java.lang.String sdkToken;
private java.lang.String endpointAccessToken; private java.lang.String endpointAccessToken;


/** Creates a new Builder */ /** Creates a new Builder */
Expand All @@ -156,8 +156,8 @@ private Builder(org.kaaproject.kaa.common.endpoint.gen.ProfileSyncRequest.Builde
this.profileBody = data().deepCopy(fields()[1].schema(), other.profileBody); this.profileBody = data().deepCopy(fields()[1].schema(), other.profileBody);
fieldSetFlags()[1] = true; fieldSetFlags()[1] = true;
} }
if (isValidValue(fields()[2], other.versionInfo)) { if (isValidValue(fields()[2], other.sdkToken)) {
this.versionInfo = data().deepCopy(fields()[2].schema(), other.versionInfo); this.sdkToken = data().deepCopy(fields()[2].schema(), other.sdkToken);
fieldSetFlags()[2] = true; fieldSetFlags()[2] = true;
} }
if (isValidValue(fields()[3], other.endpointAccessToken)) { if (isValidValue(fields()[3], other.endpointAccessToken)) {
Expand All @@ -177,8 +177,8 @@ private Builder(org.kaaproject.kaa.common.endpoint.gen.ProfileSyncRequest other)
this.profileBody = data().deepCopy(fields()[1].schema(), other.profileBody); this.profileBody = data().deepCopy(fields()[1].schema(), other.profileBody);
fieldSetFlags()[1] = true; fieldSetFlags()[1] = true;
} }
if (isValidValue(fields()[2], other.versionInfo)) { if (isValidValue(fields()[2], other.sdkToken)) {
this.versionInfo = data().deepCopy(fields()[2].schema(), other.versionInfo); this.sdkToken = data().deepCopy(fields()[2].schema(), other.sdkToken);
fieldSetFlags()[2] = true; fieldSetFlags()[2] = true;
} }
if (isValidValue(fields()[3], other.endpointAccessToken)) { if (isValidValue(fields()[3], other.endpointAccessToken)) {
Expand Down Expand Up @@ -237,27 +237,27 @@ public org.kaaproject.kaa.common.endpoint.gen.ProfileSyncRequest.Builder clearPr
return this; return this;
} }


/** Gets the value of the 'versionInfo' field */ /** Gets the value of the 'sdkToken' field */
public org.kaaproject.kaa.common.endpoint.gen.EndpointVersionInfo getVersionInfo() { public java.lang.String getSdkToken() {
return versionInfo; return sdkToken;
} }


/** Sets the value of the 'versionInfo' field */ /** Sets the value of the 'sdkToken' field */
public org.kaaproject.kaa.common.endpoint.gen.ProfileSyncRequest.Builder setVersionInfo(org.kaaproject.kaa.common.endpoint.gen.EndpointVersionInfo value) { public org.kaaproject.kaa.common.endpoint.gen.ProfileSyncRequest.Builder setSdkToken(java.lang.String value) {
validate(fields()[2], value); validate(fields()[2], value);
this.versionInfo = value; this.sdkToken = value;
fieldSetFlags()[2] = true; fieldSetFlags()[2] = true;
return this; return this;
} }


/** Checks whether the 'versionInfo' field has been set */ /** Checks whether the 'sdkToken' field has been set */
public boolean hasVersionInfo() { public boolean hasSdkToken() {
return fieldSetFlags()[2]; return fieldSetFlags()[2];
} }


/** Clears the value of the 'versionInfo' field */ /** Clears the value of the 'sdkToken' field */
public org.kaaproject.kaa.common.endpoint.gen.ProfileSyncRequest.Builder clearVersionInfo() { public org.kaaproject.kaa.common.endpoint.gen.ProfileSyncRequest.Builder clearSdkToken() {
versionInfo = null; sdkToken = null;
fieldSetFlags()[2] = false; fieldSetFlags()[2] = false;
return this; return this;
} }
Expand Down Expand Up @@ -293,7 +293,7 @@ public ProfileSyncRequest build() {
ProfileSyncRequest record = new ProfileSyncRequest(); ProfileSyncRequest record = new ProfileSyncRequest();
record.endpointPublicKey = fieldSetFlags()[0] ? this.endpointPublicKey : (java.nio.ByteBuffer) defaultValue(fields()[0]); record.endpointPublicKey = fieldSetFlags()[0] ? this.endpointPublicKey : (java.nio.ByteBuffer) defaultValue(fields()[0]);
record.profileBody = fieldSetFlags()[1] ? this.profileBody : (java.nio.ByteBuffer) defaultValue(fields()[1]); record.profileBody = fieldSetFlags()[1] ? this.profileBody : (java.nio.ByteBuffer) defaultValue(fields()[1]);
record.versionInfo = fieldSetFlags()[2] ? this.versionInfo : (org.kaaproject.kaa.common.endpoint.gen.EndpointVersionInfo) defaultValue(fields()[2]); record.sdkToken = fieldSetFlags()[2] ? this.sdkToken : (java.lang.String) defaultValue(fields()[2]);
record.endpointAccessToken = fieldSetFlags()[3] ? this.endpointAccessToken : (java.lang.String) defaultValue(fields()[3]); record.endpointAccessToken = fieldSetFlags()[3] ? this.endpointAccessToken : (java.lang.String) defaultValue(fields()[3]);
return record; return record;
} catch (Exception e) { } catch (Exception e) {
Expand Down

0 comments on commit 1fd82aa

Please sign in to comment.