This repository has been archived by the owner on Mar 5, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #525 from AmyAssist/dev
Sprint 6 and 7
- Loading branch information
Showing
288 changed files
with
14,427 additions
and
3,448 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
activeProfiles= | ||
eclipse.preferences.version=1 | ||
resolveWorkspaceProjects=true | ||
version=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
53 changes: 53 additions & 0 deletions
53
chat-socket/src/main/java/de/unistuttgart/iaas/amyassist/amy/socket/ChatConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |
84 changes: 84 additions & 0 deletions
84
chat-socket/src/main/java/de/unistuttgart/iaas/amyassist/amy/socket/ChatServer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"); | ||
} | ||
|
||
} |
Oops, something went wrong.