Skip to content

Commit

Permalink
kaa-1231 rename
Browse files Browse the repository at this point in the history
  • Loading branch information
maxml committed Jul 14, 2016
1 parent 4374f87 commit c4f9393
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 35 deletions.
Expand Up @@ -176,7 +176,7 @@ protected void setClientState(State state) {
this(context, listener, false); this(context, listener, false);
} }


AbstractKaaClient(KaaClientPlatformContext context, KaaClientStateListener listener, boolean isUserKeyStrategy) AbstractKaaClient(KaaClientPlatformContext context, KaaClientStateListener listener, boolean isAutogeneratedKeys)
throws IOException, GeneralSecurityException { throws IOException, GeneralSecurityException {


this.context = context; this.context = context;
Expand All @@ -199,7 +199,7 @@ protected void setClientState(State state) {
} }


kaaClientState = new KaaClientPropertiesState(context.createPersistentStorage(), context.getBase64(), kaaClientState = new KaaClientPropertiesState(context.createPersistentStorage(), context.getBase64(),
properties, isUserKeyStrategy); properties, isAutogeneratedKeys);


TransportContext transportContext = buildTransportContext(properties, kaaClientState); TransportContext transportContext = buildTransportContext(properties, kaaClientState);


Expand Down
Expand Up @@ -39,9 +39,9 @@
@Generated("BaseKaaClient.java.template") @Generated("BaseKaaClient.java.template")
public class BaseKaaClient extends AbstractKaaClient implements KaaClient { public class BaseKaaClient extends AbstractKaaClient implements KaaClient {


public BaseKaaClient(KaaClientPlatformContext context, KaaClientStateListener listener, boolean isUserKeyStrategy) public BaseKaaClient(KaaClientPlatformContext context, KaaClientStateListener listener, boolean isAutogeneratedKeys)
throws IOException, GeneralSecurityException { throws IOException, GeneralSecurityException {
super(context, listener, isUserKeyStrategy); super(context, listener, isAutogeneratedKeys);
} }


public BaseKaaClient(KaaClientPlatformContext context, KaaClientStateListener listener) public BaseKaaClient(KaaClientPlatformContext context, KaaClientStateListener listener)
Expand Down
Expand Up @@ -48,16 +48,18 @@ public static KaaClient newClient(KaaClientPlatformContext context, KaaClientSta
/** /**
* Creating new Kaa client * Creating new Kaa client
* *
* @param context - Kaa platform specific context for client init * @param context - Kaa platform specific context for client init
* @param listener - notifier for changing client state * @param listener - notifier for changing client state
* @param isUserKeyStrategy - user strategy about creating public/private keys. In default case use previously created * @param isAutogeneratedKeys - check if creating public/private key pair.
* 'false' - use existing pre-generated public/private key pair (default behaviour).
* 'true' - auto-generate new public/private key pair if absent.
* @return new Kaa client * @return new Kaa client
* @throws KaaRuntimeException - if there are now key pair * @throws KaaRuntimeException - if there are now key pair
*/ */
public static KaaClient newClient(KaaClientPlatformContext context, KaaClientStateListener listener, boolean isUserKeyStrategy) public static KaaClient newClient(KaaClientPlatformContext context, KaaClientStateListener listener,
throws KaaRuntimeException { boolean isAutogeneratedKeys) throws KaaRuntimeException {
try { try {
return new BaseKaaClient(context, listener, isUserKeyStrategy); return new BaseKaaClient(context, listener, isAutogeneratedKeys);
} catch (GeneralSecurityException e) { } catch (GeneralSecurityException e) {
LOG.error("Failed to create Kaa client", e); LOG.error("Failed to create Kaa client", e);
throw new KaaUnsupportedPlatformException(e); throw new KaaUnsupportedPlatformException(e);
Expand Down
Expand Up @@ -103,7 +103,7 @@ public class KaaClientPropertiesState implements KaaClientState {
private boolean isConfigVersionUpdated = false; private boolean isConfigVersionUpdated = false;
private boolean hasUpdate = false; private boolean hasUpdate = false;


private boolean isUserKeyStrategy; private boolean isAutogeneratedKeys;


public KaaClientPropertiesState(PersistentStorage storage, Base64 base64, KaaClientProperties properties) { public KaaClientPropertiesState(PersistentStorage storage, Base64 base64, KaaClientProperties properties) {
this(storage, base64, properties, false); this(storage, base64, properties, false);
Expand All @@ -112,19 +112,19 @@ public KaaClientPropertiesState(PersistentStorage storage, Base64 base64, KaaCli
/** /**
* All needed properties for creating Kaa client * All needed properties for creating Kaa client
* *
* @param storage - in what storage platform will work * @param storage - in what storage platform will work
* @param base64 - interface for Base64 type * @param base64 - interface for Base64 type
* @param properties - saved properties for client * @param properties - saved properties for client
* @param isUserKeyStrategy - if not key pair keyPair and true, then create keys. In default it false and used * @param isAutogeneratedKeys - if not key pair keyPair and true, then create keys. In default it false and used
* already created keys. * already created keys.
*/ */
public KaaClientPropertiesState(PersistentStorage storage, Base64 base64, KaaClientProperties properties, public KaaClientPropertiesState(PersistentStorage storage, Base64 base64, KaaClientProperties properties,
boolean isUserKeyStrategy) { boolean isAutogeneratedKeys) {


super(); super();
this.storage = storage; this.storage = storage;
this.base64 = base64; this.base64 = base64;
this.isUserKeyStrategy = isUserKeyStrategy; this.isAutogeneratedKeys = isAutogeneratedKeys;


properties.setBase64(base64); properties.setBase64(base64);


Expand Down Expand Up @@ -343,15 +343,15 @@ public String refreshEndpointAccessToken() {


@Override @Override
public PrivateKey getPrivateKey() { public PrivateKey getPrivateKey() {
return getOrInitKeyPair(isUserKeyStrategy).getPrivate(); return getOrInitKeyPair(isAutogeneratedKeys).getPrivate();
} }


@Override @Override
public PublicKey getPublicKey() { public PublicKey getPublicKey() {
return getOrInitKeyPair(isUserKeyStrategy).getPublic(); return getOrInitKeyPair(isAutogeneratedKeys).getPublic();
} }


private KeyPair getOrInitKeyPair(boolean isUserKeyStrategy) { private KeyPair getOrInitKeyPair(boolean isAutogeneratedKeys) {
LOG.debug("Check if key pair exists {}, {}", clientPublicKeyFileLocation, clientPrivateKeyFileLocation); LOG.debug("Check if key pair exists {}, {}", clientPublicKeyFileLocation, clientPrivateKeyFileLocation);
if (keyPair != null) { if (keyPair != null) {
return keyPair; return keyPair;
Expand Down Expand Up @@ -385,7 +385,7 @@ private KeyPair getOrInitKeyPair(boolean isUserKeyStrategy) {
IOUtils.closeQuietly(privateKeyInput); IOUtils.closeQuietly(privateKeyInput);
} }
} }
if (isUserKeyStrategy) { if (isAutogeneratedKeys) {
LOG.debug("Generating Client Key pair"); LOG.debug("Generating Client Key pair");
OutputStream privateKeyOutput = null; OutputStream privateKeyOutput = null;
OutputStream publicKeyOutput = null; OutputStream publicKeyOutput = null;
Expand Down
Expand Up @@ -44,9 +44,9 @@ public class BaseKaaClient extends AbstractKaaClient implements KaaClient {
super(context, listener, false); super(context, listener, false);
} }


public BaseKaaClient(KaaClientPlatformContext context, KaaClientStateListener listener, boolean isUserKeyStrategy) public BaseKaaClient(KaaClientPlatformContext context, KaaClientStateListener listener, boolean isAutogeneratedKeys)
throws IOException, GeneralSecurityException { throws IOException, GeneralSecurityException {
super(context, listener, isUserKeyStrategy); super(context, listener, isAutogeneratedKeys);
} }




Expand Down
23 changes: 12 additions & 11 deletions pom.xml
Expand Up @@ -15,7 +15,7 @@ Copyright 2014-2016 CyberVision, Inc.
--> -->


<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>


<groupId>org.kaaproject</groupId> <groupId>org.kaaproject</groupId>
Expand All @@ -30,9 +30,9 @@ Copyright 2014-2016 CyberVision, Inc.
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<main.dir>${basedir}</main.dir> <main.dir>${basedir}</main.dir>
<avro-ui.version>0.3.0-SNAPSHOT</avro-ui.version> <avro-ui.version>0.2.1</avro-ui.version>


<akka.version>2.4.1</akka.version> <akka.version>2.4.1</akka.version>
<spring.version>4.2.5.RELEASE</spring.version> <spring.version>4.2.5.RELEASE</spring.version>
<spring.security.version>3.2.9.RELEASE</spring.security.version> <spring.security.version>3.2.9.RELEASE</spring.security.version>
<spring.data.version>Fowler-RELEASE</spring.data.version> <spring.data.version>Fowler-RELEASE</spring.data.version>
Expand Down Expand Up @@ -84,7 +84,7 @@ Copyright 2014-2016 CyberVision, Inc.
<jackson-mapper-asl.version>1.9.12</jackson-mapper-asl.version> <jackson-mapper-asl.version>1.9.12</jackson-mapper-asl.version>
<jackson-core-asl.version>1.9.13</jackson-core-asl.version> <jackson-core-asl.version>1.9.13</jackson-core-asl.version>
<jline.version>2.11</jline.version> <jline.version>2.11</jline.version>



<slf4j.version>1.7.7</slf4j.version> <slf4j.version>1.7.7</slf4j.version>
<slf4j-android.version>1.7.7</slf4j-android.version> <slf4j-android.version>1.7.7</slf4j-android.version>
Expand Down Expand Up @@ -112,7 +112,8 @@ Copyright 2014-2016 CyberVision, Inc.
<sonar.language>java</sonar.language> <sonar.language>java</sonar.language>
<sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin> <sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
<sonar.core.codeCoveragePlugin>jacoco</sonar.core.codeCoveragePlugin> <sonar.core.codeCoveragePlugin>jacoco</sonar.core.codeCoveragePlugin>
<sonar.exclusions>**/gen/**,**/verifiers/**/config/**,**/appenders/**/config/**,**/kaa/schema/base/**</sonar.exclusions> <sonar.exclusions>**/gen/**,**/verifiers/**/config/**,**/appenders/**/config/**,**/kaa/schema/base/**
</sonar.exclusions>
<sonar.skippedModules>admin,admin-rest-client,client-java-android,gwt-client</sonar.skippedModules> <sonar.skippedModules>admin,admin-rest-client,client-java-android,gwt-client</sonar.skippedModules>
<sonar.jacoco.reportPath>${main.dir}/target/jacoco.exec</sonar.jacoco.reportPath> <sonar.jacoco.reportPath>${main.dir}/target/jacoco.exec</sonar.jacoco.reportPath>
<sonar.jacoco.itReportPath>${main.dir}/target/jacoco-it.exec</sonar.jacoco.itReportPath> <sonar.jacoco.itReportPath>${main.dir}/target/jacoco-it.exec</sonar.jacoco.itReportPath>
Expand Down Expand Up @@ -275,8 +276,8 @@ Copyright 2014-2016 CyberVision, Inc.
<id>repository</id> <id>repository</id>
<distributionManagement> <distributionManagement>
<repository> <repository>
<id>kaa.release</id> <id>kaa.release</id>
<url>http://repository.kaaproject.org/repository/internal/</url> <url>http://repository.kaaproject.org/repository/internal/</url>
</repository> </repository>
<snapshotRepository> <snapshotRepository>
<id>kaa.snapshots</id> <id>kaa.snapshots</id>
Expand Down Expand Up @@ -817,7 +818,7 @@ Copyright 2014-2016 CyberVision, Inc.
<groupId>org.eclipse.jetty</groupId> <groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-annotations</artifactId> <artifactId>jetty-annotations</artifactId>
<version>${jetty.version}</version> <version>${jetty.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.eclipse.jetty</groupId> <groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlet</artifactId> <artifactId>jetty-servlet</artifactId>
Expand Down Expand Up @@ -898,7 +899,7 @@ Copyright 2014-2016 CyberVision, Inc.
<groupId>org.springframework.retry</groupId> <groupId>org.springframework.retry</groupId>
<artifactId>spring-retry</artifactId> <artifactId>spring-retry</artifactId>
<version>${spring.retry.version}</version> <version>${spring.retry.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.couchbase.client</groupId> <groupId>com.couchbase.client</groupId>
<artifactId>java-client</artifactId> <artifactId>java-client</artifactId>
Expand Down Expand Up @@ -1041,7 +1042,7 @@ Copyright 2014-2016 CyberVision, Inc.
<artifactId>kvstore</artifactId> <artifactId>kvstore</artifactId>
<version>${oracle-kvstore.version}</version> <version>${oracle-kvstore.version}</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>commons-dbcp</groupId> <groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId> <artifactId>commons-dbcp</artifactId>
Expand Down Expand Up @@ -1390,7 +1391,7 @@ Copyright 2014-2016 CyberVision, Inc.
<id>central</id> <id>central</id>
<url>http://repo1.maven.org/maven2/</url> <url>http://repo1.maven.org/maven2/</url>
</repository> </repository>
<repository> <repository>
<id>twitter-twttr</id> <id>twitter-twttr</id>
<url>http://maven.twttr.com/</url> <url>http://maven.twttr.com/</url>
</repository> </repository>
Expand Down

0 comments on commit c4f9393

Please sign in to comment.