new version provision
This commit is contained in:
@@ -67,8 +67,8 @@ public class ApplicationConfig {
|
||||
@Value("${server.servlet.session.timeout:1800}")
|
||||
private int sessionTimeout;
|
||||
|
||||
@Value("${maxkey.server.message.queue:none}")
|
||||
private String messageQueue;
|
||||
@Value("${maxkey.server.provision:false}")
|
||||
private boolean provision;
|
||||
|
||||
@Value("${maxkey.notices.visible:false}")
|
||||
private boolean noticesVisible;
|
||||
@@ -192,21 +192,21 @@ public class ApplicationConfig {
|
||||
this.defaultUri = defaultUri;
|
||||
}
|
||||
|
||||
public String getMessageQueue() {
|
||||
return messageQueue;
|
||||
}
|
||||
|
||||
public boolean isMessageQueueSupport() {
|
||||
if(StringUtils.isBlank(messageQueue)||messageQueue.equalsIgnoreCase("none")) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public void setMessageQueue(String messageQueue) {
|
||||
this.messageQueue = messageQueue;
|
||||
public boolean isProvision() {
|
||||
return provision;
|
||||
}
|
||||
|
||||
public void setProvision(boolean provision) {
|
||||
this.provision = provision;
|
||||
}
|
||||
|
||||
public boolean isProvisionSupport() {
|
||||
if(provision) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public String getMgtUri() {
|
||||
return mgtUri;
|
||||
}
|
||||
@@ -262,8 +262,8 @@ public class ApplicationConfig {
|
||||
builder.append(mgtUri);
|
||||
builder.append(", port=");
|
||||
builder.append(port);
|
||||
builder.append(", kafkaSupport=");
|
||||
builder.append(messageQueue);
|
||||
builder.append(", provision=");
|
||||
builder.append(provision);
|
||||
builder.append(", maxKeyUri=");
|
||||
builder.append(authzUri);
|
||||
builder.append("]");
|
||||
|
||||
@@ -0,0 +1,210 @@
|
||||
/*
|
||||
* Copyright [2021] [MaxKey of copyright http://www.maxkey.top]
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package org.maxkey.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
import org.apache.mybatis.jpa.persistence.JpaBaseEntity;
|
||||
import org.maxkey.pretty.impl.JsonPretty;
|
||||
|
||||
@Entity
|
||||
@Table(name = "MXK_CONNECTORS")
|
||||
public class Connectors extends JpaBaseEntity implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 4660258495864814777L;
|
||||
@Id
|
||||
@Column
|
||||
@GeneratedValue(strategy = GenerationType.AUTO, generator = "snowflakeid")
|
||||
String id;
|
||||
@Column
|
||||
String connName;
|
||||
@Column
|
||||
String scheduler;
|
||||
@Column
|
||||
int justInTime;
|
||||
@Column
|
||||
String providerUrl;
|
||||
@Column
|
||||
String principal;
|
||||
@Column
|
||||
String credentials;
|
||||
@Column
|
||||
String filters;
|
||||
@Column
|
||||
String description;
|
||||
@Column
|
||||
String createdBy;
|
||||
@Column
|
||||
String createdDate;
|
||||
@Column
|
||||
String modifiedBy;
|
||||
@Column
|
||||
String modifiedDate;
|
||||
@Column
|
||||
String status;
|
||||
|
||||
@Column
|
||||
private String instId;
|
||||
|
||||
private String instName;
|
||||
|
||||
public Connectors() {
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getConnName() {
|
||||
return connName;
|
||||
}
|
||||
|
||||
public void setConnName(String connName) {
|
||||
this.connName = connName;
|
||||
}
|
||||
|
||||
public int getJustInTime() {
|
||||
return justInTime;
|
||||
}
|
||||
|
||||
public void setJustInTime(int justInTime) {
|
||||
this.justInTime = justInTime;
|
||||
}
|
||||
|
||||
public String getScheduler() {
|
||||
return scheduler;
|
||||
}
|
||||
|
||||
public void setScheduler(String scheduler) {
|
||||
this.scheduler = scheduler;
|
||||
}
|
||||
|
||||
public String getProviderUrl() {
|
||||
return providerUrl;
|
||||
}
|
||||
|
||||
public void setProviderUrl(String providerUrl) {
|
||||
this.providerUrl = providerUrl;
|
||||
}
|
||||
|
||||
public String getPrincipal() {
|
||||
return principal;
|
||||
}
|
||||
|
||||
public void setPrincipal(String principal) {
|
||||
this.principal = principal;
|
||||
}
|
||||
|
||||
public String getCredentials() {
|
||||
return credentials;
|
||||
}
|
||||
|
||||
public void setCredentials(String credentials) {
|
||||
this.credentials = credentials;
|
||||
}
|
||||
|
||||
public String getFilters() {
|
||||
return filters;
|
||||
}
|
||||
|
||||
public void setFilters(String filters) {
|
||||
this.filters = filters;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getCreatedBy() {
|
||||
return createdBy;
|
||||
}
|
||||
|
||||
public void setCreatedBy(String createdBy) {
|
||||
this.createdBy = createdBy;
|
||||
}
|
||||
|
||||
public String getCreatedDate() {
|
||||
return createdDate;
|
||||
}
|
||||
|
||||
public void setCreatedDate(String createdDate) {
|
||||
this.createdDate = createdDate;
|
||||
}
|
||||
|
||||
public String getModifiedBy() {
|
||||
return modifiedBy;
|
||||
}
|
||||
|
||||
public void setModifiedBy(String modifiedBy) {
|
||||
this.modifiedBy = modifiedBy;
|
||||
}
|
||||
|
||||
public String getModifiedDate() {
|
||||
return modifiedDate;
|
||||
}
|
||||
|
||||
public void setModifiedDate(String modifiedDate) {
|
||||
this.modifiedDate = modifiedDate;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getInstId() {
|
||||
return instId;
|
||||
}
|
||||
|
||||
public void setInstId(String instId) {
|
||||
this.instId = instId;
|
||||
}
|
||||
|
||||
public String getInstName() {
|
||||
return instName;
|
||||
}
|
||||
|
||||
public void setInstName(String instName) {
|
||||
this.instName = instName;
|
||||
}
|
||||
|
||||
public Connectors(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new JsonPretty().format(this);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -13,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
package org.maxkey.entity;
|
||||
|
||||
@@ -29,209 +28,177 @@ import javax.persistence.Table;
|
||||
import org.apache.mybatis.jpa.persistence.JpaBaseEntity;
|
||||
|
||||
@Entity
|
||||
@Table(name = "MXK_HISTORY_CONNECTOR")
|
||||
public class HistoryConnector extends JpaBaseEntity implements Serializable{
|
||||
@Table(name = "MXK_HISTORY_CONNECTOR")
|
||||
public class HistoryConnector extends JpaBaseEntity implements Serializable {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 3465459057253994386L;
|
||||
|
||||
@Id
|
||||
@Column
|
||||
@GeneratedValue(strategy = GenerationType.AUTO, generator = "snowflakeid")
|
||||
String id;
|
||||
|
||||
@Column
|
||||
String conName;
|
||||
|
||||
@Column
|
||||
String topic;
|
||||
|
||||
@Column
|
||||
String actionType;
|
||||
|
||||
@Column
|
||||
String sourceId;
|
||||
|
||||
@Column
|
||||
String sourceName;
|
||||
|
||||
@Column
|
||||
String objectId;
|
||||
|
||||
@Column
|
||||
String objectName;
|
||||
|
||||
@Column
|
||||
String description;
|
||||
|
||||
String syncTime;
|
||||
|
||||
@Column
|
||||
String result;
|
||||
|
||||
String startDate;
|
||||
|
||||
String endDate;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 3465459057253994386L;
|
||||
|
||||
@Id
|
||||
@Column
|
||||
@GeneratedValue(strategy=GenerationType.AUTO,generator="snowflakeid")
|
||||
String id;
|
||||
|
||||
@Column
|
||||
String conName;
|
||||
|
||||
@Column
|
||||
String conType;
|
||||
|
||||
@Column
|
||||
String conAction;
|
||||
|
||||
@Column
|
||||
String sourceId;
|
||||
|
||||
@Column
|
||||
String sourceName;
|
||||
|
||||
@Column
|
||||
String objectId;
|
||||
|
||||
@Column
|
||||
String objectName;
|
||||
|
||||
@Column
|
||||
String description;
|
||||
|
||||
|
||||
String syncTime;
|
||||
|
||||
@Column
|
||||
String result;
|
||||
|
||||
String startDate;
|
||||
|
||||
String endDate;
|
||||
|
||||
@Column
|
||||
private String instId;
|
||||
|
||||
private String instName;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
|
||||
public String getConName() {
|
||||
return conName;
|
||||
}
|
||||
|
||||
|
||||
public void setConName(String conName) {
|
||||
this.conName = conName;
|
||||
}
|
||||
|
||||
|
||||
public String getConType() {
|
||||
return conType;
|
||||
}
|
||||
|
||||
|
||||
public void setConType(String conType) {
|
||||
this.conType = conType;
|
||||
}
|
||||
|
||||
|
||||
public String getSourceId() {
|
||||
return sourceId;
|
||||
}
|
||||
|
||||
|
||||
public void setSourceId(String sourceId) {
|
||||
this.sourceId = sourceId;
|
||||
}
|
||||
|
||||
|
||||
public String getSourceName() {
|
||||
return sourceName;
|
||||
}
|
||||
|
||||
|
||||
public void setSourceName(String sourceName) {
|
||||
this.sourceName = sourceName;
|
||||
}
|
||||
|
||||
|
||||
public String getObjectId() {
|
||||
return objectId;
|
||||
}
|
||||
|
||||
|
||||
public void setObjectId(String objectId) {
|
||||
this.objectId = objectId;
|
||||
}
|
||||
|
||||
|
||||
public String getObjectName() {
|
||||
return objectName;
|
||||
}
|
||||
|
||||
|
||||
public void setObjectName(String objectName) {
|
||||
this.objectName = objectName;
|
||||
}
|
||||
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
|
||||
public String getSyncTime() {
|
||||
return syncTime;
|
||||
}
|
||||
|
||||
|
||||
public void setSyncTime(String syncTime) {
|
||||
this.syncTime = syncTime;
|
||||
}
|
||||
|
||||
|
||||
public String getResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
public void setResult(String result) {
|
||||
this.result = result;
|
||||
}
|
||||
|
||||
|
||||
public String getStartDate() {
|
||||
return startDate;
|
||||
}
|
||||
|
||||
|
||||
public void setStartDate(String startDate) {
|
||||
this.startDate = startDate;
|
||||
}
|
||||
|
||||
|
||||
public String getEndDate() {
|
||||
return endDate;
|
||||
}
|
||||
|
||||
|
||||
public void setEndDate(String endDate) {
|
||||
this.endDate = endDate;
|
||||
}
|
||||
|
||||
|
||||
public String getConAction() {
|
||||
return conAction;
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
|
||||
public void setConAction(String conAction) {
|
||||
this.conAction = conAction;
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getConName() {
|
||||
return conName;
|
||||
}
|
||||
|
||||
public void setConName(String conName) {
|
||||
this.conName = conName;
|
||||
}
|
||||
|
||||
public String getSourceId() {
|
||||
return sourceId;
|
||||
}
|
||||
|
||||
public void setSourceId(String sourceId) {
|
||||
this.sourceId = sourceId;
|
||||
}
|
||||
|
||||
public String getSourceName() {
|
||||
return sourceName;
|
||||
}
|
||||
|
||||
public void setSourceName(String sourceName) {
|
||||
this.sourceName = sourceName;
|
||||
}
|
||||
|
||||
public String getObjectId() {
|
||||
return objectId;
|
||||
}
|
||||
|
||||
public void setObjectId(String objectId) {
|
||||
this.objectId = objectId;
|
||||
}
|
||||
|
||||
public String getObjectName() {
|
||||
return objectName;
|
||||
}
|
||||
|
||||
public void setObjectName(String objectName) {
|
||||
this.objectName = objectName;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getSyncTime() {
|
||||
return syncTime;
|
||||
}
|
||||
|
||||
public void setSyncTime(String syncTime) {
|
||||
this.syncTime = syncTime;
|
||||
}
|
||||
|
||||
public String getResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
public String getTopic() {
|
||||
return topic;
|
||||
}
|
||||
|
||||
public void setTopic(String topic) {
|
||||
this.topic = topic;
|
||||
}
|
||||
|
||||
public String getActionType() {
|
||||
return actionType;
|
||||
}
|
||||
|
||||
public void setActionType(String actionType) {
|
||||
this.actionType = actionType;
|
||||
}
|
||||
|
||||
public void setResult(String result) {
|
||||
this.result = result;
|
||||
}
|
||||
|
||||
public String getStartDate() {
|
||||
return startDate;
|
||||
}
|
||||
|
||||
public void setStartDate(String startDate) {
|
||||
this.startDate = startDate;
|
||||
}
|
||||
|
||||
public String getEndDate() {
|
||||
return endDate;
|
||||
}
|
||||
|
||||
public void setEndDate(String endDate) {
|
||||
this.endDate = endDate;
|
||||
}
|
||||
|
||||
public String getInstId() {
|
||||
return instId;
|
||||
}
|
||||
|
||||
|
||||
public void setInstId(String instId) {
|
||||
this.instId = instId;
|
||||
}
|
||||
|
||||
|
||||
public String getInstName() {
|
||||
return instName;
|
||||
}
|
||||
|
||||
|
||||
public void setInstName(String instName) {
|
||||
this.instName = instName;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
@@ -239,10 +206,10 @@ public class HistoryConnector extends JpaBaseEntity implements Serializable{
|
||||
builder.append(id);
|
||||
builder.append(", conName=");
|
||||
builder.append(conName);
|
||||
builder.append(", conType=");
|
||||
builder.append(conType);
|
||||
builder.append(", conAction=");
|
||||
builder.append(conAction);
|
||||
builder.append(", topic=");
|
||||
builder.append(topic);
|
||||
builder.append(", actionType=");
|
||||
builder.append(actionType);
|
||||
builder.append(", sourceId=");
|
||||
builder.append(sourceId);
|
||||
builder.append(", sourceName=");
|
||||
@@ -261,9 +228,12 @@ public class HistoryConnector extends JpaBaseEntity implements Serializable{
|
||||
builder.append(startDate);
|
||||
builder.append(", endDate=");
|
||||
builder.append(endDate);
|
||||
builder.append(", instId=");
|
||||
builder.append(instId);
|
||||
builder.append(", instName=");
|
||||
builder.append(instName);
|
||||
builder.append("]");
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -156,7 +156,70 @@ public class HttpRequestAdapter {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public String postJson(String url,String jsonString,HashMap<String,String> headers) {
|
||||
// 创建httpClient实例
|
||||
CloseableHttpClient httpClient = HttpClients.createDefault();
|
||||
CloseableHttpResponse httpResponse = null;
|
||||
// 创建httpPost远程连接实例
|
||||
HttpPost httpPost = new HttpPost(url);
|
||||
// 配置请求参数实例
|
||||
RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(35000)// 设置连接主机服务超时时间
|
||||
.setConnectionRequestTimeout(35000)// 设置连接请求超时时间
|
||||
.setSocketTimeout(60000)// 设置读取数据连接超时时间
|
||||
.build();
|
||||
// 为httpPost实例设置配置
|
||||
httpPost.setConfig(requestConfig);
|
||||
// 设置请求头
|
||||
if (null != headers && headers.size() > 0) {
|
||||
Set<Entry<String, String>> entrySet = headers.entrySet();
|
||||
// 循环遍历,获取迭代器
|
||||
Iterator<Entry<String, String>> iterator = entrySet.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
Entry<String, String> mapEntry = iterator.next();
|
||||
_logger.trace("Name " + mapEntry.getKey() + " , Value " +mapEntry.getValue());
|
||||
httpPost.addHeader(mapEntry.getKey(), mapEntry.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
// 封装post请求参数
|
||||
StringEntity stringEntity =new StringEntity(jsonString, "UTF-8");
|
||||
stringEntity.setContentType("application/json");
|
||||
httpPost.setEntity(stringEntity);
|
||||
|
||||
|
||||
try {
|
||||
// httpClient对象执行post请求,并返回响应参数对象
|
||||
httpResponse = httpClient.execute(httpPost);
|
||||
// 从响应对象中获取响应内容
|
||||
HttpEntity entity = httpResponse.getEntity();
|
||||
String content = EntityUtils.toString(entity);
|
||||
_logger.debug("Http Response StatusCode {} , Content {}",
|
||||
httpResponse.getStatusLine().getStatusCode(),
|
||||
content
|
||||
);
|
||||
return content;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
// 关闭资源
|
||||
if (null != httpResponse) {
|
||||
try {
|
||||
httpResponse.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
if (null != httpClient) {
|
||||
try {
|
||||
httpClient.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public String get(String url) {
|
||||
HashMap<String,String> headers = new HashMap<String,String>();
|
||||
|
||||
Reference in New Issue
Block a user