Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/release/v1.3.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
ikulikov committed Apr 27, 2016
2 parents d4f02ef + 79e7b52 commit cdad3e8
Show file tree
Hide file tree
Showing 11 changed files with 116 additions and 51 deletions.
14 changes: 10 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,25 +19,26 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.kaaproject.kaa</groupId>
<artifactId>sandbox-frame</artifactId>
<version>1.3.0</version>
<version>1.3.2</version>
<packaging>pom</packaging>

<name>Kaa Sandbox Frame</name>
<url>http://kaaproject.org</url>

<properties>
<main.dir>${basedir}</main.dir>
<kaa.version>0.8.0</kaa.version>
<kaa-sample-apps.version>1.2.0</kaa-sample-apps.version>
<kaa.version>0.9.0</kaa.version>
<kaa-sample-apps.version>1.3.0</kaa-sample-apps.version>
<gwt.version>2.7.0</gwt.version>
<spring.version>4.0.2.RELEASE</spring.version>
<ehcache.version>2.8.1</ehcache.version>
<slf4j.version>1.7.7</slf4j.version>
<logback.version>1.1.2</logback.version>
<logback-ext-spring.version>0.1.2</logback-ext-spring.version>
<httpcomponents.version>4.3.2</httpcomponents.version>
<commons-validator.version>1.5.0</commons-validator.version>
<avro.version>1.7.5</avro.version>
<avro-ui.version>0.2.0</avro-ui.version>
<avro-ui.version>0.2.1</avro-ui.version>
<rat.version>0.10</rat.version>
</properties>

Expand Down Expand Up @@ -228,6 +229,11 @@
<classifier>sources</classifier>
<version>${kaa-sample-apps.version}</version>
</dependency>
<dependency>
<groupId>commons-validator</groupId>
<artifactId>commons-validator</artifactId>
<version>${commons-validator.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
Expand Down
6 changes: 5 additions & 1 deletion web/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.kaaproject.kaa</groupId>
<version>1.3.0</version>
<version>1.3.2</version>
<artifactId>sandbox-frame</artifactId>
</parent>
<groupId>org.kaaproject.kaa.sandbox-frame</groupId>
Expand Down Expand Up @@ -102,6 +102,10 @@
<artifactId>mail</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>commons-validator</groupId>
<artifactId>commons-validator</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,9 @@

package org.kaaproject.kaa.sandbox.web.client.mvp.activity;

import com.google.gwt.activity.shared.AbstractActivity;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.shared.EventBus;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.AcceptsOneWidget;
import java.util.ArrayList;
import java.util.List;

import org.kaaproject.avro.ui.gwt.client.util.BusyAsyncCallback;
import org.kaaproject.kaa.sandbox.web.client.Sandbox;
import org.kaaproject.kaa.sandbox.web.client.mvp.ClientFactory;
Expand All @@ -34,8 +30,13 @@
import org.kaaproject.kaa.sandbox.web.client.util.LogLevel;
import org.kaaproject.kaa.sandbox.web.client.util.Utils;

import java.util.ArrayList;
import java.util.List;
import com.google.gwt.activity.shared.AbstractActivity;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.shared.EventBus;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.AcceptsOneWidget;

public class ChangeKaaHostActivity extends AbstractActivity {

Expand Down Expand Up @@ -166,37 +167,44 @@ public void onSuccess(LogLevel level) {
private void changeKaaHost() {
final String host = view.getKaaHost().getValue();
Analytics.sendEvent(Analytics.CHANGE_KAA_HOST_ACTION, host);
if (host != null && host.length() > 0) {
view.clearError();
ConsoleDialog.startConsoleDialog("Going to change kaa host to '"
+ host + "'...\n", new ConsoleDialogListener() {
Sandbox.getSandboxService().validateKaaHost(host, new AsyncCallback<Void>() {
@Override
public void onFailure(Throwable caught) {
String message = Utils.getErrorMessage(caught);
view.setErrorMessage(message);
}

@Override
public void onOk(boolean success) {
}
@Override
public void onSuccess(Void result) {
view.clearError();
ConsoleDialog.startConsoleDialog("Going to change kaa host to '"
+ host + "'...\n", new ConsoleDialogListener() {

@Override
public void onStart(String uuid, final ConsoleDialog dialog,
final AsyncCallback<Void> callback) {
Sandbox.getSandboxService().changeKaaHost(uuid, host,
new AsyncCallback<Void>() {
@Override
public void onFailure(Throwable caught) {
callback.onFailure(caught);
}

@Override
public void onSuccess(Void result) {
dialog.appendToConsoleAtFinish("Successfully changed kaa host to '"
+ host + "'\n");
callback.onSuccess(result);
}
});
}
});
} else {
view.setErrorMessage(Utils.messages.emptyKaaHostError());
}
@Override
public void onOk(boolean success) {
}

@Override
public void onStart(String uuid, final ConsoleDialog dialog,
final AsyncCallback<Void> callback) {
Sandbox.getSandboxService().changeKaaHost(uuid, host,
new AsyncCallback<Void>() {
@Override
public void onFailure(Throwable caught) {
callback.onFailure(caught);
}

@Override
public void onSuccess(Void result) {
dialog.appendToConsoleAtFinish("Successfully changed kaa host to '"
+ host + "'\n");
callback.onSuccess(result);
}
});
}
});
}
});
}

private void getLogs() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.FilenameUtils;
import org.apache.commons.lang.ArrayUtils;
import org.apache.commons.validator.routines.DomainValidator;
import org.apache.commons.validator.routines.InetAddressValidator;
import org.apache.tools.ant.taskdefs.Execute;
import org.apache.tools.ant.taskdefs.PumpStreamHandler;
import org.atmosphere.client.TrackMessageSizeInterceptor;
Expand Down Expand Up @@ -217,7 +219,7 @@ public void afterPropertiesSet() throws Exception {
private void prepareAnalytics() throws IOException {
if (enableAnalytics) {
try {
File f = new File(ANALYTICS_USER_ID_FILE);
File f = new File(Environment.getServerHomeDir() + "/" + ANALYTICS_USER_ID_FILE);
if (!f.exists()) {
f.createNewFile();
}
Expand Down Expand Up @@ -276,6 +278,16 @@ public boolean showChangeKaaHostDialog() throws SandboxServiceException {
public void changeKaaHostDialogShown() throws SandboxServiceException {
cacheService.putProperty(CHANGE_KAA_HOST_DIALOG_SHOWN_PROPERTY, Boolean.TRUE);
}

@Override
public void validateKaaHost(String host) throws SandboxServiceException {
if (host == null || host.length() == 0) {
throw new SandboxServiceException("Kaa host field can not be empty!");
} else if (!InetAddressValidator.getInstance().isValid(host) &&
!DomainValidator.getInstance(true).isValid(host)) {
throw new SandboxServiceException("Invalid hostname/ip address format!");
}
}

@Override
public void changeKaaHost(String uuid, String host) throws SandboxServiceException {
Expand All @@ -300,7 +312,7 @@ public void changeKaaHost(String uuid, String host) throws SandboxServiceExcepti
}
}
}

@Override
public boolean getLogsEnabled() throws SandboxServiceException {
return guiGetLogsEnabled;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@
public final class Version {

/** The Constant PROJECT_VERSION. */
public static final String PROJECT_VERSION = "1.3.0-SNAPSHOT";
public static final String PROJECT_VERSION = "1.3.2";

/** The Constant KAA_VERSION. */
public static final String KAA_VERSION = "0.8.0-SNAPSHOT";
public static final String KAA_VERSION = "0.9.0";

/** The Constant KAA_VERSION. */
public static final String KAA_SAMPLE_APPS_VERSION = "1.2.0-SNAPSHOT";
public static final String KAA_SAMPLE_APPS_VERSION = "1.3.0";

/**
* Instantiates a new version.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ public interface SandboxService extends RemoteService {
public boolean showChangeKaaHostDialog() throws SandboxServiceException;

public void changeKaaHostDialogShown() throws SandboxServiceException;

public void validateKaaHost(String host) throws SandboxServiceException;

public void changeKaaHost(String uuid, String host) throws SandboxServiceException;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -511,15 +511,26 @@ nav.navPrimary.collapsed li.primary > a > span.icon > img {
.demoProjectWidget .title {
position: relative;
width: 160px;
max-width: 160px;
margin: 0 auto;
color: #666;
font-size: 20px;
font-size: 19px;
font-variant: normal;
font-weight: normal;
line-height: 24px;
max-height: 48px;
height: 48px;
overflow: hidden;
display: block;
display: -webkit-box;
white-space: normal;
text-align: center;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
text-overflow: ellipsis;
-o-text-overflow: ellipsis;
-ms-text-overflow: ellipsis;
margin-bottom: 0;
}

.demoProjectWidget .action {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ ios = iOS

artik5 = Artik 5

raspberryPi = Rarpberry Pi
raspberryPi = Raspberry Pi

intelEdison = Intel Edison

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ pagerText = Page {0} of {1}

emptyKaaHostError = Kaa host field can not be empty!

invalidKaaHostError = Invalid hostname/ip address format!

changeKaaHostMessagePt1 = Kaa endpoints connect to your Kaa Sandbox by using the address built into the SDK. This address must be reachable from the network where you run your endpoints for your applications to work properly. The currently set Kaa Sandbox address is

changeKaaHostMessagePt2 = Please use the form below to manually update your Kaa Sandbox address.
Expand Down
19 changes: 19 additions & 0 deletions web/src/sh/bin/change_kaa_log_level.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,25 @@ then

sleep 10

elif [ ${remove_logs} -eq 1 ]

then

echo "Removing old log files..."

find /var/log/kaa -type f -name '*[0-9].log' -exec rm {} +

FILES=/var/log/kaa/*

for f in $FILES
do

> $f

done

echo "Old log files removed!"

fi

echo "Done!"
3 changes: 2 additions & 1 deletion web/src/sh/bin/create_logs_archive.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@
#


tar -cvf /home/kaa/sandbox_logs.tar.gz /var/log/kaa/
tar -cvf /home/kaa/sandbox_logs.tar.gz /var/log/kaa/
exit 0

0 comments on commit cdad3e8

Please sign in to comment.