This commit is contained in:
geek 2018-04-24 18:03:58 +09:00
parent 8ca180c1eb
commit eba59ee47e
14 changed files with 459 additions and 1 deletions

View File

@ -0,0 +1,11 @@
package com.loafle.overflow.core.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target({ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
public @interface ProbeAPI {
}

View File

@ -0,0 +1,17 @@
package com.loafle.overflow.core.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import org.springframework.core.annotation.AliasFor;
import org.springframework.stereotype.Component;
@Target({ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Component
public @interface RPCService {
@AliasFor(annotation = Component.class)
String value() default "";
}

View File

@ -0,0 +1,11 @@
package com.loafle.overflow.core.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target({ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
public @interface WebappAPI {
}

View File

@ -0,0 +1,7 @@
package com.loafle.overflow.core.exception;
public class OverflowException extends Exception {
public OverflowException(String s, Throwable throwable) {
super(s, throwable);
}
}

View File

@ -0,0 +1,11 @@
package com.loafle.overflow.core.interfaces;
/**
* Service
*/
public interface Service {
void initService() throws Exception;
void startService() throws Exception;
void stopService();
void destroyService();
}

View File

@ -0,0 +1,108 @@
package com.loafle.overflow.core.model;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* Created by geek on 18. 1. 3.
*/
public class Mail {
private String mailFrom;
private String mailTo;
private String mailCc;
private String mailBcc;
private String mailSubject;
private String mailContent;
private String contentType;
private List< Object > attachments;
private Map< String, Object > model;
public Mail() {
contentType = "text/plain";
}
public String getContentType() {
return contentType;
}
public void setContentType(String contentType) {
this.contentType = contentType;
}
public String getMailBcc() {
return mailBcc;
}
public void setMailBcc(String mailBcc) {
this.mailBcc = mailBcc;
}
public String getMailCc() {
return mailCc;
}
public void setMailCc(String mailCc) {
this.mailCc = mailCc;
}
public String getMailFrom() {
return mailFrom;
}
public void setMailFrom(String mailFrom) {
this.mailFrom = mailFrom;
}
public String getMailSubject() {
return mailSubject;
}
public void setMailSubject(String mailSubject) {
this.mailSubject = mailSubject;
}
public String getMailTo() {
return mailTo;
}
public void setMailTo(String mailTo) {
this.mailTo = mailTo;
}
public Date getMailSendDate() {
return new Date();
}
public String getMailContent() {
return mailContent;
}
public void setMailContent(String mailContent) {
this.mailContent = mailContent;
}
public List< Object > getAttachments() {
return attachments;
}
public void setAttachments(List < Object > attachments) {
this.attachments = attachments;
}
public Map< String, Object > getModel() {
return model;
}
public void setModel(Map < String, Object > model) {
this.model = model;
}
}

View File

@ -0,0 +1,44 @@
package com.loafle.overflow.core.model;
/**
* Created by insanity on 17. 8. 25.
*/
public class PageParams {
private int pageNo;
private int countPerPage;
private String sortCol;
private String sortDirection;
public int getPageNo() {
return pageNo;
}
public void setPageNo(int pageNo) {
this.pageNo = pageNo;
}
public int getCountPerPage() {
return countPerPage;
}
public void setCountPerPage(int countPerPage) {
this.countPerPage = countPerPage;
}
public String getSortCol() {
return sortCol;
}
public void setSortCol(String sortCol) {
this.sortCol = sortCol;
}
public String getSortDirection() {
return sortDirection;
}
public void setSortDirection(String sortDirection) {
this.sortDirection = sortDirection;
}
}

View File

@ -0,0 +1,122 @@
package com.loafle.overflow.core.model;
import java.util.ArrayList;
import java.util.List;
public class PublishMessage {
private TargetType targetType;
private List<String> targets;
private PublishMessageBody message;
public void setTargetType(TargetType targetType) {
this.targetType = targetType;
}
public TargetType getTargetType() {
return this.targetType;
}
public void setTargets(List<String> targets) {
this.targets = targets;
}
public void addTarget(String target) {
if (null == targets) {
targets = new ArrayList<>();
}
targets.add(target);
}
public List<String> getTargets() {
return targets;
}
public void setMessage(PublishMessageBody message) {
this.message = message;
}
public PublishMessageBody getMessage() {
return message;
}
public static enum TargetType {
MEMBER_SESSION("MEMBER_SESSION"),
MEMBER("MEMBER"),
PROBE("PROBE");
final private String name;
private TargetType(String name) {
this.name = name;
}
public String toString() {
return name;
}
}
public static class PublishMessageBody {
private String jsonrpc = "2.0";
private PublishMessageBodyNotification result;
public PublishMessageBody() {
this.result = new PublishMessageBodyNotification();
}
public PublishMessageBody(String method) {
this();
this.result.setMethod(method);
}
public PublishMessageBody(String method, List<String> params) {
this(method);
this.result.setParams(params);
}
public String getJsonrpc() {
return jsonrpc;
}
public void setJsonrpc(String jsonrpc) {
this.jsonrpc = jsonrpc;
}
public PublishMessageBodyNotification getResult() {
return result;
}
public void setResult(PublishMessageBodyNotification result) {
this.result = result;
}
}
public static class PublishMessageBodyNotification {
private String method;
private List<String> params;
public String getMethod() {
return method;
}
public void setMethod(String method) {
this.method = method;
}
public List<String> getParams() {
return params;
}
public void setParams(List<String> params) {
this.params = params;
}
public void addParams(String param) {
if (null == this.params) {
this.params = new ArrayList<>();
}
this.params.add(param);
}
}
}

View File

@ -0,0 +1,16 @@
package com.loafle.overflow.core.type;
/**
* Created by snoop on 17. 6. 27.
*/
public enum CryptoType {
TLS("TLS");
private String stringValue;
CryptoType(String string) {stringValue = string;}
@Override
public String toString() {
return stringValue;
}
}

View File

@ -0,0 +1,18 @@
package com.loafle.overflow.core.type;
/**
* Created by snoop on 17. 6. 27.
*/
public enum PortType {
TCP("TCP"),
UDP("UDP"),
TLS("TLS");
private String stringValue;
PortType(String string) {stringValue = string;}
@Override
public String toString() {
return stringValue;
}
}

View File

@ -0,0 +1,63 @@
package com.loafle.overflow.model.discovery;
import java.util.List;
/**
* Created by snoop on 17. 9. 29.
*/
public class DiscoveryStartInfo {
String startIp;
String endIP;
String excludeIp;
String startPort;
String endPort;
List<String> services;
public String getStartIp() {
return startIp;
}
public void setStartIp(String startIp) {
this.startIp = startIp;
}
public String getEndIP() {
return endIP;
}
public void setEndIP(String endIP) {
this.endIP = endIP;
}
public String getExcludeIp() {
return excludeIp;
}
public void setExcludeIp(String excludeIp) {
this.excludeIp = excludeIp;
}
public String getStartPort() {
return startPort;
}
public void setStartPort(String startPort) {
this.startPort = startPort;
}
public String getEndPort() {
return endPort;
}
public void setEndPort(String endPort) {
this.endPort = endPort;
}
public List<String> getServices() {
return services;
}
public void setServices(List<String> services) {
this.services = services;
}
}

View File

@ -0,0 +1,18 @@
package com.loafle.overflow.model.discovery.type;
/**
* Created by snoop on 17. 6. 27.
*/
public enum PortType {
TCP("TCP"),
UDP("UDP"),
TLS("TLS");
private String stringValue;
PortType(String string) {stringValue = string;}
@Override
public String toString() {
return stringValue;
}
}

View File

@ -1,7 +1,19 @@
package com.loafle.overflow.service.central.apikey; package com.loafle.overflow.service.central.apikey;
import com.loafle.overflow.core.annotation.WebappAPI;
import com.loafle.overflow.core.exception.OverflowException;
import com.loafle.overflow.model.apikey.ApiKey;
import com.loafle.overflow.model.domain.Domain;
/** /**
* Created by geek on 17. 11. 7. * Created by geek on 17. 11. 7.
*/ */
public interface ApiKeyService { public interface ApiKeyService {
@WebappAPI
ApiKey regist(ApiKey apiKey) throws OverflowException;
@WebappAPI
ApiKey readByDomain(Domain domain) throws OverflowException;
boolean check(String apiKey) throws OverflowException;
@WebappAPI
ApiKey readByApiKey(String apiKey) throws OverflowException;
} }

View File

@ -8,5 +8,5 @@ import com.loafle.overflow.model.infra.InfraMachine;
*/ */
public interface InfraMachineService { public interface InfraMachineService {
InfraMachine regist(InfraMachine infraMachine) throws OverflowException; InfraMachine regist(InfraMachine infraMachine) throws OverflowException;
InfraMachine read(long id); InfraMachine read(long id) throws OverflowException;
} }