Skip to content
This repository has been archived by the owner on Mar 5, 2020. It is now read-only.

Commit

Permalink
Merge pull request #525 from AmyAssist/dev
Browse files Browse the repository at this point in the history
Sprint 6 and 7
  • Loading branch information
neumantm authored Sep 30, 2018
2 parents e1732c3 + 60cdbba commit 2ca5a5b
Show file tree
Hide file tree
Showing 288 changed files with 14,427 additions and 3,448 deletions.
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@ COPY --from=source /src/.docker/config /app/config

WORKDIR /app

ENV AMY_SOCKET_CONFIG_WEB_SOCKET_PORT 6661
ENV AMY_SERVER_CONFIG_SERVER_SOCKET_PORT 80
ENV AMY_SERVER_CONFIG_SERVER_URL http://localhost:80/
EXPOSE $AMY_SERVER_CONFIG_SERVER_SOCKET_PORT
EXPOSE $AMY_SOCKET_CONFIG_WEB_SOCKET_PORT

RUN mkdir /config
RUN mkdir /data
Expand Down
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
[![Bugs](https://sonarcloud.io/api/project_badges/measure?project=de.unistuttgart.iaas.amyassist%3Aamy&metric=bugs)](https://sonarcloud.io/component_measures?id=de.unistuttgart.iaas.amyassist%3Aamy&metric=Reliability)
[![Reliability](https://sonarcloud.io/api/project_badges/measure?project=de.unistuttgart.iaas.amyassist%3Aamy&metric=reliability_rating)](https://sonarcloud.io/component_measures?id=de.unistuttgart.iaas.amyassist%3Aamy&metric=Reliability)

[![Docker](http://dockeri.co/image/amyassist/amy)](https://hub.docker.com/r/amyassist/amy/)


### Personal Assistance System

This is a research project from students of the University of Stuttgart. No functionality is tested. There may be harmful errors.
Expand Down Expand Up @@ -76,7 +79,9 @@ Direct links:

## Deployment

TODO
Best use our docker compose [project](https://github.com/amyassist/amy-all).
Otherwise build the master node as a jar and every plugin as a jar and place all plugin jars in a directory.
Then create a directory named config and place all required configs in there. In the plugin.config set the plugin path acordingly.

## Built With

Expand All @@ -88,7 +93,7 @@ Please read [CONTRIBUTING.md](CONTRIBUTING.md) for details on our code of conduc

## Versioning

TODO
This project uses [Semantic Versioning](https://semver.org/).

## Authors

Expand Down
7 changes: 6 additions & 1 deletion amy-master-node/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<parent>
<groupId>de.unistuttgart.iaas.amyassist</groupId>
<artifactId>amy</artifactId>
<version>0.5.0</version>
<version>0.6.0</version>
<relativePath>../pom.xml</relativePath>
</parent>
<dependencies>
Expand Down Expand Up @@ -55,6 +55,11 @@
<artifactId>amy-natlang</artifactId>
<version>${amy.natlang.version}</version>
</dependency>
<dependency>
<groupId>de.unistuttgart.iaas.amyassist</groupId>
<artifactId>amy-chat-socket</artifactId>
<version>${amy.chatsocket.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
Expand Down
2 changes: 1 addition & 1 deletion amy-message-hub-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<parent>
<groupId>de.unistuttgart.iaas.amyassist</groupId>
<artifactId>amy</artifactId>
<version>0.5.0</version>
<version>0.6.0</version>
<relativePath>../pom.xml</relativePath>
</parent>
</project>
2 changes: 1 addition & 1 deletion amy-message-hub/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>de.unistuttgart.iaas.amyassist</groupId>
<artifactId>amy</artifactId>
<version>0.5.0</version>
<version>0.6.0</version>
</parent>
<artifactId>amy-message-hub</artifactId>
<dependencies>
Expand Down
2 changes: 1 addition & 1 deletion api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<parent>
<groupId>de.unistuttgart.iaas.amyassist</groupId>
<artifactId>amy</artifactId>
<version>0.5.0</version>
<version>0.6.0</version>
<relativePath>../pom.xml</relativePath>
</parent>
<dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
package de.unistuttgart.iaas.amyassist.amy.core.taskscheduler.api;

import java.time.Instant;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;

import javax.annotation.Nonnull;

/**
* Service to schedule and execute concurrent tasks.
Expand All @@ -46,6 +50,22 @@ public interface TaskScheduler {
* the task to execute
* @param instant
* The instant at which to execute that task
* @return the reference to the scheduled task
*/
@Nonnull
ScheduledFuture<?> schedule(Runnable task, Instant instant);

/**
* Schedules the given task to execute at the given delay
*
* @param task
* the task to execute
* @param delay
* the delay
* @param timeUnit
* the time unit of the delay
* @return the reference to the scheduled task
*/
void schedule(Runnable task, Instant instant);
@Nonnull
ScheduledFuture<?> schedule(Runnable task, long delay, TimeUnit timeUnit);
}
431 changes: 431 additions & 0 deletions chat-socket/.settings/org.eclipse.jdt.core.prefs

Large diffs are not rendered by default.

67 changes: 67 additions & 0 deletions chat-socket/.settings/org.eclipse.jdt.ui.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
cleanup.add_default_serial_version_id=false
cleanup.add_generated_serial_version_id=true
cleanup.add_missing_annotations=true
cleanup.add_missing_deprecated_annotations=true
cleanup.add_missing_methods=false
cleanup.add_missing_nls_tags=false
cleanup.add_missing_override_annotations=true
cleanup.add_missing_override_annotations_interface_methods=true
cleanup.add_serial_version_id=true
cleanup.always_use_blocks=false
cleanup.always_use_parentheses_in_expressions=true
cleanup.always_use_this_for_non_static_field_access=true
cleanup.always_use_this_for_non_static_method_access=false
cleanup.convert_functional_interfaces=false
cleanup.convert_to_enhanced_for_loop=false
cleanup.correct_indentation=true
cleanup.format_source_code=true
cleanup.format_source_code_changes_only=false
cleanup.insert_inferred_type_arguments=false
cleanup.make_local_variable_final=true
cleanup.make_parameters_final=false
cleanup.make_private_fields_final=true
cleanup.make_type_abstract_if_missing_method=false
cleanup.make_variable_declarations_final=false
cleanup.never_use_blocks=false
cleanup.never_use_parentheses_in_expressions=false
cleanup.organize_imports=true
cleanup.qualify_static_field_accesses_with_declaring_class=false
cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
cleanup.qualify_static_member_accesses_with_declaring_class=true
cleanup.qualify_static_method_accesses_with_declaring_class=false
cleanup.remove_private_constructors=true
cleanup.remove_redundant_type_arguments=true
cleanup.remove_trailing_whitespaces=true
cleanup.remove_trailing_whitespaces_all=false
cleanup.remove_trailing_whitespaces_ignore_empty=true
cleanup.remove_unnecessary_casts=true
cleanup.remove_unnecessary_nls_tags=true
cleanup.remove_unused_imports=true
cleanup.remove_unused_local_variables=false
cleanup.remove_unused_private_fields=true
cleanup.remove_unused_private_members=false
cleanup.remove_unused_private_methods=true
cleanup.remove_unused_private_types=true
cleanup.sort_members=false
cleanup.sort_members_all=false
cleanup.use_anonymous_class_creation=false
cleanup.use_blocks=true
cleanup.use_blocks_only_for_return_and_throw=true
cleanup.use_lambda=true
cleanup.use_parentheses_in_expressions=false
cleanup.use_this_for_non_static_field_access=true
cleanup.use_this_for_non_static_field_access_only_if_necessary=false
cleanup.use_this_for_non_static_method_access=true
cleanup.use_this_for_non_static_method_access_only_if_necessary=true
cleanup_profile=_Amy-CleanUp
cleanup_settings_version=2
eclipse.preferences.version=1
formatter_profile=_Amy-Formatter
formatter_settings_version=13
org.eclipse.jdt.ui.ignorelowercasenames=true
org.eclipse.jdt.ui.importorder=java;javax;org;com;
org.eclipse.jdt.ui.javadoc=true
org.eclipse.jdt.ui.ondemandthreshold=5
org.eclipse.jdt.ui.staticondemandthreshold=1
org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="false" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\n * Get's {@link \#${field} ${bare_field_name}}\n * @return ${bare_field_name}\n */</template><template autoinsert\="false" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\n * Set's {@link \#${field} ${bare_field_name}}\n * @param ${param} ${bare_field_name}\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\n * ${tags}\n */</template><template autoinsert\="false" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/*\n * This source file is part of the Amy open source project.\n * For more information see github.com/AmyAssist\n * \n * Copyright (c) 2018 the Amy project authors.\n *\n * SPDX-License-Identifier\: Apache-2.0\n * \n * Licensed under the Apache License, Version 2.0 (the "License");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at \n * \n * http\://www.apache.org/licenses/LICENSE-2.0\n * \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an "AS IS" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * For more information see notice.md\n */\n</template><template autoinsert\="false" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\n * TODO\: Description\n * @author\n * ${tags}\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\n * \n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\n * ${tags}\n */</template><template autoinsert\="false" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment">/**\n * ${see_to_overridden}\n */</template><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\n * ${tags}\n * ${see_to_target}\n */</template><template autoinsert\="true" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\n${package_declaration}\n\n${typecomment}\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated method stub\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="false" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return this.${field};</template><template autoinsert\="false" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates>
4 changes: 4 additions & 0 deletions chat-socket/.settings/org.eclipse.m2e.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1
57 changes: 57 additions & 0 deletions chat-socket/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<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">
<modelVersion>4.0.0</modelVersion>
<artifactId>amy-chat-socket</artifactId>
<name>Amy chat socket</name>
<parent>
<groupId>de.unistuttgart.iaas.amyassist</groupId>
<artifactId>amy</artifactId>
<version>0.6.0</version>
<relativePath>../pom.xml</relativePath>
</parent>
<dependencies>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>de.unistuttgart.iaas.amyassist</groupId>
<artifactId>amy-natlang-api</artifactId>
</dependency>
<dependency>
<groupId>de.unistuttgart.iaas.amyassist</groupId>
<artifactId>amy-di-api</artifactId>
</dependency>
<dependency>
<groupId>de.unistuttgart.iaas.amyassist</groupId>
<artifactId>amy-api</artifactId>
</dependency>
<dependency>
<groupId>org.java-websocket</groupId>
<artifactId>Java-WebSocket</artifactId>
<version>1.3.9</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.8.10</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.8.10</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.module</groupId>
<artifactId>jackson-module-jaxb-annotations</artifactId>
<version>2.9.5</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
</dependency>
</dependencies>
<description>Socket for chat communication</description>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/*
* This source file is part of the Amy open source project.
* For more information see github.com/AmyAssist
*
* Copyright (c) 2018 the Amy project authors.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* For more information see notice.md
*/

package de.unistuttgart.iaas.amyassist.amy.socket;

import de.unistuttgart.iaas.amyassist.amy.core.configuration.ConfigurationManager;
import de.unistuttgart.iaas.amyassist.amy.core.di.annotation.Reference;
import de.unistuttgart.iaas.amyassist.amy.core.di.annotation.Service;

import java.util.Properties;

/**
* Config helper class for websocket server
*
* @author Benno Krauß
*/
@Service
public class ChatConfig {
/** The name of the config used by this class */
private static final String CONFIG_NAME = "socket.config";
/** The name of the property, which specifies the port */
static final String PROPERTY_PORT = "webSocketPort";
/** The name of the property which specifies the websocket endpoint URL */
static final String WEBSOCKET_URL = "webSocketURL";

@Reference
private ConfigurationManager configurationManager;

String get(String key) {
Properties conf = this.configurationManager.getConfigurationWithDefaults(CONFIG_NAME);
return conf.getProperty(key);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
/*
* This source file is part of the Amy open source project.
* For more information see github.com/AmyAssist
*
* Copyright (c) 2018 the Amy project authors.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* For more information see notice.md
*/

package de.unistuttgart.iaas.amyassist.amy.socket;

import de.unistuttgart.iaas.amyassist.amy.core.di.annotation.Reference;
import de.unistuttgart.iaas.amyassist.amy.core.di.annotation.Service;
import de.unistuttgart.iaas.amyassist.amy.core.natlang.DialogHandler;
import de.unistuttgart.iaas.amyassist.amy.core.service.RunnableService;
import org.slf4j.Logger;

import java.io.IOException;

import static de.unistuttgart.iaas.amyassist.amy.socket.ChatConfig.PROPERTY_PORT;

/**
* the class running the server socket for the chat
*
* @author Christian Bräuner
*/
@Service(ChatServer.class)
public class ChatServer implements RunnableService {

@Reference
private ChatConfig config;

@Reference
private Logger logger;

@Reference
private DialogHandler handler;

private ChatWebSocket socket;


/**
* @see de.unistuttgart.iaas.amyassist.amy.core.service.RunnableService#start()
*/
@Override
public void start() {

int port = Integer.parseInt(config.get(PROPERTY_PORT));
this.socket = new ChatWebSocket(port, this.handler);
this.socket.start();

}

/**
* @see de.unistuttgart.iaas.amyassist.amy.core.service.RunnableService#stop()
*/
@Override
public void stop() {
try {
this.socket.stop();
} catch (IOException e) {
this.logger.error("Can't close chatserver", e);
} catch (InterruptedException e) {
this.logger.error("Interrupt while stoping", e);
Thread.currentThread().interrupt();
}
this.logger.info("ChatServer shutdown");
}

}
Loading

0 comments on commit 2ca5a5b

Please sign in to comment.