1 23 24 29 30 package com.sun.enterprise.admin.wsmgmt.registry; 31 32 import java.util.Enumeration ; 33 import java.util.Iterator ; 34 import java.util.Map ; 35 import java.util.List ; 36 import java.util.ArrayList ; 37 import java.util.HashMap ; 38 import java.util.Properties ; 39 import java.util.logging.Logger ; 40 import java.util.logging.Level ; 41 import javax.management.Attribute ; 42 import javax.management.AttributeList ; 43 import javax.management.InstanceNotFoundException ; 44 import javax.management.MBeanException ; 45 import javax.management.MBeanServer ; 46 47 import com.sun.logging.LogDomains; 48 import com.sun.appserv.management.ext.wsmgmt.WebServiceMgr; 49 import com.sun.appserv.management.ext.wsmgmt.WebServiceEndpointInfo; 50 import com.sun.enterprise.util.io.FileUtils; 51 import com.sun.appserv.management.client.ProxyFactory; 52 import com.sun.appserv.management.config.DomainConfig; 53 import com.sun.appserv.management.DomainRoot; 54 import com.sun.enterprise.admin.common.MBeanServerFactory; 55 import com.sun.appserv.management.config.PropertiesAccess; 56 import com.sun.appserv.management.config.WebServiceEndpointConfig; 57 import com.sun.appserv.management.config.J2EEApplicationConfig; 58 import com.sun.appserv.management.config.EJBModuleConfig; 59 import com.sun.appserv.management.config.WebModuleConfig; 60 import com.sun.appserv.management.config.ConnectorResourceConfig; 61 import com.sun.appserv.management.config.ConnectorConnectionPoolConfig; 62 import com.sun.appserv.management.config.ResourceAdapterConfig; 63 import com.sun.appserv.management.config.ResourceRefConfig; 64 import com.sun.appserv.management.config.StandaloneServerConfig; 65 import com.sun.appserv.management.config.RegistryLocationConfig; 66 import javax.management.MalformedObjectNameException ; 67 import javax.management.ObjectName ; 68 import javax.management.ReflectionException ; 69 70 75 public class ConfigHelper { 76 77 private static final Logger _logger = 78 Logger.getLogger(LogDomains.ADMIN_LOGGER); 79 80 private static final String POOL_SUFFIX = "__pool"; 84 private static final String DEFAULT_JAXR_RAR = "jaxr-ra"; 85 private static final String ignore_ra = "jmsra"; 86 89 public static final String UDDI_PROPERTY = "com.sun.appserv.registry.uddi"; 90 93 public static final String EBXML_PROPERTY = "com.sun.appserv.registry.ebxml"; 94 95 public static final String APPSERVER_UDDI = "AppserverUDDI"; 97 98 public static final String APPSERVER_EBXML = "AppserverEBXML"; 99 100 109 public static final String JAXR_REGISTRY_TYPE = 110 "javax.xml.registry.ConnectionFactory"; 111 112 private static final String UDDI_JAXR_REGISTRY_TYPE 113 = "com.sun.connector.jaxr.JaxrConnectionFactory"; 114 115 private static final String LifeCycleManagerURL = "LifeCycleManagerURL"; 116 private static final String QueryManagerURL = "QueryManagerURL"; 117 private Map webServiceInfoMap = null; 118 122 private ConfigHelper(Map webServiceInfo) { 123 this.webServiceInfoMap = webServiceInfo; 124 } 125 126 130 private ConfigHelper(){ 131 } 132 133 134 139 public static ConfigHelper getInstanceToUpdateConfig(Map webServiceInfo){ 140 return new ConfigHelper(webServiceInfo); 141 } 142 143 public static ConfigHelper getInstanceToDeleteRegistryResources() { 144 return new ConfigHelper(); 145 } 146 151 public static ConfigHelper getInstanceToQueryRegistryLocations(){ 152 return new ConfigHelper(); 153 } 154 155 164 void addToConfig(String webServiceName, Map <String , String > published){ if(webServiceInfoMap == null){ 166 _logger.fine("ConfigHelper.addToConfig : Incorrect webServiceName "); 167 return; 168 } 169 final DomainConfig dc = this.getDomainConfig(); 170 String appId = (String )webServiceInfoMap.get( 171 WebServiceEndpointInfo.APP_ID_KEY); 172 173 Boolean isStandAlone = (Boolean )webServiceInfoMap.get( 174 WebServiceEndpointInfo.IS_STAND_ALONE_MODULE_KEY); 175 176 String appName = appId; 177 String pureWebServiceName = dropAppNameFromWebServiceName(webServiceName); 178 String underScoredWebServiceName = 179 convertHashesToUnderScores(webServiceName); 180 181 WebServiceEndpointConfig wsec = null; 182 183 if(!isStandAlone) { 184 Map <String , J2EEApplicationConfig> map = 185 dc.getJ2EEApplicationConfigMap(); 186 J2EEApplicationConfig appConfig = map.get(appName); 187 if (appConfig == null) { 188 _logger.log(Level.FINE, "Could not find an application with " + 190 " name = "+appName); 191 } else { 192 Map <String , WebServiceEndpointConfig> wsmap = 193 appConfig.getWebServiceEndpointConfigMap(); 194 wsec = wsmap.get(pureWebServiceName); 195 if (wsec == null){ 196 wsec = appConfig.createWebServiceEndpointConfig( 197 pureWebServiceName, null); 198 wsec.setJBIEnabled(false); 199 } 200 for (String jndiname : published.keySet()){ 201 appConfig.createProperty(jndiname+"__"+ 202 underScoredWebServiceName, 203 published.get(jndiname)); 204 } 205 } 206 } else { 207 String type = (String )webServiceInfoMap. 208 get(WebServiceEndpointInfo.SERVICE_IMPL_TYPE_KEY); 209 if(type.equals(WebServiceEndpointInfo.EJB_IMPL)){ 210 Map <String , EJBModuleConfig> map 211 = dc.getEJBModuleConfigMap(); 212 EJBModuleConfig ejbConfig = map.get(appName); 213 if (ejbConfig == null) { 214 _logger.log(Level.FINE, "Could not find a ejb module" + 216 " with name = "+appName); 217 } else{ 218 Map <String , WebServiceEndpointConfig> ejbmap = 219 ejbConfig.getWebServiceEndpointConfigMap(); 220 wsec = ejbmap.get(pureWebServiceName); 221 if (wsec == null){ 222 wsec = ejbConfig.createWebServiceEndpointConfig( 223 pureWebServiceName, null); 224 wsec.setJBIEnabled(false); 225 } 226 for (String jndiname : published.keySet()){ 227 ejbConfig.createProperty(jndiname+"__"+ 228 underScoredWebServiceName, 229 published.get(jndiname)); 230 } 231 } 232 } else if(type.equals(WebServiceEndpointInfo.SERVLET_IMPL)){ 233 Map <String , WebModuleConfig> map = 234 dc.getWebModuleConfigMap(); 235 WebModuleConfig webConfig = map.get(appName); 236 if (webConfig == null){ 237 _logger.log(Level.FINE, "Could not find a web module" + 239 " with name = "+appName); 240 } else{ 241 Map <String , WebServiceEndpointConfig> webmap = 242 webConfig.getWebServiceEndpointConfigMap(); 243 wsec = webmap.get(pureWebServiceName); 244 if (wsec == null){ 245 wsec = webConfig.createWebServiceEndpointConfig( 246 pureWebServiceName, null); 247 wsec.setJBIEnabled(false); 248 } 249 for (String jndiname : published.keySet()){ 250 webConfig.createProperty(jndiname+"__"+ 251 underScoredWebServiceName, 252 published.get(jndiname)); 253 } 254 } 255 } 256 } 257 if(wsec != null){ 258 String [] registryLocations = new String [published.size()]; 259 registryLocations = published.keySet().toArray(registryLocations); 260 populateWebServiceEndpointConfig(wsec, registryLocations); 261 } 262 return; 263 } 264 265 void populateWebServiceEndpointConfig(WebServiceEndpointConfig wsec, 266 String [] registryLocations){ 267 for (String jndi : registryLocations){ 268 wsec.createRegistryLocationConfig(jndi); 269 } 270 } 271 281 void deleteFromConfig(String webServiceName, String [] registryLocations) { 282 if(webServiceInfoMap == null){ 283 _logger.fine("ConfigHelper.deletFromConfig : Incorrect " + 284 "webServiceName. Exiting! "); 285 return; 286 } 287 final DomainConfig dc = getDomainConfig(); 288 String appId = (String )webServiceInfoMap.get( 289 WebServiceEndpointInfo.APP_ID_KEY); 290 291 Boolean isStandAlone = (Boolean )webServiceInfoMap.get( 292 WebServiceEndpointInfo.IS_STAND_ALONE_MODULE_KEY); 293 294 String pureWebServiceName = dropAppNameFromWebServiceName(webServiceName); 295 String underScoredWebServiceName = 296 convertHashesToUnderScores(webServiceName); 297 298 WebServiceEndpointConfig wsec = null; 299 if (!isStandAlone) { 300 Map <String , J2EEApplicationConfig> appMap = 301 dc.getJ2EEApplicationConfigMap(); 302 J2EEApplicationConfig config = appMap.get(appId); 303 Map <String , WebServiceEndpointConfig> wsecMap = 304 config.getWebServiceEndpointConfigMap(); 305 wsec = wsecMap.get(pureWebServiceName); 306 for (int i=0; i<registryLocations.length; i++){ 307 String jndiname = registryLocations[i]; 308 config.removeProperty(jndiname+"__"+ 309 underScoredWebServiceName); 310 } 311 } else { 312 String type = (String )webServiceInfoMap.get( 313 WebServiceEndpointInfo.SERVICE_IMPL_TYPE_KEY); 314 if (type.equals(WebServiceEndpointInfo.EJB_IMPL)){ 315 Map <String , EJBModuleConfig> ejbMap = 316 dc.getEJBModuleConfigMap(); 317 EJBModuleConfig config = ejbMap.get(appId); 318 Map <String , WebServiceEndpointConfig> wsecMap = 319 config.getWebServiceEndpointConfigMap(); 320 wsec = wsecMap.get(pureWebServiceName); 321 for (int i=0; i<registryLocations.length; i++){ 322 String jndiname = registryLocations[i]; 323 config.removeProperty(jndiname+"__"+ 324 underScoredWebServiceName); 325 } 326 327 } else if (type.equals(WebServiceEndpointInfo.SERVLET_IMPL)){ 328 Map <String , WebModuleConfig> webMap = 329 dc.getWebModuleConfigMap(); 330 WebModuleConfig config = webMap.get(appId); 331 Map <String , WebServiceEndpointConfig> wsecMap = 332 config.getWebServiceEndpointConfigMap(); 333 wsec = wsecMap.get(pureWebServiceName); 334 for (int i=0; i<registryLocations.length; i++){ 335 String jndiname = registryLocations[i]; 336 config.removeProperty(jndiname+"__"+ 337 underScoredWebServiceName); 338 } 339 340 } 341 } 342 if (wsec != null){ 343 for (String jndiName : registryLocations ) 344 wsec.removeRegistryLocationConfig(jndiName); 345 } 346 } 347 348 private String dropAppNameFromWebServiceName(String webServiceName){ 349 String [] split = webServiceName.split("#"); 350 StringBuffer buf = new StringBuffer (); 351 for (int i=1; i<split.length; i++){ 352 buf.append(split[i]); 353 if(i<(split.length-1)){ 354 buf.append("#"); 355 } 356 } 357 return buf.toString(); 358 } 359 360 368 String [] listRegistryLocations(){ 369 final DomainConfig dc = this.getDomainConfig(); 370 List <String > jndinames = new ArrayList <String >(); 371 376 Map <String , ConnectorConnectionPoolConfig> ccpcMap = 377 dc.getConnectorConnectionPoolConfigMap(); 378 379 Map <String , ConnectorResourceConfig> crcMap = 380 dc.getConnectorResourceConfigMap(); 381 382 for (String poolName : ccpcMap.keySet() ){ 383 ConnectorConnectionPoolConfig ccpc = ccpcMap.get(poolName); 384 String connectionDefnName = ccpc.getConnectionDefinitionName(); 385 if (JAXR_REGISTRY_TYPE.equals(connectionDefnName) || 386 UDDI_JAXR_REGISTRY_TYPE.equals(connectionDefnName)){ 387 388 for (String resourceName:crcMap.keySet()){ 389 ConnectorResourceConfig crc = crcMap.get(resourceName); 390 if (poolName.equals(crc.getPoolName())) 391 jndinames.add(crc.getJNDIName()); 392 } 393 } 394 } 395 String [] retValue = new String [jndinames.size()]; 396 retValue = jndinames.toArray(retValue); 397 return retValue; 398 } 399 400 408 public void removeRegistryConnectionResources(String jndiNameOfRegistry) { 409 final DomainConfig dc = getDomainConfig(); 410 Map <String , ConnectorResourceConfig> crcMap = 411 dc.getConnectorResourceConfigMap(); 412 ConnectorResourceConfig crc = crcMap.get(jndiNameOfRegistry); 413 String poolName = (crc != null)? crc.getPoolName(): null; 414 dc.removeConnectorResourceConfig(jndiNameOfRegistry); 415 if (poolName != null){ 416 dc.removeConnectorConnectionPoolConfig(poolName); 417 } 418 } 419 420 442 public void addRegistryConnectionResources(String jndiName, 443 String description, String type, Map <String , String > properties){ 444 445 final DomainConfig dc = getDomainConfig(); 446 String registryType = null; 447 if (type == WebServiceMgr.UDDI_KEY) { 448 registryType = this.UDDI_PROPERTY; 449 } else if (type == WebServiceMgr.EBXML_KEY ){ 450 registryType = this.EBXML_PROPERTY; 451 } 452 if (registryType == null) { 453 Object [] params = {UDDI_PROPERTY, EBXML_PROPERTY}; 454 _logger.log(Level.WARNING, "registry.specify_registry_type", params); 455 throw new RuntimeException ("Registry Type has to be "+ 456 UDDI_PROPERTY + " or "+ EBXML_PROPERTY); 457 } 458 Map <String , ResourceAdapterConfig> raConfMap = dc.getResourceAdapterConfigMap(); 460 String resourceAdapterName = null; 462 for (String ra : raConfMap.keySet()){ 463 ResourceAdapterConfig rac = raConfMap.get(ra); 464 if (rac.existsProperty(registryType)){ 465 resourceAdapterName = rac.getResourceAdapterName(); 466 break; 467 } 468 } 469 if (resourceAdapterName == null){ 470 resourceAdapterName = getSystemConnectorResources(registryType); 472 473 if (resourceAdapterName == null){ 474 String msg = 477 "Cannot locate JAXR Resource Adapter to add Connection pool" + 478 " and Connector Resource. Please add connector resource " + 479 "of type " + registryType; 480 _logger.log(Level.SEVERE, 481 "registry.deploy_registry_connector_resource", registryType); 482 throw new RuntimeException (msg); 483 } 484 } 485 486 String poolName = FileUtils.makeFriendlyFileName(jndiName) + POOL_SUFFIX; 488 String connectorDefinitionName = JAXR_REGISTRY_TYPE; 490 if (registryType.equals(UDDI_PROPERTY)){ 491 Properties props = new Properties (); 493 for (String property : properties.keySet()){ 494 String propValue = (String )properties.get(property); 495 if (LifeCycleManagerURL.equals(property) || 496 QueryManagerURL.equals(property)){ 497 if (!propValue.endsWith("/")) { 499 propValue = propValue + "/"; 500 } 501 props.put(property, propValue); 502 } else if (property.equalsIgnoreCase ("username")){ 503 props.put("UserName", propValue); 504 } else if (property.equalsIgnoreCase ("password")){ 505 props.put ("UserPassword", propValue); 506 } else 507 props.put(property, propValue); 508 } 509 510 connectorDefinitionName = UDDI_JAXR_REGISTRY_TYPE; 511 createConnectorConnectionPoolMBean(resourceAdapterName, 512 connectorDefinitionName, poolName, props); 513 } else { 514 Map <String , String > optional = new HashMap <String , String > (); 515 for (String property : properties.keySet()){ 516 optional.put(PropertiesAccess.PROPERTY_PREFIX + property, 517 properties.get (property)); 518 } 519 520 dc.createConnectorConnectionPoolConfig( poolName, 521 resourceAdapterName, connectorDefinitionName, optional ); 522 } 523 dc.createConnectorResourceConfig(jndiName, poolName, null); 524 } 525 526 private void createConnectorConnectionPoolMBean 527 (final String resourceAdapterName, 528 final String connectorDefinitionName, 529 final String poolName, final Properties props) { 530 try{ 531 final MBeanServer server = MBeanServerFactory.getMBeanServer(); 533 ObjectName obj = new ObjectName 534 ("com.sun.appserv:type=resources,category=config"); 535 AttributeList attrlist = new AttributeList (); 536 attrlist.add(new Attribute ("name", poolName)); 537 attrlist.add(new Attribute ("resource-adapter-name", resourceAdapterName)); 538 attrlist.add(new Attribute ("connection-definition-name", connectorDefinitionName)); 539 Object [] params = new Object [3]; 540 params[0] = attrlist; 541 params[1] = props; 542 params[2] = "server"; 543 String [] signature = new String [3]; 544 signature[0] = "javax.management.AttributeList"; 545 signature[1] = "java.util.Properties"; 546 signature[2] = "java.lang.String"; 547 server.invoke(obj, "createConnectorConnectionPool", 548 params, signature); 549 } catch (Exception e) { 550 _logger.log(Level.WARNING, "cannot create connection pool for " + 551 "resource adapter ="+resourceAdapterName, e); 552 } 553 } 554 private String getSystemConnectorResources(String type){ 558 String [] systemResources = null; 559 560 final MBeanServer server = MBeanServerFactory.getMBeanServer(); 561 try { 562 ObjectName objName = 563 new ObjectName ("com.sun.appserv:type=resources,category=config"); 564 systemResources = (String [])server.invoke( objName, 565 "getSystemConnectorsAllowingPoolCreation", null, null); 566 for (int i =0; i< systemResources.length; i++){ 567 if (ignore_ra.equals(systemResources[i])) continue; 569 570 AttributeList attrList = new AttributeList (); 571 attrList.add(new Attribute ("resource-adapter-name", 572 systemResources[i])); 573 if (UDDI_PROPERTY.equals (type)) 574 attrList.add(new Attribute ("connection-definition-name", 575 UDDI_JAXR_REGISTRY_TYPE)); 576 else 577 attrList.add(new Attribute ("connection-definition-name", 578 JAXR_REGISTRY_TYPE)); 579 580 Object [] params = new Object []{attrList}; 581 String [] types = new String []{"javax.management.AttributeList"}; 582 Properties properties = 583 (Properties )server.invoke(new ObjectName 584 ("com.sun.appserv:type=resources,category=config"), 585 "getMCFConfigProps", 586 params, types ); 587 588 Enumeration propertyNames = properties.propertyNames(); 589 while(propertyNames.hasMoreElements()){ 590 String name = (String )propertyNames.nextElement(); 591 if (UDDI_PROPERTY.equals(type)){ 592 if (name.equals(APPSERVER_UDDI)) 593 return systemResources[i]; 594 } else if (EBXML_PROPERTY.equals(type)) { if (name.equals(APPSERVER_EBXML)) 598 return systemResources[i]; 599 } 600 } 601 } 602 } catch (Exception e) { 603 _logger.log (Level.FINE, "Cannot locate system connector resources"); 604 } 605 606 return null; 607 } 608 private DomainConfig getDomainConfig(){ 609 final MBeanServer server = MBeanServerFactory.getMBeanServer(); 610 final DomainRoot domainRoot = 611 ProxyFactory.getInstance(server).getDomainRoot(); 612 final DomainConfig domainConfig = domainRoot.getDomainConfig(); 613 return domainConfig; 614 } 615 616 public String [] listAlreadyPublishedRegistryLocations(String webServiceName, 617 String [] registryLocations) { 618 619 String [] prePublished = null; 620 if(webServiceInfoMap == null){ 621 _logger.fine("ConfigHelper.addToConfig : Incorrect webServiceName "); 622 return prePublished; 623 } 624 final DomainConfig dc = this.getDomainConfig(); 625 String appId = (String )webServiceInfoMap.get( 626 WebServiceEndpointInfo.APP_ID_KEY); 627 628 Boolean isStandAlone = (Boolean )webServiceInfoMap.get( 629 WebServiceEndpointInfo.IS_STAND_ALONE_MODULE_KEY); 630 631 String appName = appId; 632 String pureWebServiceName = dropAppNameFromWebServiceName(webServiceName); 633 WebServiceEndpointConfig wsec = null; 634 635 if(!isStandAlone) { 636 Map <String , J2EEApplicationConfig> map = 637 dc.getJ2EEApplicationConfigMap(); 638 J2EEApplicationConfig appConfig = map.get(appName); 639 if (appConfig == null) { 640 _logger.log(Level.FINE, "Could not find an application with " + 642 " name = "+appName); 643 } else { 644 Map <String , WebServiceEndpointConfig> wsmap = 645 appConfig.getWebServiceEndpointConfigMap(); 646 wsec = wsmap.get(pureWebServiceName); 647 } 648 } else { 649 String type = (String )webServiceInfoMap. 650 get(WebServiceEndpointInfo.SERVICE_IMPL_TYPE_KEY); 651 if(type.equals(WebServiceEndpointInfo.EJB_IMPL)){ 652 Map <String , EJBModuleConfig> map 653 = dc.getEJBModuleConfigMap(); 654 EJBModuleConfig ejbConfig = map.get(appName); 655 if (ejbConfig == null) { 656 _logger.log(Level.FINE, "Could not find a ejb module" + 658 " with name = "+appName); 659 } else{ 660 Map <String , WebServiceEndpointConfig> ejbmap = 661 ejbConfig.getWebServiceEndpointConfigMap(); 662 wsec = ejbmap.get(pureWebServiceName); 663 } 664 } else if(type.equals(WebServiceEndpointInfo.SERVLET_IMPL)){ 665 Map <String , WebModuleConfig> map = 666 dc.getWebModuleConfigMap(); 667 WebModuleConfig webConfig = map.get(appName); 668 if (webConfig == null){ 669 _logger.log(Level.FINE, "Could not find a web module" + 671 " with name = "+appName); 672 } else{ 673 Map <String , WebServiceEndpointConfig> webmap = 674 webConfig.getWebServiceEndpointConfigMap(); 675 wsec = webmap.get(pureWebServiceName); 676 } 677 } 678 } 679 if(wsec != null){ 680 Map <String , RegistryLocationConfig> regMap = 681 wsec.getRegistryLocationConfigMap(); 682 prePublished = new String [regMap.size()]; 683 int i = 0; 684 for (String regLoc : regMap.keySet()){ 685 RegistryLocationConfig rlc = regMap.get(regLoc); 686 prePublished [i++] = 687 new String (rlc.getConnectorResourceJNDIName()); 688 } 689 } 690 return prePublished; 691 } 692 693 String getOrganizationName(String webServiceName, String registryLocation){ 694 String organization = null; 695 if(webServiceInfoMap == null){ 696 _logger.fine("ConfigHelper.addToConfig : Incorrect webServiceName "); 697 return null; 698 } 699 final DomainConfig dc = this.getDomainConfig(); 700 String appId = (String )webServiceInfoMap.get( 701 WebServiceEndpointInfo.APP_ID_KEY); 702 703 Boolean isStandAlone = (Boolean )webServiceInfoMap.get( 704 WebServiceEndpointInfo.IS_STAND_ALONE_MODULE_KEY); 705 706 String appName = appId; 707 String underScoredWebServiceName = 708 convertHashesToUnderScores(webServiceName); 709 710 if(!isStandAlone) { 711 Map <String , J2EEApplicationConfig> map = 712 dc.getJ2EEApplicationConfigMap(); 713 J2EEApplicationConfig appConfig = map.get(appName); 714 if (appConfig == null) { 715 _logger.log(Level.FINE, "Could not find an application with " + 717 " name = "+appName); 718 } else { 719 organization = 720 (String )appConfig.getPropertyValue(registryLocation+"__"+ 721 underScoredWebServiceName); 722 } 723 } else { 724 String type = (String )webServiceInfoMap. 725 get(WebServiceEndpointInfo.SERVICE_IMPL_TYPE_KEY); 726 if(type.equals(WebServiceEndpointInfo.EJB_IMPL)){ 727 Map <String , EJBModuleConfig> map 728 = dc.getEJBModuleConfigMap(); 729 EJBModuleConfig ejbConfig = map.get(appName); 730 if (ejbConfig == null) { 731 _logger.log(Level.FINE, "Could not find a ejb module" + 733 " with name = "+appName); 734 } else{ 735 organization = 736 (String )ejbConfig.getPropertyValue(registryLocation+ 737 "__"+ underScoredWebServiceName); 738 } 739 } else if(type.equals(WebServiceEndpointInfo.SERVLET_IMPL)){ 740 Map <String , WebModuleConfig> map = 741 dc.getWebModuleConfigMap(); 742 WebModuleConfig webConfig = map.get(appName); 743 if (webConfig == null){ 744 _logger.log(Level.FINE, "Could not find a web module" + 746 " with name = "+appName); 747 } else{ 748 organization = 749 (String )webConfig.getPropertyValue(registryLocation+ 750 "__"+ underScoredWebServiceName); 751 } 752 } 753 } 754 return organization; 755 } 756 761 762 private String convertHashesToUnderScores(String hashed){ 763 String returnValue = hashed.replaceAll("#", "__"); 764 return returnValue; 765 } 766 767 public String [] checkForDuplicateRegistries (String [] jndi) { 768 if (jndi.length <=1) 769 return null; 770 String [] duplicate = null; 772 for (int i = 0; i<jndi.length; i++){ 773 for (int j=i+1; j<jndi.length; j++){ 774 if (jndi[i].equals (jndi[j])){ 775 duplicate = new String [1]; 776 duplicate[0] = jndi[i]; 777 this._logger.log (Level.SEVERE, 778 "Duplicate Registry Jndi Names. Will not" + 779 " publish the same " + 780 "web service twice to the same registry. " + 781 "Remove one jndi name ("+jndi[i]+")"); 782 return duplicate; 783 } 784 } 785 } 786 if (duplicate == null){ 787 final DomainConfig dc = this.getDomainConfig (); 788 Map <String , ConnectorResourceConfig> crcMap = 789 dc.getConnectorResourceConfigMap (); 790 for (int i = 0; i<jndi.length; i++){ 791 ConnectorResourceConfig crc = crcMap.get (jndi[i]); 792 String pool = crc.getPoolName (); 793 for (int j=i+1; j<jndi.length; j++){ 794 ConnectorResourceConfig crcNew = crcMap.get (jndi[j]); 795 if(pool.equals (crcNew.getPoolName())){ 796 duplicate = new String [2]; 797 duplicate[0] = jndi[i]; 798 duplicate[1] = jndi[j]; 799 this._logger.log (Level.SEVERE, 800 "Registry Jndi Names point to the same registry. Will not" + 801 " publish the same " + 802 "web service twice to the same registry. " + 803 "Remove one duplicate of ("+jndi[i]+")" + 804 " or ("+jndi[j]+")"); 805 return duplicate; 806 } 807 } 808 } 809 } 810 return null; 811 } 812 } 813 | Popular Tags |