1、检验是否已经部署过,判断deployed和host
HashMap<String, DeployedApplication> deployed=new HashMap<String, DeployedApplication>(); Host host
2、创建DeployedApplication对象,主要有4个属性
3、判断D:\workspace\test_tomcat\apache-tomcat-7.0.22-src\output\build\webapps\docs\META-INF\context.xml是否存在,存在进行解析和赋值,如果不存在,创建context对象StandardContext。
4、创建ContextConfig对象,将其加入context的LifecycleListener中。
5、为context设置属性,name、path、webappversion、docbase。
6、host.addChild(context);,后续介绍。
7、deployedApp.redeployResources.put(dir.getAbsolutePath(),
Long.valueOf(dir.lastModified()));其中dir.getAbsolutePath()=D:\workspace\test_tomcat\apache-tomcat-7.0.22-src\output\build\webapps\docs,Long.valueOf(dir.lastModified())=1319036597907
8、addWatchedResources(deployedApp, dir.getAbsolutePath(), context);主要功能是app.reloadResources.put(resource.getAbsolutePath(), Long.valueOf(resource.lastModified()));其中resource为
9、deployed.put(cn.getName(), deployedApp),按照name,deployedApp进行存放。