00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 package org.objectweb.jonas.webapp.jonasadmin.service.container;
00027
00028 import javax.management.ObjectName;
00029
00033 public class WebAppItem extends ContainerItem {
00034
00035
00036
00037 public final static String LABEL_ROOT_WEBMODULE = "ROOT";
00038
00039
00040
00041 private String objectName = null;
00042 private String pathContext = null;
00043 private String labelPathContext = null;
00044 private boolean deployed = false;
00045
00046
00047
00048 public WebAppItem() {
00049 }
00050
00051 public WebAppItem(ObjectName p_ObjectName) {
00052 setObjectName(p_ObjectName.toString());
00053 setName(p_ObjectName.getKeyProperty("name"));
00054 setPathContext(extractPathContext(getName()));
00055 }
00056
00057 public WebAppItem(String p_PathContext, String p_ObjectName) {
00058 setPathContext(p_PathContext);
00059 setObjectName(p_ObjectName);
00060 }
00061
00062
00063
00064 public static String extractLabelPathContext(String p_Name) {
00065 String s = p_Name;
00066 if ((s != null) && (s.length() > 0)) {
00067
00068 s = extractPathContext(p_Name);
00069
00070 if (s.charAt(0) == '/') {
00071 s = s.substring(1);
00072 if (s.length() == 0) {
00073 s = LABEL_ROOT_WEBMODULE;
00074 }
00075 }
00076 }
00077 return s;
00078 }
00079
00080 public static String extractPathContext(String p_Name) {
00081 String s = p_Name;
00082
00083 int iPos = s.indexOf("//");
00084 if (iPos > -1) {
00085 s = s.substring(iPos + 2);
00086 iPos = s.indexOf("/");
00087 if (iPos > -1) {
00088 s = s.substring(iPos);
00089 }
00090 }
00091 return s;
00092 }
00093
00094
00095
00096 public String getPathContext() {
00097 return pathContext;
00098 }
00099
00100 public void setPathContext(String pathContext) {
00101 this.pathContext = pathContext;
00102 this.labelPathContext = extractLabelPathContext(pathContext);
00103 }
00104
00105 public boolean isDeployed() {
00106 return deployed;
00107 }
00108
00109 public String getLabelPathContext() {
00110 return labelPathContext;
00111 }
00112
00118 public void setPath(String p_Path) {
00119 super.setPath(p_Path);
00120 if (getPath() != null) {
00121 deployed = true;
00122 }
00123 }
00124 }