- 浏览: 2524555 次
- 性别:
- 来自: 成都
-
文章分类
最新评论
-
nation:
你好,在部署Mesos+Spark的运行环境时,出现一个现象, ...
Spark(4)Deal with Mesos -
sillycat:
AMAZON Relatedhttps://www.godad ...
AMAZON API Gateway(2)Client Side SSL with NGINX -
sillycat:
sudo usermod -aG docker ec2-use ...
Docker and VirtualBox(1)Set up Shared Disk for Virtual Box -
sillycat:
Every Half an Hour30 * * * * /u ...
Build Home NAS(3)Data Redundancy -
sillycat:
3 List the Cron Job I Have>c ...
Build Home NAS(3)Data Redundancy
VML勾画流程图(六)db4o后续问题
问题一:
每次在关闭tomcat的时候,控制台都会有错误信息打印出来。
报错如下:
严重: A web application created a ThreadLocal with key of type [org.springframework.core.NamedThreadLocal] (value [Prototype beans currently in creation]) and a value of type [null] (value [null]) but failed to remove it when the web application was stopped. To prevent a memory leak, the ThreadLocal has been forcibly removed.
2010-4-22 22:09:52 org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap
严重: A web application created a ThreadLocal with key of type [org.springframework.core.NamedThreadLocal] (value [Prototype beans currently in creation]) and a value of type [null] (value [null]) but failed to remove it when the web application was stopped. To prevent a memory leak, the ThreadLocal has been forcibly removed.
2010-4-22 22:09:52 org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap
严重: A web application created a ThreadLocal with key of type [org.springframework.core.NamedThreadLocal] (value [Prototype beans currently in creation]) and a value of type [null] (value [null]) but failed to remove it when the web application was stopped. To prevent a memory leak, the ThreadLocal has been forcibly removed.
2010-4-22 22:09:52 org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap
严重: A web application created a ThreadLocal with key of type [org.codehaus.groovy.runtime.GroovyCategorySupport.MyThreadLocal] (value [org.codehaus.groovy.runtime.GroovyCategorySupport$MyThreadLocal@1648e6f]) and a value of type [java.lang.ref.SoftReference] (value [java.lang.ref.SoftReference@c32254]) but failed to remove it when the web application was stopped. To prevent a memory leak, the ThreadLocal has been forcibly removed.
log4j:ERROR LogMananger.repositorySelector was null likely due to error in class reloading, using NOPLoggerRepository.
有人说是TOMCAT的BUG
tomcat6.0.24和ORACLE10g JDBC,MYSQL5 JDBC的兼容性都有问题!
http://hi.baidu.com/rtsbtx/blog/item/841c4f1f44ca02c3a786693b.html
我换成6.0.20之后就好了,不过这里到底有没有memory leak,以后还要多观察。
问题二:
以前我把db4o的db4oDAOImpl想得太简单了,而且local和remote那么弄不得行:),只能不考虑client或者本地yap文件的频繁打开和关闭问题,将对db4o的操作做调整。
web.xml中增加启动项,启动tomcat的时候就开启db4o的server,当然是根据配置来走。
<listener>
<listener-class>com.sillycat.easyworkflow.commons.listeners.Db4oContextLoaderListener</listener-class>
</listener>
Db4oContextLoaderListener.java的内容如下,做了哪些事情呢:
package com.sillycat.easyworkflow.commons.listeners;
import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.web.context.ContextLoaderListener;
import org.springframework.web.context.support.WebApplicationContextUtils;
import com.db4o.ObjectServer;
import com.db4o.cs.Db4oClientServer;
import com.sillycat.easyworkflow.commons.config.WebAppConfiguration;
public class Db4oContextLoaderListener extends ContextLoaderListener implements
ServletContextListener {
private final Log log = LogFactory.getLog(getClass());
private ObjectServer server;
public void contextInitialized(ServletContextEvent event) {
super.contextInitialized(event);
ServletContext context = event.getServletContext();
ApplicationContext ctx = WebApplicationContextUtils
.getRequiredWebApplicationContext(context);
WebAppConfiguration webAppConfiguration = (WebAppConfiguration) ctx
.getBean("webAppConfiguration");
if (!webAppConfiguration.isEnableLocal()) {
log.info("============================= begin to init dbo4 =====================");
initdb4o(webAppConfiguration);
log.info("============================= end to init dbo4 =====================");
}
}
public void contextDestroyed(ServletContextEvent event) {
if(this.server != null){
log.info("shutdown the db4o server");
this.server.close();
}
}
public void initdb4o(WebAppConfiguration webAppConfiguration) {
log.info("serverfilename:" + webAppConfiguration.getServerFileName());
log.info("port:" + webAppConfiguration.getPort());
log.info("username:" + webAppConfiguration.getUsername());
this.server = Db4oClientServer.openServer(Db4oClientServer
.newServerConfiguration(), webAppConfiguration
.getServerFileName(), webAppConfiguration.getPort());
this.server.grantAccess(webAppConfiguration.getUsername(),
webAppConfiguration.getPassword());
}
}
配置类WebAppConfiguration.java如下:
public class WebAppConfiguration {
private String workflowPath;
// 是否是本地服务
private boolean enableLocal = true;
// 本地数据库文件名字
private String localFileName = "local.yap";
// 服务端数据库文件名字
private String serverFileName = "server.yap";
// 服务器端口
private int port = 1212;
// 用户名
private String username = "sillycat";
// 密码
private String password = "111111";
// 服务器地址
private String serverhost = "localhost";
...snip...
}
properties的数据如下:
db4o.enableLocal=true
db4o.local.filename=e:/work/easyworkflow/db/local.yap
db4o.server.filename=e:/work/easyworkflow/db/server.yap
db4o.server.port=1212
db4o.server.username=sillycat
db4o.server.password=111111
db4o.server.serverhost=localhost
原来的workflowManagerImpl要做如下修改:
package com.sillycat.easyworkflow.service.impl;
import java.util.ArrayList;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.db4o.Db4oEmbedded;
import com.db4o.ObjectContainer;
import com.db4o.ObjectSet;
import com.db4o.cs.Db4oClientServer;
import com.db4o.query.Predicate;
import com.sillycat.easyworkflow.commons.config.WebAppConfiguration;
import com.sillycat.easyworkflow.commons.utils.Db4oUtil;
import com.sillycat.easyworkflow.commons.utils.StringUtil;
import com.sillycat.easyworkflow.model.Workflow;
import com.sillycat.easyworkflow.model.WorkflowDefinition;
import com.sillycat.easyworkflow.model.WorkflowDefinitionQuery;
import com.sillycat.easyworkflow.service.WorkflowManager;
@Service("workflowManager")
public class WorkflowManagerImpl implements WorkflowManager {
public Logger logger = LoggerFactory.getLogger(this.getClass());
private WebAppConfiguration webAppConfiguration;
public ObjectContainer opendb() {
ObjectContainer db = null;
if (webAppConfiguration.isEnableLocal()) {
db = Db4oEmbedded.openFile(Db4oEmbedded.newConfiguration(),
webAppConfiguration.getLocalFileName());
logger.info("init local db4o file = "
+ webAppConfiguration.getLocalFileName());
} else {
db = Db4oClientServer.openClient(Db4oClientServer
.newClientConfiguration(), webAppConfiguration
.getServerhost(), webAppConfiguration.getPort(),
webAppConfiguration.getUsername(), webAppConfiguration
.getPassword());
logger.info("init remote db4o server "
+ webAppConfiguration.getServerhost() + ":"
+ webAppConfiguration.getPort());
}
return db;
}
@Autowired
public void setWebAppConfiguration(WebAppConfiguration webAppConfiguration) {
this.webAppConfiguration = webAppConfiguration;
}
/**
* use for show page,get flow instances information by flow id
*/
public Workflow getWorkflowById(String workflowInstanceId) {
if (StringUtil.isBlank(workflowInstanceId)) {
logger.info("workflowInstanceId can't be blank when get workflow!");
return null;
}
Workflow workflow = new Workflow(workflowInstanceId);
ObjectContainer db = null;
try {
db = opendb();
ObjectSet<Workflow> os = db.queryByExample(workflow);
Db4oUtil<Workflow> db4oUtil = new Db4oUtil<Workflow>();
workflow = db4oUtil.retrieveObject(os);
} catch (Exception e) {
logger.error("error:" + e);
} finally {
db.close();
}
return workflow;
}
/**
* save flow instances information
*/
public void saveWorkflow(Workflow workflow) {
if (workflow == null
|| StringUtil.isBlank(workflow.getWorkflowInstanceId())) {
logger
.info("object and workflowInstanceId can't be null,when save!");
return;
}
ObjectContainer db = null;
try {
db = opendb();
Workflow search = new Workflow(workflow.getWorkflowInstanceId());
ObjectSet<Workflow> os = db.queryByExample(search);
Db4oUtil<Workflow> db4oUtil = new Db4oUtil<Workflow>();
Workflow t = db4oUtil.retrieveObject(os);
if (t == null) {
// insert new object in the database
db.store(workflow);
logger
.debug("object workflow="
+ workflow.getWorkflowInstanceId()
+ " newly inserted!");
} else {
// update object in the database
t.setSteps(workflow.getSteps());
t.setWorkflowName(workflow.getWorkflowName());
db.store(t);
logger.debug("object workflow="
+ workflow.getWorkflowInstanceId() + " updated!");
}
db.commit();
} catch (Exception e) {
logger.error("error:" + e);
} finally {
db.close();
}
}
/**
* save flow definition information
*
* @param workflowDefinition
*/
public void saveWorkflowDefinition(WorkflowDefinition workflowDefinition) {
if (workflowDefinition == null
|| StringUtil.isBlank(workflowDefinition.getWorkflowName())) {
logger.info("object and workflowName can't be null,when save!");
return;
}
ObjectContainer db = null;
try {
db = opendb();
WorkflowDefinition search = new WorkflowDefinition(
workflowDefinition.getWorkflowName());
ObjectSet<WorkflowDefinition> os = db.queryByExample(search);
Db4oUtil<WorkflowDefinition> db4oUtil = new Db4oUtil<WorkflowDefinition>();
WorkflowDefinition t = db4oUtil.retrieveObject(os);
if (t == null) {
// insert new object in the database
db.store(workflowDefinition);
logger.debug("object workflowDefinition="
+ workflowDefinition.getWorkflowName()
+ " newly inserted!");
} else {
// update object in the database
t.setAliasName(workflowDefinition.getAliasName());
t.setContent(workflowDefinition.getContent());
db.store(t);
logger.debug("object workflowDefinition="
+ workflowDefinition.getWorkflowName() + " updated!");
}
db.commit();
} catch (Exception e) {
logger.error("error:" + e);
} finally {
db.close();
}
}
/**
* get the flow definition information by workflowName
*
* @param workflowName
* @return
*/
public WorkflowDefinition getWorkflowDefinitionByWorkflowName(
String workflowName) {
if (StringUtil.isBlank(workflowName)) {
logger
.info("workflowName can't be blank when get workflowDefinition!");
return null;
}
WorkflowDefinition wfDefinition = new WorkflowDefinition(workflowName);
ObjectContainer db = null;
try {
db = opendb();
ObjectSet<WorkflowDefinition> os = db.queryByExample(wfDefinition);
Db4oUtil<WorkflowDefinition> db4oUtil = new Db4oUtil<WorkflowDefinition>();
wfDefinition = db4oUtil.retrieveObject(os);
} catch (Exception e) {
logger.error("error:" + e);
} finally {
db.close();
}
return wfDefinition;
}
/**
* list all the flow definition information
*
* @return
*/
public List<WorkflowDefinition> allWorkflowDefinition() {
List<WorkflowDefinition> list = null;
WorkflowDefinition wfDefinition = new WorkflowDefinition();
ObjectContainer db = null;
try {
db = opendb();
ObjectSet<WorkflowDefinition> os = db.queryByExample(wfDefinition);
Db4oUtil<WorkflowDefinition> db4oUtil = new Db4oUtil<WorkflowDefinition>();
list = db4oUtil.retrieveList(os);
} catch (Exception e) {
logger.error("error:" + e);
} finally {
db.close();
}
return list;
}
/**
* query the flow definition information with page parameters
*
* @param query
* @return
*/
public List<WorkflowDefinition> queryWorkflowDefinition(
WorkflowDefinitionQuery query) {
List<WorkflowDefinition> os = null;
List<WorkflowDefinition> list = null;
final String workflowName = query.getWorkflowName();
final String aliasName = query.getAliasName();
ObjectContainer db = null;
try {
db = opendb();
os = db.query(new Predicate<WorkflowDefinition>() {
private static final long serialVersionUID = 8058916779101664916L;
public boolean match(WorkflowDefinition wd) {
boolean flag = true;
if (StringUtil.isNotBlank(workflowName)) {
flag = wd.getWorkflowName().equalsIgnoreCase(
workflowName);
}
if (StringUtil.isNotBlank(aliasName)) {
flag = flag
&& wd.getAliasName()
.equalsIgnoreCase(aliasName);
}
return flag;
}
});
if (os != null && !os.isEmpty()) {
query.setTotal(os.size());
}
list = new ArrayList<WorkflowDefinition>(query.getEnd()
- query.getStart() + 1);
for (int i = (query.getStart() - 1); i < query.getEnd(); i++) {
list.add(os.get(i));
}
} catch (Exception e) {
logger.error("error:" + e);
} finally {
db.close();
}
return list;
}
/**
*
* @param workflowName
*/
public void deleteWorkflowDefinitionByWorkflowName(String workflowName) {
if (StringUtil.isBlank(workflowName)) {
logger
.info("workflowName can't be blank when delete workflowdefinition!");
return;
}
ObjectContainer db = null;
try {
db = opendb();
WorkflowDefinition search = new WorkflowDefinition(workflowName);
ObjectSet<WorkflowDefinition> os = db.queryByExample(search);
Db4oUtil<WorkflowDefinition> db4oUtil = new Db4oUtil<WorkflowDefinition>();
WorkflowDefinition workflowDefinition = db4oUtil.retrieveObject(os);
if (workflowDefinition == null) {
logger.info("I can't find workflowDefinition=" + workflowName
+ " in database");
return;
}
db.delete(workflowDefinition);
db.commit();
} catch (Exception e) {
logger.error("error:" + e);
} finally {
db.close();
}
}
}
问题一:
每次在关闭tomcat的时候,控制台都会有错误信息打印出来。
报错如下:
严重: A web application created a ThreadLocal with key of type [org.springframework.core.NamedThreadLocal] (value [Prototype beans currently in creation]) and a value of type [null] (value [null]) but failed to remove it when the web application was stopped. To prevent a memory leak, the ThreadLocal has been forcibly removed.
2010-4-22 22:09:52 org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap
严重: A web application created a ThreadLocal with key of type [org.springframework.core.NamedThreadLocal] (value [Prototype beans currently in creation]) and a value of type [null] (value [null]) but failed to remove it when the web application was stopped. To prevent a memory leak, the ThreadLocal has been forcibly removed.
2010-4-22 22:09:52 org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap
严重: A web application created a ThreadLocal with key of type [org.springframework.core.NamedThreadLocal] (value [Prototype beans currently in creation]) and a value of type [null] (value [null]) but failed to remove it when the web application was stopped. To prevent a memory leak, the ThreadLocal has been forcibly removed.
2010-4-22 22:09:52 org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap
严重: A web application created a ThreadLocal with key of type [org.codehaus.groovy.runtime.GroovyCategorySupport.MyThreadLocal] (value [org.codehaus.groovy.runtime.GroovyCategorySupport$MyThreadLocal@1648e6f]) and a value of type [java.lang.ref.SoftReference] (value [java.lang.ref.SoftReference@c32254]) but failed to remove it when the web application was stopped. To prevent a memory leak, the ThreadLocal has been forcibly removed.
log4j:ERROR LogMananger.repositorySelector was null likely due to error in class reloading, using NOPLoggerRepository.
有人说是TOMCAT的BUG
tomcat6.0.24和ORACLE10g JDBC,MYSQL5 JDBC的兼容性都有问题!
http://hi.baidu.com/rtsbtx/blog/item/841c4f1f44ca02c3a786693b.html
我换成6.0.20之后就好了,不过这里到底有没有memory leak,以后还要多观察。
问题二:
以前我把db4o的db4oDAOImpl想得太简单了,而且local和remote那么弄不得行:),只能不考虑client或者本地yap文件的频繁打开和关闭问题,将对db4o的操作做调整。
web.xml中增加启动项,启动tomcat的时候就开启db4o的server,当然是根据配置来走。
<listener>
<listener-class>com.sillycat.easyworkflow.commons.listeners.Db4oContextLoaderListener</listener-class>
</listener>
Db4oContextLoaderListener.java的内容如下,做了哪些事情呢:
package com.sillycat.easyworkflow.commons.listeners;
import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.web.context.ContextLoaderListener;
import org.springframework.web.context.support.WebApplicationContextUtils;
import com.db4o.ObjectServer;
import com.db4o.cs.Db4oClientServer;
import com.sillycat.easyworkflow.commons.config.WebAppConfiguration;
public class Db4oContextLoaderListener extends ContextLoaderListener implements
ServletContextListener {
private final Log log = LogFactory.getLog(getClass());
private ObjectServer server;
public void contextInitialized(ServletContextEvent event) {
super.contextInitialized(event);
ServletContext context = event.getServletContext();
ApplicationContext ctx = WebApplicationContextUtils
.getRequiredWebApplicationContext(context);
WebAppConfiguration webAppConfiguration = (WebAppConfiguration) ctx
.getBean("webAppConfiguration");
if (!webAppConfiguration.isEnableLocal()) {
log.info("============================= begin to init dbo4 =====================");
initdb4o(webAppConfiguration);
log.info("============================= end to init dbo4 =====================");
}
}
public void contextDestroyed(ServletContextEvent event) {
if(this.server != null){
log.info("shutdown the db4o server");
this.server.close();
}
}
public void initdb4o(WebAppConfiguration webAppConfiguration) {
log.info("serverfilename:" + webAppConfiguration.getServerFileName());
log.info("port:" + webAppConfiguration.getPort());
log.info("username:" + webAppConfiguration.getUsername());
this.server = Db4oClientServer.openServer(Db4oClientServer
.newServerConfiguration(), webAppConfiguration
.getServerFileName(), webAppConfiguration.getPort());
this.server.grantAccess(webAppConfiguration.getUsername(),
webAppConfiguration.getPassword());
}
}
配置类WebAppConfiguration.java如下:
public class WebAppConfiguration {
private String workflowPath;
// 是否是本地服务
private boolean enableLocal = true;
// 本地数据库文件名字
private String localFileName = "local.yap";
// 服务端数据库文件名字
private String serverFileName = "server.yap";
// 服务器端口
private int port = 1212;
// 用户名
private String username = "sillycat";
// 密码
private String password = "111111";
// 服务器地址
private String serverhost = "localhost";
...snip...
}
properties的数据如下:
db4o.enableLocal=true
db4o.local.filename=e:/work/easyworkflow/db/local.yap
db4o.server.filename=e:/work/easyworkflow/db/server.yap
db4o.server.port=1212
db4o.server.username=sillycat
db4o.server.password=111111
db4o.server.serverhost=localhost
原来的workflowManagerImpl要做如下修改:
package com.sillycat.easyworkflow.service.impl;
import java.util.ArrayList;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.db4o.Db4oEmbedded;
import com.db4o.ObjectContainer;
import com.db4o.ObjectSet;
import com.db4o.cs.Db4oClientServer;
import com.db4o.query.Predicate;
import com.sillycat.easyworkflow.commons.config.WebAppConfiguration;
import com.sillycat.easyworkflow.commons.utils.Db4oUtil;
import com.sillycat.easyworkflow.commons.utils.StringUtil;
import com.sillycat.easyworkflow.model.Workflow;
import com.sillycat.easyworkflow.model.WorkflowDefinition;
import com.sillycat.easyworkflow.model.WorkflowDefinitionQuery;
import com.sillycat.easyworkflow.service.WorkflowManager;
@Service("workflowManager")
public class WorkflowManagerImpl implements WorkflowManager {
public Logger logger = LoggerFactory.getLogger(this.getClass());
private WebAppConfiguration webAppConfiguration;
public ObjectContainer opendb() {
ObjectContainer db = null;
if (webAppConfiguration.isEnableLocal()) {
db = Db4oEmbedded.openFile(Db4oEmbedded.newConfiguration(),
webAppConfiguration.getLocalFileName());
logger.info("init local db4o file = "
+ webAppConfiguration.getLocalFileName());
} else {
db = Db4oClientServer.openClient(Db4oClientServer
.newClientConfiguration(), webAppConfiguration
.getServerhost(), webAppConfiguration.getPort(),
webAppConfiguration.getUsername(), webAppConfiguration
.getPassword());
logger.info("init remote db4o server "
+ webAppConfiguration.getServerhost() + ":"
+ webAppConfiguration.getPort());
}
return db;
}
@Autowired
public void setWebAppConfiguration(WebAppConfiguration webAppConfiguration) {
this.webAppConfiguration = webAppConfiguration;
}
/**
* use for show page,get flow instances information by flow id
*/
public Workflow getWorkflowById(String workflowInstanceId) {
if (StringUtil.isBlank(workflowInstanceId)) {
logger.info("workflowInstanceId can't be blank when get workflow!");
return null;
}
Workflow workflow = new Workflow(workflowInstanceId);
ObjectContainer db = null;
try {
db = opendb();
ObjectSet<Workflow> os = db.queryByExample(workflow);
Db4oUtil<Workflow> db4oUtil = new Db4oUtil<Workflow>();
workflow = db4oUtil.retrieveObject(os);
} catch (Exception e) {
logger.error("error:" + e);
} finally {
db.close();
}
return workflow;
}
/**
* save flow instances information
*/
public void saveWorkflow(Workflow workflow) {
if (workflow == null
|| StringUtil.isBlank(workflow.getWorkflowInstanceId())) {
logger
.info("object and workflowInstanceId can't be null,when save!");
return;
}
ObjectContainer db = null;
try {
db = opendb();
Workflow search = new Workflow(workflow.getWorkflowInstanceId());
ObjectSet<Workflow> os = db.queryByExample(search);
Db4oUtil<Workflow> db4oUtil = new Db4oUtil<Workflow>();
Workflow t = db4oUtil.retrieveObject(os);
if (t == null) {
// insert new object in the database
db.store(workflow);
logger
.debug("object workflow="
+ workflow.getWorkflowInstanceId()
+ " newly inserted!");
} else {
// update object in the database
t.setSteps(workflow.getSteps());
t.setWorkflowName(workflow.getWorkflowName());
db.store(t);
logger.debug("object workflow="
+ workflow.getWorkflowInstanceId() + " updated!");
}
db.commit();
} catch (Exception e) {
logger.error("error:" + e);
} finally {
db.close();
}
}
/**
* save flow definition information
*
* @param workflowDefinition
*/
public void saveWorkflowDefinition(WorkflowDefinition workflowDefinition) {
if (workflowDefinition == null
|| StringUtil.isBlank(workflowDefinition.getWorkflowName())) {
logger.info("object and workflowName can't be null,when save!");
return;
}
ObjectContainer db = null;
try {
db = opendb();
WorkflowDefinition search = new WorkflowDefinition(
workflowDefinition.getWorkflowName());
ObjectSet<WorkflowDefinition> os = db.queryByExample(search);
Db4oUtil<WorkflowDefinition> db4oUtil = new Db4oUtil<WorkflowDefinition>();
WorkflowDefinition t = db4oUtil.retrieveObject(os);
if (t == null) {
// insert new object in the database
db.store(workflowDefinition);
logger.debug("object workflowDefinition="
+ workflowDefinition.getWorkflowName()
+ " newly inserted!");
} else {
// update object in the database
t.setAliasName(workflowDefinition.getAliasName());
t.setContent(workflowDefinition.getContent());
db.store(t);
logger.debug("object workflowDefinition="
+ workflowDefinition.getWorkflowName() + " updated!");
}
db.commit();
} catch (Exception e) {
logger.error("error:" + e);
} finally {
db.close();
}
}
/**
* get the flow definition information by workflowName
*
* @param workflowName
* @return
*/
public WorkflowDefinition getWorkflowDefinitionByWorkflowName(
String workflowName) {
if (StringUtil.isBlank(workflowName)) {
logger
.info("workflowName can't be blank when get workflowDefinition!");
return null;
}
WorkflowDefinition wfDefinition = new WorkflowDefinition(workflowName);
ObjectContainer db = null;
try {
db = opendb();
ObjectSet<WorkflowDefinition> os = db.queryByExample(wfDefinition);
Db4oUtil<WorkflowDefinition> db4oUtil = new Db4oUtil<WorkflowDefinition>();
wfDefinition = db4oUtil.retrieveObject(os);
} catch (Exception e) {
logger.error("error:" + e);
} finally {
db.close();
}
return wfDefinition;
}
/**
* list all the flow definition information
*
* @return
*/
public List<WorkflowDefinition> allWorkflowDefinition() {
List<WorkflowDefinition> list = null;
WorkflowDefinition wfDefinition = new WorkflowDefinition();
ObjectContainer db = null;
try {
db = opendb();
ObjectSet<WorkflowDefinition> os = db.queryByExample(wfDefinition);
Db4oUtil<WorkflowDefinition> db4oUtil = new Db4oUtil<WorkflowDefinition>();
list = db4oUtil.retrieveList(os);
} catch (Exception e) {
logger.error("error:" + e);
} finally {
db.close();
}
return list;
}
/**
* query the flow definition information with page parameters
*
* @param query
* @return
*/
public List<WorkflowDefinition> queryWorkflowDefinition(
WorkflowDefinitionQuery query) {
List<WorkflowDefinition> os = null;
List<WorkflowDefinition> list = null;
final String workflowName = query.getWorkflowName();
final String aliasName = query.getAliasName();
ObjectContainer db = null;
try {
db = opendb();
os = db.query(new Predicate<WorkflowDefinition>() {
private static final long serialVersionUID = 8058916779101664916L;
public boolean match(WorkflowDefinition wd) {
boolean flag = true;
if (StringUtil.isNotBlank(workflowName)) {
flag = wd.getWorkflowName().equalsIgnoreCase(
workflowName);
}
if (StringUtil.isNotBlank(aliasName)) {
flag = flag
&& wd.getAliasName()
.equalsIgnoreCase(aliasName);
}
return flag;
}
});
if (os != null && !os.isEmpty()) {
query.setTotal(os.size());
}
list = new ArrayList<WorkflowDefinition>(query.getEnd()
- query.getStart() + 1);
for (int i = (query.getStart() - 1); i < query.getEnd(); i++) {
list.add(os.get(i));
}
} catch (Exception e) {
logger.error("error:" + e);
} finally {
db.close();
}
return list;
}
/**
*
* @param workflowName
*/
public void deleteWorkflowDefinitionByWorkflowName(String workflowName) {
if (StringUtil.isBlank(workflowName)) {
logger
.info("workflowName can't be blank when delete workflowdefinition!");
return;
}
ObjectContainer db = null;
try {
db = opendb();
WorkflowDefinition search = new WorkflowDefinition(workflowName);
ObjectSet<WorkflowDefinition> os = db.queryByExample(search);
Db4oUtil<WorkflowDefinition> db4oUtil = new Db4oUtil<WorkflowDefinition>();
WorkflowDefinition workflowDefinition = db4oUtil.retrieveObject(os);
if (workflowDefinition == null) {
logger.info("I can't find workflowDefinition=" + workflowName
+ " in database");
return;
}
db.delete(workflowDefinition);
db.commit();
} catch (Exception e) {
logger.error("error:" + e);
} finally {
db.close();
}
}
}
发表评论
-
MongoDB 2019(3)Security and Auth
2019-11-16 06:48 229MongoDB 2019(3)Security and Aut ... -
Memory Leak in NodeJS
2018-12-20 06:26 713Memory Leak in NodeJS I have d ... -
Remote Desktop Client
2018-12-07 13:19 1175Remote Desktop Client There is ... -
MetaBase UI Console(2)Docker on MySQL
2018-11-29 06:58 929MetaBase UI Console(2)Docker on ... -
AWS Lambda and Serverless Timeout
2018-09-20 01:20 617AWS Lambda and Serverless Timeo ... -
2018 WebSocket(1)Introduction
2018-03-20 01:22 10952018 WebSocket(1)Introduction ... -
2018 TypeScript Update(3)Introduction Basic Grammar
2018-03-08 03:08 5912018 TypeScript Update(3)Introd ... -
2018 TypeScript Update(2)Introduction Basic Grammar - Classes and Functions
2018-03-06 05:32 5392018 TypeScript Update(2)Introd ... -
2018 TypeScript Update(1)Introduction Basic Grammar - Types and Interface
2018-03-03 01:15 5922018 TypeScript Update(1)Introd ... -
Charts and Console(6)Paging
2018-03-01 00:12 571Charts and Console(6)Paging Th ... -
Vue.JS(3)Google Login
2018-02-14 04:53 1279Vue.JS(3)Google Login I just p ... -
Vue.JS(2)Monitor Water Console - ChartJS and Axios
2018-02-14 03:17 711Vue.JS(2)Monitor Water Console ... -
Vue.JS(1)Introduction and Basic Demo
2018-02-08 06:47 596Vue.JS(1)Introduction and Basic ... -
Charts and Console(5)Validation Form
2017-10-03 05:12 794Charts and Console(5)Validation ... -
Charts and Console(4)Display and Enhancement
2017-09-20 05:39 623Charts and Console(4)Display an ... -
Charts and Console(3)Auth and Login
2017-09-13 03:45 651Charts and Console(3)Auth and L ... -
Charts and Console(2)Login and Proxy
2017-08-31 05:39 863Charts and Console(2)Login and ... -
Charts and Console(1)UI Console and RESTful Client
2017-08-29 11:02 759Charts and Console(1)UI Console ... -
Blog Project(2)Express Backend API - istanbul - mocha - bunyan
2017-06-09 00:05 466Blog Project(2)Express Backend ... -
ReactJS(5)Composition vs Inheritance
2017-06-06 05:55 1098ReactJS(5)Composition vs Inheri ...
相关推荐
JavaScript,作为Web开发中的重要脚本语言,可以与VML结合,实现动态的、交互式的流程图绘制。 在JavaScript中,VML主要通过DOM(Document Object Model)操作来实现,可以创建VML元素,设置其属性,以及响应用户的...
EXT 和 VML 是在网页中实现图形界面的两种技术,特别是在创建流程图等可视化元素时。EXT 是一个基于 JavaScript 的富客户端应用框架,提供了一系列组件和工具,用于构建交互式的 Web 应用程序。而 VML(Vector ...
在本案例中,"asp.net+vml流程图代码"指的是利用ASP.NET技术和VML(Vector Markup Language)来创建流程图的一种编程实践。VML是一种标记语言,允许在网页上绘制矢量图形,尤其适合在不支持SVG(Scalable Vector ...
基于EXT vml的流程图的实现
使用vml封装的流程图控件,颜色大写可自动控制。
在这个"vml开发的流程图"项目中,我们可以看到开发者使用JavaScript与VML结合来创建动态和交互式的流程图。 JavaScript是Web开发中的脚本语言,它负责增加网页的动态功能和交互性。在描述中提到的“javascript+vml...
"vml-rose流程图"是一个使用VML技术实现的流程图示例,用于在Web环境中展示流程或工作流的过程。在本项目中,我们可能找到了一个用于绘制类似Rose UML类图的流程图工具或代码库。 在描述中提到的"基于vml的web绘图...
VML做流程图UI层的javascript
实现了vml+html中显示的,并解决了ie浏览器兼容的问题,代码直接运行便好用
通过查看这些文件,我们可以深入理解HTML和VML如何协同工作来呈现定制的工作流程图。 总之,HTML+VML工作流程结合了HTML的网页结构和VML的矢量图形能力,使得开发者能够创建出具有动态效果和交互性的复杂网页应用。...
本项目名为“流程图编辑器--js oop vml”,意味着它是一个基于JavaScript实现的对象导向编程(OOP)项目,使用了Vector Markup Language(VML)来绘制流程图。下面将详细介绍这个项目可能涉及的关键知识点。 **1. ...
vml曲线走势图vml曲线走势图vml曲线走势图vml曲线走势图vml曲线走势图vml曲线走势图vml曲线走势图vml曲线走势图vml曲线走势图vml曲线走势图vml曲线走势图vml曲线走势图vml曲线走势图vml曲线走势图vml曲线走势图vml...
在本实例中,我们将深入探讨如何使用VML来实现画流程图。 流程图是一种可视化表示流程或工作流的工具,它通过各种形状和连接线来展示步骤、决策和流程的流向。VML为绘制这些元素提供了丰富的功能,包括线条、矩形、...
用vml画饼状图用vml画饼状图用vml画饼状图用vml画饼状图
ASP VML走势图是一种基于ASP(Active Server Pages)技术,并结合VML(Vector Markup Language)来创建动态曲线图表的方法。这种技术常用于Web应用中,以便在网页上展示数据的实时变化或者历史趋势,如股票市场、...
将输出在页面上的vml图 导出到excel 中的矢量图 可在excel中编辑
在本示例中,ASP被用来处理和解析来自数据库或其他数据源的数据,然后使用VML(Vector Markup Language)来生成各种图表,如饼图、柱图和折线图。 VML是一种基于XML的矢量图形语言,允许在网页上创建和显示复杂的...
在"VML.rar_DEMO_VML_vml API_vml包含哪些图_vml教程"这个压缩包中,我们可以期待获取关于VML的基本知识、实例、API介绍以及可能的一些示例图形。以下是一些关于VML的关键知识点: 1. **VML结构**:VML基于XML,...
VML,全称Vector Markup Language,是一种基于XML的矢量图形语言,主要在早期的Web开发中用于在浏览器中创建和展示矢量图形。在“一个精致的VML地图”这个主题中,我们关注的是如何利用VML技术来制作和展示地图。 ...