1 23 package com.sun.enterprise.admin.wsmgmt.config.impl; 24 25 import com.sun.enterprise.admin.wsmgmt.config.spi.WebServiceConfig; 26 import com.sun.enterprise.config.serverbeans.WebServiceEndpoint; 27 import com.sun.enterprise.admin.wsmgmt.config.spi.TransformationRule; 28 import com.sun.enterprise.admin.wsmgmt.config.spi.RegistryLocation; 29 import com.sun.enterprise.admin.wsmgmt.config.spi.Constants; 30 31 import java.util.StringTokenizer ; 32 import java.util.List ; 33 import java.util.ArrayList ; 34 35 38 public class WebServiceConfigImpl implements WebServiceConfig { 39 40 public WebServiceConfigImpl( String n, String level, int size, boolean 41 jbi ) { 42 name = n; 43 monitoringLevel = level; 44 maxHistorySize = size; 45 jbiEnabled = jbi; 46 } 47 48 public WebServiceConfigImpl(WebServiceEndpoint wsEp ) { 49 50 if (wsEp == null) { 51 return; 52 } 53 54 name = wsEp.getName(); 55 monitoringLevel = wsEp.getMonitoring(); 56 maxHistorySize = Integer.parseInt(wsEp.getMaxHistorySize()); 57 jbiEnabled = wsEp.isJbiEnabled(); 58 tRules = wsEp.getTransformationRule(); 59 } 60 61 66 public String getName() { 67 return name; 68 } 69 70 75 public String getEndpointName() { 76 StringTokenizer strTok = new StringTokenizer (name, "#"); 77 String relId = null; 78 while (strTok.hasMoreElements()) { 79 relId = (String ) strTok.nextElement(); 80 } 81 return relId; 82 } 83 84 89 public String getMonitoringLevel() { 90 return monitoringLevel; 91 } 92 93 98 public int getMaxHistorySize() { 99 return maxHistorySize; 100 } 101 102 107 public boolean getJbiEnabled() { 108 return jbiEnabled; 109 } 110 111 116 public TransformationRule[] getTransformationRule() { 117 if ( tRules != null) { 118 TransformationRule[] transformRules = new 119 TransformationRuleImpl[tRules.length]; 120 for (int index =0; index < tRules.length; index++) { 121 transformRules[index]= new TransformationRuleImpl(tRules[index]); 122 } 123 return transformRules; 124 } else { 125 return null; 126 } 127 } 128 129 135 public TransformationRule[] getRequestTransformationRule() { 136 if ( tRules != null) { 137 List tList = new ArrayList (); 138 for (int index =0; index < tRules.length; index++) { 139 String phase = tRules[index].getApplyTo(); 140 if ( (phase.equals(Constants.REQUEST) ) || 141 (phase.equals(Constants.BOTH)) ) { 142 if ( tRules[index].isEnabled() == true) { 143 tList.add(new TransformationRuleImpl(tRules[index])); 144 } 145 } 146 } 147 if ( tList.size() > 0 ) { 148 TransformationRule[] transformRules = new 149 TransformationRuleImpl[tList.size()]; 150 return (TransformationRule[]) tList.toArray(transformRules); 151 } else { 152 return null; 153 } 154 } else { 155 return null; 156 } 157 } 158 159 165 public TransformationRule[] getResponseTransformationRule() { 166 if ( tRules != null) { 167 List tList = new ArrayList (); 168 for (int index =0; index < tRules.length; index++) { 169 String phase = tRules[index].getApplyTo(); 170 if ( (phase.equals(Constants.RESPONSE) ) || 171 (phase.equals(Constants.BOTH)) ) { 172 if ( tRules[index].isEnabled() == true) { 173 tList.add(new TransformationRuleImpl(tRules[index])); 174 } 175 } 176 } 177 if ( tList.size() > 0 ) { 178 TransformationRule[] transformRules = new 179 TransformationRuleImpl[tList.size()]; 180 return (TransformationRule[]) tList.toArray(transformRules); 181 } else { 182 return null; 183 } 184 } else { 185 return null; 186 } 187 } 188 189 196 public RegistryLocation[] getRegistryLocation() { 197 return null; 198 } 199 200 String name = null; 202 String monitoringLevel = null; 203 boolean jbiEnabled = false; 204 int maxHistorySize = 0; 205 com.sun.enterprise.config.serverbeans.TransformationRule[] tRules = null; 206 } 207 | Popular Tags |