Удалил лишние модули

This commit is contained in:
Mark Struchkov 2019-01-09 21:38:06 +03:00
parent b757287bea
commit d9a7e09e22
31 changed files with 51 additions and 480 deletions

View File

@ -1,65 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<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">
<parent>
<artifactId>consultant</artifactId>
<groupId>org.sadtech</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>consultant-core</artifactId>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>8</source>
<target>8</target>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<persistence.ver>1.0.2</persistence.ver>
<lombok.ver>1.18.4</lombok.ver>
<log4j>1.2.17</log4j>
<spring.data>2.1.3.RELEASE</spring.data>
</properties>
<dependencies>
<dependency>
<groupId>javax.persistence</groupId>
<artifactId>persistence-api</artifactId>
<version>${persistence.ver}</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.ver}</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>${log4j}</version>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-jpa</artifactId>
<version>${spring.data}</version>
</dependency>
<dependency>
<groupId>javax.persistence</groupId>
<artifactId>javax.persistence-api</artifactId>
<version>2.2</version>
</dependency>
</dependencies>
</project>

View File

@ -1,181 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<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">
<parent>
<artifactId>consultant</artifactId>
<groupId>org.sadtech</groupId>
<version>0.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>ru.fit-elit</groupId>
<artifactId>consultant</artifactId>
<version>0.1-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>7</source>
<target>7</target>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<vk.api.ver>0.5.13-SNAPSHOT</vk.api.ver>
<spring.core>5.1.3.RELEASE</spring.core>
<spring.context>5.1.3.RELEASE</spring.context>
<spring.web>5.1.3.RELEASE</spring.web>
<spring.webmvc>5.1.3.RELEASE</spring.webmvc>
<spring.context>5.1.3.RELEASE</spring.context>
<spring.context>5.1.3.RELEASE</spring.context>
<spring.data>2.1.3.RELEASE</spring.data>
<javax.servlet>3.1.0</javax.servlet>
<javax.persistance>2.2</javax.persistance>
<hibernate.entitymanager>5.4.0.Final</hibernate.entitymanager>
<hibernate.core>5.2.10.Final</hibernate.core>
<mysql.connector>8.0.13</mysql.connector>
<lombok>1.18.4</lombok>
<log4j>1.2.17</log4j>
<json>20180813</json>
<jetty.util>6.1.25</jetty.util>
</properties>
<dependencies>
<dependency>
<groupId>com.vk.api</groupId>
<artifactId>sdk</artifactId>
<version>${vk.api.ver}</version>
</dependency>
<dependency>
<groupId>org.sadtech</groupId>
<artifactId>vk-bot</artifactId>
<version>0.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok}</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>${log4j}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring.core}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.context}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
<version>${spring.context}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${spring.web}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.webmvc}</version>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-jpa</artifactId>
<version>${spring.data}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>5.1.3.RELEASE</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.5</version>
</dependency>
<dependency>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-util</artifactId>
<version>${jetty.util}</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>${json}</version>
</dependency>
<dependency>
<groupId>javax.persistence</groupId>
<artifactId>javax.persistence-api</artifactId>
<version>${javax.persistance}</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>${mysql.connector}</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>${hibernate.entitymanager}</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>${hibernate.core}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-nop</artifactId>
<version>1.7.13</version>
</dependency>
<dependency>
<groupId>org.sadtech</groupId>
<artifactId>consultant-core</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.jetbrains</groupId>
<artifactId>annotations-java5</artifactId>
<version>16.0.2</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>

View File

@ -1,27 +0,0 @@
package ru.fitelit.consultant;
import lombok.extern.log4j.Log4j;
import org.sadtech.consultant.processing.MessageHandler;
import org.sadtech.vkbot.core.handlers.Handled;
import org.sadtech.vkbot.core.listener.EventListenable;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import ru.fitelit.consultant.config.SpringConfigVk;
@Log4j
public class Main {
public static void main(String[] args) throws Exception {
Main main = new Main();
main.run();
}
public void run() throws Exception {
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(SpringConfigVk.class);
EventListenable eventListener = context.getBean(EventListenable.class);
eventListener.listen();
Handled dispatcherHandler = context.getBean(Handled.class);
dispatcherHandler.sortAndSend();
MessageHandler messageHandler = context.getBean(MessageHandler.class);
messageHandler.processing();
}
}

View File

@ -1,76 +0,0 @@
package ru.fitelit.consultant.config;
import org.hibernate.jpa.HibernatePersistenceProvider;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.jdbc.datasource.DriverManagerDataSource;
import org.springframework.orm.jpa.JpaTransactionManager;
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import javax.sql.DataSource;
import java.util.Properties;
@Configuration
@EnableTransactionManagement
@ComponentScan("org.sadtech.consultant.database.service")
@EnableJpaRepositories("org.sadtech.consultant.database.repository")
public class DataConfig {
@Value("${db.driver}")
private String PROPERTY_NAME_DATABASE_DRIVER;
@Value("${db.url}")
private String PROPERTY_NAME_DATABASE_URL;
@Value("${db.username}")
private String PROPERTY_NAME_DATABASE_USERNAME;
@Value("${db.password}")
private String PROPERTY_NAME_DATABASE_PASSWORD;
@Value("${db.hibernate.dialect}")
private String PROPERTY_NAME_HIBERNATE_DIALECT;
@Value("${db.hibernate.show_sql}")
private String PROPERTY_NAME_HIBERNATE_SHOW_SQL;
@Value("${db.entitymanager.packages.to.scan}")
private String PROPERTY_NAME_ENTITYMANAGER_PACKAGES_TO_SCAN;
@Value("${db.hibernate.hbm2ddl.auto}")
private String PROPERTY_NAME_HIBERNATE_HBM2DDL_AUTO;
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
LocalContainerEntityManagerFactoryBean entityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean();
entityManagerFactoryBean.setDataSource(dataSource());
entityManagerFactoryBean.setPersistenceProviderClass(HibernatePersistenceProvider.class);
entityManagerFactoryBean.setPackagesToScan(PROPERTY_NAME_ENTITYMANAGER_PACKAGES_TO_SCAN);
entityManagerFactoryBean.setJpaProperties(hibernateProp());
return entityManagerFactoryBean;
}
@Bean
public JpaTransactionManager transactionManager() {
JpaTransactionManager transactionManager = new JpaTransactionManager();
transactionManager.setEntityManagerFactory(entityManagerFactory().getObject());
return transactionManager;
}
@Bean
public DataSource dataSource() {
DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName(PROPERTY_NAME_DATABASE_DRIVER);
dataSource.setUrl(PROPERTY_NAME_DATABASE_URL);
dataSource.setUsername(PROPERTY_NAME_DATABASE_USERNAME);
dataSource.setPassword(PROPERTY_NAME_DATABASE_PASSWORD);
return dataSource;
}
private Properties hibernateProp() {
Properties properties = new Properties();
properties.put("hibernate.dialect", PROPERTY_NAME_HIBERNATE_DIALECT);
properties.put("hibernate.show_sql", PROPERTY_NAME_HIBERNATE_SHOW_SQL);
properties.put("hibernate.hbm2ddl.auto", PROPERTY_NAME_HIBERNATE_HBM2DDL_AUTO);
return properties;
}
}

View File

@ -1,90 +0,0 @@
package ru.fitelit.consultant.config;
import com.vk.api.sdk.client.TransportClient;
import com.vk.api.sdk.client.VkApiClient;
import com.vk.api.sdk.client.actors.GroupActor;
import com.vk.api.sdk.client.actors.ServiceActor;
import com.vk.api.sdk.exceptions.ApiException;
import com.vk.api.sdk.exceptions.ClientException;
import com.vk.api.sdk.httpclient.HttpTransportClient;
import com.vk.api.sdk.objects.groups.responses.GetLongPollServerResponse;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.*;
import org.springframework.core.task.TaskExecutor;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.concurrent.ConcurrentTaskExecutor;
import java.util.concurrent.Executors;
@Configuration
@EnableAsync
@PropertySource("classpath:config.properties")
@Import({DataConfig.class})
@ComponentScan({"ru.fitelit.consultant", "org.sadtech.consultant.processing", "org.sadtech.vkbot.core"})
public class SpringConfigVk {
@Value("${vk.groupID}")
private String groupId;
@Value("${vk.appID}")
private String appID;
@Value("${vk.secretKey}")
private String secretKey;
@Value("${vk.redirectURL}")
private String redirectURL;
@Value("${vk.code}")
private String code;
@Value("${vk.token}")
private String token;
@Value("${vk.service.token}")
private String serviceToken;
@Bean
public TransportClient transportClient() {
return HttpTransportClient.getInstance();
}
@Bean
public VkApiClient vkApiClient() {
VkApiClient vk = new VkApiClient(transportClient());
return vk;
}
@Bean
public GroupActor groupActor() {
GroupActor actor = new GroupActor(new Integer(groupId), token);
return actor;
}
@Bean
public ServiceActor serviceActor() {
ServiceActor actor = new ServiceActor(new Integer(appID), serviceToken);
return actor;
}
@Bean
public GetLongPollServerResponse GroupsGetLongPollServerQuery() {
GetLongPollServerResponse getLongPollServerResponse = null;
try {
getLongPollServerResponse = vkApiClient().groups().getLongPollServer(groupActor()).execute();
} catch (ApiException | ClientException e) {
e.printStackTrace();
}
return getLongPollServerResponse;
}
@Bean
public TaskExecutor taskExecutor() {
return new ConcurrentTaskExecutor(Executors.newFixedThreadPool(5));
}
}

View File

@ -1,32 +0,0 @@
//package org.sadtech.vkbot.config;
//
//import com.vk.api.sdk.exceptions.ApiException;
//import com.vk.api.sdk.exceptions.ClientException;
//import EventListenable;
//import Observable;
//import EventListenerVk;
//import org.springframework.context.annotation.ComponentScan;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.web.WebApplicationInitializer;
//import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;
//import org.springframework.web.servlet.DispatcherServlet;
//
//import javax.servlet.ServletContext;
//import javax.servlet.ServletException;
//
//@Configuration
//public class WebConfig implements WebApplicationInitializer {
//
// @Override
// public void onStartup(ServletContext servletContext) throws ServletException {
// AnnotationConfigWebApplicationContext context = new AnnotationConfigWebApplicationContext();
// context.register(SpringConfigVk.class, DataConfig.class, WebConfig.class);
//
//// context.setServletContext(servletContext);
////
////
//// ServletRegistration.Dynamic dispatcher = servletContext.addServlet("dispatcher", new DispatcherServlet(context));
//// dispatcher.setLoadOnStartup(1);
//// dispatcher.addMapping("/");
// }
//}

60
pom.xml
View File

@ -4,15 +4,57 @@
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.sadtech</groupId> <artifactId>consultant-core</artifactId>
<artifactId>consultant</artifactId> <build>
<packaging>pom</packaging> <plugins>
<version>0.1-SNAPSHOT</version> <plugin>
<modules> <groupId>org.apache.maven.plugins</groupId>
<module>vk-bot</module> <artifactId>maven-compiler-plugin</artifactId>
<module>core</module> <configuration>
<module>fit-elit-consultant</module> <source>8</source>
</modules> <target>8</target>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<persistence.ver>1.0.2</persistence.ver>
<lombok.ver>1.18.4</lombok.ver>
<log4j>1.2.17</log4j>
<spring.data>2.1.3.RELEASE</spring.data>
</properties>
<dependencies>
<dependency>
<groupId>javax.persistence</groupId>
<artifactId>persistence-api</artifactId>
<version>${persistence.ver}</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.ver}</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>${log4j}</version>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-jpa</artifactId>
<version>${spring.data}</version>
</dependency>
<dependency>
<groupId>javax.persistence</groupId>
<artifactId>javax.persistence-api</artifactId>
<version>2.2</version>
</dependency>
</dependencies>
</project> </project>