1 25 26 package org.objectweb.jonas.webapp.jonasadmin.service.container; 27 28 import javax.management.ObjectName ; 29 30 33 public class WebAppItem extends ContainerItem { 34 35 37 public final static String LABEL_ROOT_WEBMODULE = "ROOT"; 38 39 41 private String objectName = null; 42 private String pathContext = null; 43 private String labelPathContext = null; 44 private boolean deployed = false; 45 46 48 public WebAppItem() { 49 } 50 51 public WebAppItem(ObjectName p_ObjectName) { 52 setObjectName(p_ObjectName.toString()); 53 setName(p_ObjectName.getKeyProperty("name")); 54 setPathContext(extractPathContext(getName())); 55 } 56 57 public WebAppItem(String p_PathContext, String p_ObjectName) { 58 setPathContext(p_PathContext); 59 setObjectName(p_ObjectName); 60 } 61 62 64 public static String extractLabelPathContext(String p_Name) { 65 String s = p_Name; 66 if ((s != null) && (s.length() > 0)) { 67 s = extractPathContext(p_Name); 69 if (s.charAt(0) == '/') { 71 s = s.substring(1); 72 if (s.length() == 0) { 73 s = LABEL_ROOT_WEBMODULE; 74 } 75 } 76 } 77 return s; 78 } 79 80 public static String extractPathContext(String p_Name) { 81 String s = p_Name; 82 int iPos = s.indexOf("//"); 84 if (iPos > -1) { 85 s = s.substring(iPos + 2); 86 iPos = s.indexOf("/"); 87 if (iPos > -1) { 88 s = s.substring(iPos); 89 } 90 } 91 return s; 92 } 93 94 96 public String getPathContext() { 97 return pathContext; 98 } 99 100 public void setPathContext(String pathContext) { 101 this.pathContext = pathContext; 102 this.labelPathContext = extractLabelPathContext(pathContext); 103 } 104 105 public boolean isDeployed() { 106 return deployed; 107 } 108 109 public String getLabelPathContext() { 110 return labelPathContext; 111 } 112 113 118 public void setPath(String p_Path) { 119 super.setPath(p_Path); 120 if (getPath() != null) { 121 deployed = true; 122 } 123 } 124 } | Popular Tags |