1 23 24 package com.sun.enterprise.deployment.phasing; 25 26 import com.sun.enterprise.admin.common.exception.DeploymentException; 27 import com.sun.enterprise.admin.common.exception.ServerInstanceException; 28 import com.sun.enterprise.admin.common.MBeanServerFactory; 29 import com.sun.enterprise.admin.common.ObjectNames; 30 import com.sun.enterprise.admin.event.AdminEvent; 31 import com.sun.enterprise.admin.event.AdminEventCache; 32 import com.sun.enterprise.admin.event.AdminEventListenerException; 33 import com.sun.enterprise.admin.event.AdminEventMulticaster; 34 import com.sun.enterprise.admin.event.AdminEventResult; 35 import com.sun.enterprise.admin.event.EventBuilder; 36 import com.sun.enterprise.admin.event.EventContext; 37 import com.sun.enterprise.admin.event.EventStack; 38 import com.sun.enterprise.admin.event.ModuleDeployEvent; 39 import com.sun.enterprise.admin.server.core.AdminService; 40 import com.sun.enterprise.admin.server.core.DeploymentNotificationHelper; 41 import com.sun.enterprise.admin.target.TargetType; 42 import com.sun.enterprise.admin.util.HostAndPort; 43 import com.sun.enterprise.config.ConfigBean; 44 import com.sun.enterprise.config.ConfigBeansFactory; 45 import com.sun.enterprise.config.ConfigContext; 46 import com.sun.enterprise.config.ConfigException; 47 import com.sun.enterprise.config.serverbeans.ApplicationHelper; 48 import com.sun.enterprise.config.serverbeans.ClusterHelper; 49 import com.sun.enterprise.config.serverbeans.Config; 50 import com.sun.enterprise.config.serverbeans.HttpService; 51 import com.sun.enterprise.config.serverbeans.PropertyResolver; 52 import com.sun.enterprise.config.serverbeans.ServerHelper; 53 import com.sun.enterprise.config.serverbeans.ServerTags; 54 import com.sun.enterprise.config.serverbeans.ServerXPathHelper; 55 import com.sun.enterprise.config.serverbeans.VirtualServer; 56 import com.sun.enterprise.deployment.Application; 57 import com.sun.enterprise.deployment.archivist.Archivist; 58 import com.sun.enterprise.deployment.archivist.ArchivistFactory; 59 import com.sun.enterprise.deployment.backend.AppDD; 60 import com.sun.enterprise.deployment.backend.ClientJarMakerRegistry; 61 import com.sun.enterprise.deployment.backend.DeployableObjectType; 62 import com.sun.enterprise.deployment.backend.DeploymentLogger; 63 import com.sun.enterprise.deployment.backend.DeploymentRequest; 64 import com.sun.enterprise.deployment.backend.DeploymentRequestRegistry; 65 import com.sun.enterprise.deployment.backend.IASDeploymentException; 66 import com.sun.enterprise.deployment.interfaces.DeploymentImplConstants; 67 import com.sun.enterprise.deployment.pluggable.DeploymentFactory; 68 import com.sun.enterprise.deployment.util.DeploymentProperties; 69 import com.sun.enterprise.deployment.util.ModuleDescriptor; 70 import com.sun.enterprise.deployment.WebBundleDescriptor; 71 import com.sun.enterprise.instance.AppsManager; 72 import com.sun.enterprise.instance.WebModulesManager; 73 import com.sun.enterprise.instance.EjbModulesManager; 74 import com.sun.enterprise.instance.ConnectorModulesManager; 75 import com.sun.enterprise.instance.AppclientModulesManager; 76 import com.sun.enterprise.instance.BaseManager; 77 import com.sun.enterprise.instance.InstanceEnvironment; 78 import com.sun.enterprise.server.ApplicationServer; 79 import com.sun.enterprise.server.Constants; 80 import com.sun.enterprise.util.i18n.StringManager; 81 import com.sun.enterprise.util.io.FileUtils; 82 import com.sun.enterprise.util.RelativePathResolver; 83 import com.sun.enterprise.util.StringUtils; 84 import com.sun.enterprise.util.SystemPropertyConstants; 85 import com.sun.enterprise.util.FileUtil; 86 import com.sun.enterprise.resource.Resource; 87 import com.sun.enterprise.resource.ResourcesXMLParser; 88 89 import java.io.File ; 90 import java.io.FilenameFilter ; 91 import java.util.Enumeration ; 92 import java.util.logging.Level ; 93 import java.util.logging.Logger ; 94 import java.util.Properties ; 95 import java.util.ArrayList ; 96 import java.util.Map ; 97 import java.util.Iterator ; 98 import java.util.List ; 99 import java.util.ListIterator ; 100 import java.util.StringTokenizer ; 101 import java.util.Set ; 102 import java.util.HashSet ; 103 import java.util.HashMap ; 104 import java.net.URL ; 105 import java.net.URLClassLoader ; 106 import java.net.InetAddress ; 107 import java.net.UnknownHostException ; 108 import javax.enterprise.deploy.shared.ModuleType ; 109 import javax.management.Attribute ; 110 import javax.management.AttributeList ; 111 import javax.management.InstanceNotFoundException ; 112 import javax.management.MBeanException ; 113 import javax.management.MBeanServer ; 114 import javax.management.ObjectName ; 115 116 public class DeploymentServiceUtils { 117 118 119 public static final Logger sLogger = DeploymentLogger.get(); 120 121 122 private static StringManager localStrings = 123 StringManager.getManager( DeploymentServiceUtils.class ); 124 125 private static final Object [] emptyParams = new Object []{}; 126 private static final String [] emptySignature = new String []{}; 127 128 131 public static String getClientJarPath(String moduleID) { 132 133 ClientJarMakerRegistry registry = ClientJarMakerRegistry.getInstance(); 135 136 if (registry.isRegistered(moduleID)) { 137 138 registry.waitForCompletion(moduleID); 140 } 141 142 return moduleID + DeploymentImplConstants.ClientJarSuffix; 143 144 } 145 146 155 static boolean multicastEvent(int eventType, String entityName, 156 String targetName) throws IASDeploymentException { 157 return multicastEvent(eventType, entityName, null, targetName); 158 } 159 160 static boolean multicastEvent(int eventType, String entityName, 161 String moduleType, String targetName) 162 throws IASDeploymentException { 163 return multicastEvent(eventType,entityName,moduleType, false, targetName); 164 } 165 166 176 static boolean multicastEvent(int eventType, String entityName, 177 String moduleType, boolean cascade, String targetName) throws IASDeploymentException { 178 return multicastEvent(eventType, entityName, moduleType, cascade, false, targetName) ; 179 } 180 181 static boolean multicastEvent(int eventType, String entityName, 182 String moduleType, boolean cascade, boolean forceDeploy, String targetName) throws IASDeploymentException { 183 return multicastEvent(eventType, entityName, moduleType, cascade, forceDeploy, Constants.LOAD_UNSET, targetName) ; 184 } 185 186 public static boolean multicastEvent(int eventType, String entityName, 187 String moduleType, boolean cascade, boolean forceDeploy, int loadUnloadAction, String targetName) 188 throws IASDeploymentException { 189 190 try { 193 ConfigContext config = getConfigContext(); 194 if (config != null && config.isChanged()) { 195 config.flush(); 196 } else { 197 } 199 } catch (ConfigException ce) { 200 throw new IASDeploymentException(ce); 201 } 202 try { 203 return DeploymentNotificationHelper.multicastEvent(eventType, entityName, 204 moduleType, cascade, forceDeploy, loadUnloadAction, targetName); 205 } catch (Throwable t) { 206 IASDeploymentException iasEx = new IASDeploymentException(t.getMessage()); 207 iasEx.initCause(t); 208 throw iasEx; 209 } 210 } 212 213 223 public static String getModuleTypeString(DeployableObjectType moduleType) 224 { 225 String moduleTypeString = null; 226 if (moduleType.equals(DeployableObjectType.EJB)) 227 { 228 moduleTypeString = ModuleDeployEvent.TYPE_EJBMODULE; 229 } 230 else if(moduleType.equals(DeployableObjectType.WEB)) 231 { 232 moduleTypeString = ModuleDeployEvent.TYPE_WEBMODULE; 233 } 234 else if(moduleType.equals(DeployableObjectType.CONN)) 235 { 236 moduleTypeString = ModuleDeployEvent.TYPE_CONNECTOR; 237 } 238 else if (moduleType.equals(DeployableObjectType.CAR)) 239 { 240 moduleTypeString = ModuleDeployEvent.TYPE_APPCLIENT; 241 } 242 return moduleTypeString; 243 } 244 245 public static BaseManager getInstanceManager( 246 DeployableObjectType moduleType) { 247 try { 248 InstanceEnvironment insEnv = 249 new InstanceEnvironment(getInstanceName()); 250 if (moduleType.equals(DeployableObjectType.APP)) { 251 return new AppsManager(insEnv); 252 } else if (moduleType.equals(DeployableObjectType.EJB)) { 253 return new EjbModulesManager(insEnv); 254 } else if(moduleType.equals(DeployableObjectType.WEB)) { 255 return new WebModulesManager(insEnv); 256 } else if(moduleType.equals(DeployableObjectType.CONN)) { 257 return new ConnectorModulesManager(insEnv); 258 } else if (moduleType.equals(DeployableObjectType.CAR)) { 259 return new AppclientModulesManager(insEnv); 260 } else { 261 return null; 263 } 264 } catch (Exception e) { 265 return null; 266 } 267 } 268 269 270 283 public static String [] getContextRootsForEmbeddedWebApp(String appName) 284 throws IASDeploymentException { 285 try { 286 AppsManager appsManager = 287 new AppsManager(new InstanceEnvironment(getInstanceName())); 288 Application application = 289 appsManager.getRegisteredDescriptor(appName); 290 if (application != null) { 292 ArrayList contextRoots = new ArrayList (); 293 for (Iterator itr = application.getWebBundleDescriptors().iterator(); itr.hasNext();) { 294 WebBundleDescriptor wbd = (WebBundleDescriptor) itr.next(); 295 contextRoots.add(wbd.getContextRoot()); 296 } 297 return (String [])contextRoots.toArray(new String [contextRoots.size()]); 298 } else { 300 String xmlDir = appsManager.getGeneratedXMLLocation(appName); 304 if (!FileUtils.safeIsDirectory(xmlDir)) { 305 String appDir = appsManager.getLocation(appName); 306 sLogger.log(Level.WARNING, "core.no_xmldir", 308 new Object []{xmlDir, appDir}); 309 xmlDir = appDir; 310 } 311 AppDD appDD = new AppDD(new File (xmlDir)); 312 return appDD.getContextRoots(); 313 } 314 } catch (Exception e) { 315 if (e instanceof IASDeploymentException) { 316 throw (IASDeploymentException)e; 317 } else { 318 throw new IASDeploymentException(e); 319 } 320 } 321 } 322 323 public static List <String > getTargetNamesFromTargetString ( 324 String targetString) { 325 if (targetString == null) { 326 return null; 327 } 328 StringTokenizer st = new StringTokenizer (targetString); 329 List <String > targetNames = new ArrayList <String >(); 330 while (st.hasMoreTokens()) { 331 targetNames.add(st.nextToken()); 332 } 333 return targetNames; 334 } 335 336 public static void setResourceOptionsInRequest (DeploymentRequest req, 337 DeploymentProperties props) { 338 req.setResourceAction(props.getResourceAction()); 339 req.setResourceTargetList(props.getResourceTargetList()); 340 } 341 342 public static FilenameFilter getFilenameFilter(final String fileName){ 343 FilenameFilter filter = new FilenameFilter () { 344 public boolean accept(File dir, String name) { 345 if ( (new File (dir, name)).isDirectory()) { 346 return true; 347 } else if (name !=null && name.equals(fileName)){ 348 return true; 349 } else { 350 return false; 351 } 352 } 353 }; 354 return filter; 355 } 356 357 public static List <Resource> getResources(String appId, 358 DeployableObjectType moduleType) { 359 try { 360 String directoryToLook = 363 getInstanceManager(moduleType).getGeneratedXMLLocation(appId); 364 Set listOfFiles = FileUtil.getAllFilesUnder( 365 new File (directoryToLook), 366 getFilenameFilter(SUN_RESOURCE_XML), true); 367 368 ArrayList <String > expectedXMLPaths = new ArrayList <String >(); 370 Application app = getInstanceManager( 371 moduleType).getRegisteredDescriptor(appId); 372 373 if (app != null) { 374 if (app.isVirtual()) { 375 expectedXMLPaths.add(SUN_RESOURCE_XML_PATH); 377 } else { 378 expectedXMLPaths.add(SUN_RESOURCE_XML_PATH); 381 for (Iterator itr = app.getModules();itr.hasNext();) { 383 ModuleDescriptor aModule = 384 (ModuleDescriptor) itr.next(); 385 String moduleUri = FileUtils.makeFriendlyFileName( 386 aModule.getArchiveUri()); 387 String subModulePath = moduleUri + 388 File.separator + SUN_RESOURCE_XML_PATH; 389 expectedXMLPaths.add(subModulePath); 390 } 391 } 392 } else { 393 expectedXMLPaths.add(SUN_RESOURCE_XML_PATH); 395 } 396 397 HashMap <String , List <Resource>> resourcesListMap = 400 new HashMap <String , List <Resource>>(); 401 402 for (Iterator fIter = listOfFiles.iterator(); fIter.hasNext(); ) { 403 File file = (File )fIter.next(); 404 String filePath = file.getPath(); 405 String xmlFilePath = 406 (new File (directoryToLook, filePath)).getAbsolutePath(); 407 if (expectedXMLPaths.contains(filePath)) { 408 ResourcesXMLParser allResources = 409 new ResourcesXMLParser(xmlFilePath); 410 resourcesListMap.put(filePath, 411 allResources.getResourcesList()); 412 } else { 413 sLogger.log(Level.WARNING, 414 "enterprise.deployment.ignore.sun.resources.xml", 415 xmlFilePath); 416 } 417 } 418 419 423 return simpleProcessResourcesListMap(resourcesListMap); 424 425 } catch (Exception e) { 426 sLogger.log(Level.WARNING, 427 "enterprise.deployment.error.get.resources", 428 e.getMessage()); 429 return new ArrayList <Resource>(); 430 } 431 } 432 433 private static List <Resource> simpleProcessResourcesListMap( 436 HashMap <String , List <Resource>> resourcesListMap) { 437 List <Resource> globalList = new ArrayList <Resource>(); 438 for (Iterator <List <Resource>> mapIter = 439 resourcesListMap.values().iterator(); mapIter.hasNext();) { 440 globalList.addAll(mapIter.next()); 441 } 442 return globalList; 443 } 444 445 private static List <Resource> processResourcesListMap( 448 HashMap <String , List <Resource>> resourcesListMap) { 449 450 boolean hasTopLevel = false; 453 454 List <Resource> globalResourcesList = new ArrayList <Resource>(); 456 457 460 for (Iterator <String > mapIter = resourcesListMap.keySet().iterator(); 463 mapIter.hasNext();){ 464 String path = mapIter.next(); 465 if (path.equals(SUN_RESOURCE_XML_PATH)) { 466 hasTopLevel = true; 467 continue; 468 } else { 469 processResourceListForXMLPath(globalResourcesList, 470 resourcesListMap, path); 471 } 472 } 473 474 if (hasTopLevel) { 476 processResourceListForXMLPath(globalResourcesList, 477 resourcesListMap, SUN_RESOURCE_XML_PATH); 478 } 479 480 return globalResourcesList; 481 } 482 483 private static void processResourceListForXMLPath( 484 List <Resource> globalResourcesList, 485 HashMap <String , List <Resource>> resourcesListMap, String xmlPath) { 486 List <Resource> resourcesList = resourcesListMap.get(xmlPath); 487 for (Iterator <Resource> resIter = resourcesList.iterator(); 488 resIter.hasNext();) { 489 Resource newResource = resIter.next(); 490 for (Iterator <Resource> globalResIter = 493 globalResourcesList.iterator(); globalResIter.hasNext();) { 494 Resource resourceInList = globalResIter.next(); 495 if (newResource.equals(resourceInList) || 496 newResource.isAConflict(resourceInList)) { 497 globalResourcesList.remove(resourceInList); 498 break; 499 } 500 } 501 globalResourcesList.add(newResource); 502 } 503 } 504 505 public static String getLocation(File appDir) 509 { 510 if (appDir != null) { 511 return (RelativePathResolver.unresolvePath( 512 appDir.getAbsolutePath(), 513 new String [] {SystemPropertyConstants.INSTANCE_ROOT_PROPERTY, 514 SystemPropertyConstants.INSTALL_ROOT_PROPERTY})); 515 } else { 516 return null; 517 } 518 } 519 520 523 public static String getLocation(String appId, DeployableObjectType type) 525 throws IASDeploymentException { 526 try { 527 MBeanServer mbs = MBeanServerFactory.getMBeanServer(); 528 String getOperationName = getGetOperationName(type); 529 ObjectName appsConfigMBean = new ObjectName (appsConfigMBeanName); 530 ObjectName componentON = (ObjectName )mbs.invoke(appsConfigMBean, getOperationName, new Object []{appId},new String []{"java.lang.String"}); 531 String location = (String )mbs.getAttribute(componentON, 532 ServerTags.LOCATION); 533 return (new RelativePathResolver()).resolve(location); 534 } catch (Exception e) { 535 throw new IASDeploymentException(e); 536 } 537 } 538 539 public static boolean isEnabled(String appId, DeployableObjectType type) 541 throws IASDeploymentException { 542 try { 543 MBeanServer mbs = MBeanServerFactory.getMBeanServer(); 544 String getOperationName = getGetOperationName(type); 545 ObjectName appsConfigMBean = new ObjectName (appsConfigMBeanName); 546 ObjectName componentON = (ObjectName )mbs.invoke(appsConfigMBean, getOperationName, new Object []{appId},new String []{"java.lang.String"}); 547 548 String enabled = (String )mbs.getAttribute(componentON, 549 ServerTags.ENABLED); 550 return Boolean.valueOf(enabled).booleanValue(); 551 } catch (Exception e) { 552 throw new IASDeploymentException(e); 553 } 554 } 555 556 public static boolean isDirectoryDeployed(String appId, 558 DeployableObjectType type) throws IASDeploymentException { 559 try { 560 MBeanServer mbs = MBeanServerFactory.getMBeanServer(); 561 String getOperationName = getGetOperationName(type); 562 ObjectName appsConfigMBean = new ObjectName (appsConfigMBeanName); 563 ObjectName componentON = (ObjectName )mbs.invoke(appsConfigMBean, getOperationName, new Object []{appId},new String []{"java.lang.String"}); 564 565 String directoryDeployed = (String )mbs.getAttribute(componentON, 566 ServerTags.DIRECTORY_DEPLOYED); 567 return Boolean.valueOf(directoryDeployed).booleanValue(); 568 } catch (Exception e) { 569 throw new IASDeploymentException(e); 570 } 571 } 572 573 public static String getObjectType(String appId, DeployableObjectType type) 575 throws IASDeploymentException { 576 try { 577 if (type.isCAR()) { 579 return null; 580 } 581 MBeanServer mbs = MBeanServerFactory.getMBeanServer(); 582 String getOperationName = getGetOperationName(type); 583 ObjectName appsConfigMBean = new ObjectName (appsConfigMBeanName); 584 ObjectName componentON = (ObjectName )mbs.invoke(appsConfigMBean, getOperationName, new Object []{appId},new String []{"java.lang.String"}); 585 586 String objectType = 587 (String )mbs.getAttribute(componentON, ServerTags.OBJECT_TYPE); 588 return objectType; 589 } catch (Exception e) { 590 throw new IASDeploymentException(e); 591 } 592 } 593 594 public static void setContextRoot(String appId, DeployableObjectType type, 596 String contextRoot) throws IASDeploymentException { 597 try { 598 MBeanServer mbs = MBeanServerFactory.getMBeanServer(); 599 String getOperationName = getGetOperationName(type); 600 ObjectName appsConfigMBean = new ObjectName (appsConfigMBeanName); 601 ObjectName componentON = (ObjectName )mbs.invoke(appsConfigMBean, getOperationName, new Object []{appId},new String []{"java.lang.String"}); 602 603 604 if (contextRoot != null && contextRoot.length() > 0 ) { 605 Attribute contextRootAttr = new Attribute (ServerTags.CONTEXT_ROOT, 606 contextRoot); 607 mbs.setAttribute(componentON, contextRootAttr); 608 } 609 } catch (Exception e) { 610 throw new IASDeploymentException(e); 611 } 612 } 613 614 public static boolean isSystem(String appId, DeployableObjectType type) 616 throws IASDeploymentException{ 617 String objectType = getObjectType(appId, type); 618 if (objectType != null) { 619 return objectType.startsWith(SYSTEM_PREFIX); 620 } else { 621 return false; 622 } 623 } 624 625 private static AttributeList populateAttributeList( 626 DeploymentRequest request) throws IASDeploymentException { 627 AttributeList attrList = new AttributeList (); 628 629 String name = request.getName(); 630 if (name != null && name.length() > 0 ) { 632 Attribute nameAttr = new Attribute (ServerTags.NAME, name); 633 attrList.add(nameAttr); 634 } 635 636 String location = getLocation(request.getDeployedDirectory()); 638 if (location != null && location.length() > 0 ) { 639 Attribute locationAttr = new Attribute (ServerTags.LOCATION, location); 640 attrList.add(locationAttr); 641 } 642 643 String description = request.getDescription(); 645 if (description != null && description.length() > 0 ) { 646 Attribute descriptionAttr = 647 new Attribute (ServerTags.DESCRIPTION, description); 648 attrList.add(descriptionAttr); 649 } 650 651 if (! request.getType().isCAR()) { 653 String enabled = String.valueOf(request.isStartOnDeploy()); 654 if (enabled != null && enabled.length() > 0 ) { 655 Attribute enableAttr = new Attribute (ServerTags.ENABLED, enabled); 656 attrList.add(enableAttr); 657 } 658 } 659 660 if (request.getType().isAPP() || request.getType().isCAR()) { 663 String jwsEnabled = 664 String.valueOf(request.isJavaWebStartEnabled()); 665 if (jwsEnabled != null && jwsEnabled.length() > 0 ) { 666 Attribute jwsEnableAttr = new Attribute ( 667 ServerTags.JAVA_WEB_START_ENABLED, jwsEnabled); 668 attrList.add(jwsEnableAttr); 669 } 670 } 671 672 if (request.getType().isAPP() || request.getType().isEJB() || 675 request.getType().isWEB()) { 676 String libraries = request.getLibraries(); 677 if (libraries != null && libraries.length() > 0 ) { 678 Attribute librariesAttr = new Attribute ( 679 ServerTags.LIBRARIES, libraries); 680 attrList.add(librariesAttr); 681 } 682 } 683 684 if (request.getType().isWEB()) { 686 String contextRoot = request.getContextRoot(); 687 if (contextRoot != null && contextRoot.length() > 0 ) { 688 Attribute contextRootAttr = 689 new Attribute (ServerTags.CONTEXT_ROOT, contextRoot); 690 attrList.add(contextRootAttr); 691 } 692 } 693 694 if (! request.getType().isCAR() && ! request.getType().isCONN()) { 697 String availEnabled = String.valueOf(request.isAvailabilityEnabled()); 698 if (availEnabled!= null && availEnabled.length() > 0 ) { 699 Attribute availEnabledAttr = 700 new Attribute (ServerTags.AVAILABILITY_ENABLED, availEnabled); 701 attrList.add(availEnabledAttr); 702 } 703 } 704 705 String dirDeployed = String.valueOf(request.isDirectory()); 707 if (dirDeployed != null && dirDeployed.length() > 0 ) { 708 Attribute dirDeployedAttr = 709 new Attribute (ServerTags.DIRECTORY_DEPLOYED, dirDeployed); 710 attrList.add(dirDeployedAttr); 711 } 712 713 714 Properties optionalAttributes = request.getOptionalAttributes(); 716 if (optionalAttributes != null) { 717 Properties mProps = (Properties) optionalAttributes.clone(); 723 try { 724 mProps.remove(ServerTags.VIRTUAL_SERVERS); 725 } catch(Exception re) {} 726 727 Enumeration tags = mProps.keys(); 728 while(tags.hasMoreElements()) { 729 String tag = (String )tags.nextElement(); 730 String value = mProps.getProperty(tag); 731 if (tag != null & tag.length() > 0 && 732 value != null && value.length() > 0) { 733 Attribute optionalAttr = new Attribute (tag, value); 734 attrList.add(optionalAttr); 735 } 736 } 737 } 738 739 return attrList; 740 } 741 742 public static void addToConfig(DeploymentRequest request) 744 throws IASDeploymentException { 745 try { 746 DeployableObjectType type = request.getType(); 747 MBeanServer mbs = MBeanServerFactory.getMBeanServer(); 748 ObjectName appsConfigMBean = new ObjectName (appsConfigMBeanName); 749 750 String createOperationName = getCreateOperationName(type); 751 752 AttributeList attrList = populateAttributeList(request); 753 754 String [] signature = new String [] {AttributeList .class.getName()}; 755 Object [] params = new Object [] {attrList}; 756 mbs.invoke(appsConfigMBean, createOperationName, params, signature); 757 getConfigContext().flush(); 758 getConfigContext().resetConfigChangeList(); 759 } catch (Exception e) { 760 if (e instanceof IASDeploymentException) { 761 throw (IASDeploymentException)e; 762 } else { 763 throw new IASDeploymentException(e); 764 } 765 } 766 } 767 768 public static void updateConfig(DeploymentRequest request) 770 throws IASDeploymentException { 771 try { 772 String name = request.getName(); 773 ConfigBean appBean = 774 ApplicationHelper.findApplication(getConfigContext(), name); 775 if (appBean != null) { 776 for (Iterator itr = populateAttributeList(request).iterator(); 777 itr.hasNext();) { 778 Attribute attr = (Attribute )itr.next(); 779 appBean.setAttributeValue(attr.getName(), 780 (String )attr.getValue()); 781 } 782 getConfigContext().flush(); 783 getConfigContext().resetConfigChangeList(); 784 } 785 } catch (Exception e) { 786 if (e instanceof IASDeploymentException) { 787 throw (IASDeploymentException)e; 788 } else { 789 throw new IASDeploymentException(e); 790 } 791 } 792 } 793 794 public static void removeFromConfig(String name, DeployableObjectType type) 796 throws IASDeploymentException { 797 try { 798 MBeanServer mbs = MBeanServerFactory.getMBeanServer(); 799 String getOperationName = getGetOperationName(type); 800 ObjectName appsConfigMBean = new ObjectName (appsConfigMBeanName); 801 ObjectName componentON = (ObjectName )mbs.invoke(appsConfigMBean, getOperationName, new Object []{name},new String []{"java.lang.String"}); 802 if(componentON != null){ 803 String removeOperationName = getRemoveOperationName(type); 804 mbs.invoke(appsConfigMBean, removeOperationName, new Object []{name},new String []{"java.lang.String"}); 805 getConfigContext().flush(); 806 getConfigContext().resetConfigChangeList(); 807 } 808 } catch (Exception e) { 809 throw new IASDeploymentException(e); 810 } 811 } 812 813 public static boolean isRegistered(String appName, 814 DeployableObjectType type) throws IASDeploymentException { 815 try { 816 MBeanServer mbs = MBeanServerFactory.getMBeanServer(); 817 String getOperationName = getGetOperationName(type); 818 ObjectName appsConfigMBean = new ObjectName (appsConfigMBeanName); 819 ObjectName componentON = null; 820 821 try { 822 componentON = (ObjectName )mbs.invoke(appsConfigMBean, getOperationName, new Object []{appName}, new String []{"java.lang.String"}); 823 } catch(Exception cn) { 824 } 825 826 if(componentON != null){ 827 return true; 828 } 829 return false; 830 } catch (Exception e) { 831 throw new IASDeploymentException(e); 832 } 833 } 834 835 public static ConfigContext getConfigContext() { 836 try { 837 AdminService adminService = AdminService.getAdminService(); 838 if (adminService != null) { 839 ConfigContext config = 840 adminService.getAdminContext().getAdminConfigContext(); 841 return config; 842 } else { 843 return null; 844 } 845 } catch (Exception e) { 846 return null; 847 } 848 } 849 850 public static String getInstanceName() { 851 return ApplicationServer.getServerContext().getInstanceName(); 852 } 853 854 public static String getDomainName() 855 throws IASDeploymentException { 856 try { 857 AdminService adminService = AdminService.getAdminService(); 858 if (adminService != null) { 859 String domainName = 860 adminService.getAdminContext().getDomainName(); 861 return domainName; 862 } else { 863 return null; 864 } 865 } catch (Exception e) { 866 throw new IASDeploymentException(e); 867 } 868 } 869 870 871 880 public static void validate(String appID, DeployableObjectType type, 881 String action) throws IASDeploymentException { 882 boolean allowSystemAppModification = 883 (Boolean.valueOf(System.getProperty( 884 Constants.ALLOW_SYSAPP_DEPLOYMENT, "false")).booleanValue()); 885 886 if(allowSystemAppModification) 887 return; 888 if (isSystem(appID, type)) { 889 String msg = localStrings.getString( 890 "enterprise.deployment.phasing.component_is_system", 891 new Object []{ action, appID }); 892 throw new IASDeploymentException(msg); 893 } 894 } 895 896 903 public static void checkWebModuleReferences(String webModuleName) 904 throws IASDeploymentException { 905 ArrayList virtualServerIds = new ArrayList (); 906 907 try { 908 Config config = (Config) ConfigBeansFactory.getConfigBeanByXPath( 909 getConfigContext(), ServerXPathHelper.XPATH_CONFIG); 910 HttpService httpService = config.getHttpService(); 911 VirtualServer[] virtualServers = httpService.getVirtualServer(); 912 for (int j = 0; j < virtualServers.length; j++) { 913 VirtualServer aServer = virtualServers[j]; 914 String defWebModule = aServer.getDefaultWebModule(); 915 if ((defWebModule != null) && 916 (defWebModule.equals(webModuleName))) { 917 virtualServerIds.add(aServer.getId()); 918 } 919 } 920 } catch (Exception e) { 921 throw new IASDeploymentException(e); 922 } 923 if (!virtualServerIds.isEmpty()) { 924 throw new IASDeploymentException(localStrings.getString( 925 "enterprise.deployment.phasing.def_web_module_refs_exist", 926 virtualServerIds.toString(), webModuleName)); 927 } 928 } 929 930 public static void checkAbort(String moduleID) 931 throws IASDeploymentException { 932 DeploymentRequest request = 933 DeploymentRequestRegistry.getRegistry().getDeploymentRequest( 934 moduleID); 935 if (request != null && request.isAborted()) { 936 DeploymentRequestRegistry.getRegistry().removeDeploymentRequest( 937 moduleID); 938 String msg = localStrings.getString( 939 "enterprise.deployment.phasing.operation.abort", 940 new Object []{ moduleID }); 941 throw new IASDeploymentException(msg); 942 } 943 } 944 945 951 public static DeployableObjectType getTypeFromFile(String name, String filePath) 952 throws DeploymentException { 953 954 if(filePath == null) 955 throw new DeploymentException("deploy file not specified"); 956 957 try { 958 if (filePath.endsWith(".class")) { 961 StringTokenizer tk = new StringTokenizer (name, "_"); 965 File f = new File (filePath); 966 for (int i=0;i<tk.countTokens();i++) { 967 f = f.getParentFile(); 968 } 969 try { 970 URL [] urls = new URL [1]; 973 urls[0] = f.toURL(); 974 URLClassLoader cLoader = new URLClassLoader (urls, 975 DeploymentServiceUtils.class.getClassLoader()); 976 String className = name.replaceAll("_", "."); 977 Class clazz = cLoader.loadClass(className); 978 if (clazz!=null && clazz.getAnnotation(javax.ejb.Stateless .class)!=null) { 979 return DeployableObjectType.EJB; 980 } else { 981 return DeployableObjectType.WEB; 982 } 983 } catch(Exception e) { 984 return DeployableObjectType.WEB; 985 } 986 } 987 988 Archivist archivist = 989 ArchivistFactory.getArchivistForArchive(filePath); 990 ModuleType moduleType = archivist.getModuleType(); 991 return getDeployableObjectType(moduleType); 992 } catch(Exception ex) { 993 DeploymentException de = new DeploymentException( 994 localStrings.getString( 995 "enterprise.deployment.unknown.application.type", filePath)); 996 de.initCause(ex); 997 throw de; 998 } 999 } 1000 1001 public static DeploymentTarget getAndValidateDeploymentTarget(String 1002 targetName, String appName, boolean isDeleting) 1003 throws IASDeploymentException { 1004 try { 1005 final DeploymentTarget target = DeploymentTargetFactory.getDeploymentTargetFactory().getTarget(getConfigContext(), getDomainName(), targetName); 1006 if (targetName == null) { 1007 targetName = target.getTarget().getName(); 1010 } 1011 if (target.getTarget().getType() == TargetType.SERVER || 1012 target.getTarget().getType() == TargetType.DAS) { 1013 if (isDeleting) { 1015 if (!ServerHelper.serverReferencesApplication( 1016 getConfigContext(), targetName, appName)) { 1017 throw new IASDeploymentException(localStrings.getString("serverApplicationRefDoesNotExist", targetName, appName)); 1018 } 1019 } else { 1022 if (ServerHelper.serverReferencesApplication( 1023 getConfigContext(), targetName, appName)) { 1024 throw new IASDeploymentException(localStrings.getString("serverApplicationRefAlreadyExists", appName, targetName)); 1025 } 1026 } 1027 } else if (target.getTarget().getType() == TargetType.CLUSTER){ 1028 if (isDeleting) { 1030 if (!ClusterHelper.clusterReferencesApplication( 1031 getConfigContext(), targetName, appName)) { 1032 throw new IASDeploymentException(localStrings.getString("clusterApplicationRefDoesNotExist", targetName, appName)); 1033 } 1034 } else { 1037 if (ClusterHelper.clusterReferencesApplication( 1038 getConfigContext(), targetName, appName)) { 1039 throw new IASDeploymentException(localStrings.getString("clusterApplicationRefAlreadyExists", appName, targetName)); 1040 } 1041 } 1042 } 1043 1044 return target; 1045 } catch (IASDeploymentException ex) { 1046 throw (ex); 1047 } catch (Exception ex) { 1048 throw new IASDeploymentException(ex); 1049 } 1050 } 1051 1052 1057 public static void setHostAndPort(DeploymentRequest req) 1058 throws ServerInstanceException { 1059 1060 String virtualServers = (String ) req.getOptionalAttributes().get(ServerTags.VIRTUAL_SERVERS); 1061 if (virtualServers==null) { 1062 HostAndPort hap = getHostAndPort(false); 1063 if(hap != null) { 1064 req.setHttpHostName(getHostName(hap)); 1065 req.setHttpPort(getPort(hap, false)); 1066 } 1067 hap = getHostAndPort(true); 1068 if(hap != null) { 1069 req.setHttpsHostName(getHostName(hap)); 1070 req.setHttpsPort(getPort(hap, true)); 1071 } 1072 } else { 1073 StringTokenizer st = new StringTokenizer (virtualServers,","); 1074 if (st.hasMoreTokens()) { 1075 String aVirtualServer = st.nextToken(); 1076 HostAndPort hap = getVirtualServerHostAndPort(aVirtualServer, false); 1077 if(hap != null) { 1078 req.setHttpHostName(getHostName(hap)); 1079 1080 req.setHttpPort(getPort(hap, false)); 1081 } 1082 hap = getVirtualServerHostAndPort(aVirtualServer, true); 1083 if(hap != null) { 1084 req.setHttpsHostName(getHostName(hap)); 1085 req.setHttpsPort(getPort(hap, true)); 1086 } 1087 } 1088 } 1089 } 1090 1091 private static String getHostName(HostAndPort hap) { 1092 String hostName = hap.getHost(); 1093 if (hostName == null || hostName.trim().equals("")) { 1094 hostName = getDefaultHostName(); 1095 } 1096 return hostName; 1097 } 1098 1099 private static String getDefaultHostName() { 1100 String defaultHostName = "localhost"; 1101 try { 1102 InetAddress host = InetAddress.getLocalHost(); 1103 defaultHostName = host.getCanonicalHostName(); 1104 } catch(UnknownHostException uhe) { 1105 sLogger.log(Level.FINEST, "mbean.get_local_host_error", uhe); 1106 sLogger.log(Level.INFO, "mbean.use_default_host"); 1107 1108 } 1109 return defaultHostName; 1110 } 1111 1112 private static int getPort(HostAndPort hap, boolean securityEnabled) { 1113 int port = hap.getPort(); 1114 if (port == 0) { 1115 port = getDefaultPort(securityEnabled); 1116 } 1117 return port; 1118 } 1119 1120 private static int getDefaultPort(boolean securityEnabled) { 1121 int port = 0; 1122 if (securityEnabled) { 1123 port = 8181; 1124 } else { 1125 port = 8080; 1126 } 1127 sLogger.log(Level.INFO, "mbean.use_default_port", String.valueOf(port)); 1128 return port; 1129 } 1130 1131 1142 private static Object getNamedAttributeValue(AttributeList attrs, 1143 String attrName) { 1144 if (attrs == null || attrName == null) { 1145 return null; 1146 } 1147 Object value = null; 1148 Iterator iter = attrs.iterator(); 1149 while (iter.hasNext()) { 1150 Attribute attr = (Attribute )iter.next(); 1151 if (attrName.equals(attr.getName())) { 1152 value = attr.getValue(); 1153 break; 1154 } 1155 } 1156 return value; 1157 } 1158 1159 1163 private static HostAndPort getHostAndPort(boolean securityEnabled) throws ServerInstanceException { 1164 HostAndPort hAndp = null; 1165 try { 1166 MBeanServer mbs = MBeanServerFactory.getMBeanServer(); 1167 ObjectName objectName = new ObjectName (getDomainName()+":type=configs,category=config"); 1168 String operationName1 = "getConfig"; 1169 ObjectName [] configs = (ObjectName [])mbs.invoke(objectName,operationName1, emptyParams,emptySignature); 1170 String configName = (String )mbs.getAttribute(configs[0], "name"); 1171 ObjectName httpService = new ObjectName (getDomainName()+":type=http-service,config="+configName+",category=config"); 1172 String operationName2 = "getHttpListener"; 1173 ObjectName [] httpListener = (ObjectName [])mbs.invoke(httpService, operationName2,emptyParams,emptySignature); 1174 1175 String serverName = null; 1176 int port = 0; 1177 for (int i = 0; i < httpListener.length; i++) { 1178 AttributeList attrs = mbs.getAttributes(httpListener[i], 1179 httpListenerAttrNames); 1180 Boolean bb = Boolean.valueOf((String )getNamedAttributeValue( 1181 attrs, LISTENER_ENABLED)); 1182 boolean enabled = ((bb == null) ? false : bb.booleanValue()); 1183 if (!enabled) { 1184 continue; 1186 } 1187 String vs = (String )getNamedAttributeValue(attrs, DEF_VS); 1188 if (ADMIN_VS.equals(vs)) { 1189 continue; 1191 } 1192 bb = Boolean.valueOf((String )getNamedAttributeValue( 1193 attrs, SEC_ENABLED)); 1194 boolean sec_on = ((bb == null) ? false : bb.booleanValue()); 1195 if (securityEnabled == sec_on) { 1196 serverName = (String )getNamedAttributeValue(attrs, 1197 SERVER_NAME); 1198 if (serverName == null || serverName.trim().equals("")) { 1199 serverName = getDefaultHostName(); 1200 } 1201 1202 String portStr = (String )getNamedAttributeValue(attrs, 1203 PORT); 1204 String redirPort = (String )getNamedAttributeValue(attrs, 1205 REDIRECT_PORT); 1206 if (redirPort != null && !redirPort.trim().equals("")) { 1207 portStr = redirPort; 1208 } 1209 String resolvedPort = 1210 new PropertyResolver(getConfigContext(), 1211 getInstanceName()).resolve(portStr); 1212 port = Integer.parseInt(resolvedPort); 1213 break; 1214 } 1215 } 1216 hAndp = new HostAndPort(serverName, port); 1217 } 1218 catch (Exception e) { 1219 throw new ServerInstanceException(e.getLocalizedMessage()); 1220 } 1221 return hAndp; 1222 } 1223 1224 private static HostAndPort getVirtualServerHostAndPort(String vs, boolean securityEnabled) 1225 throws ServerInstanceException 1226 { 1227 String serverName = null; 1228 int port = 0; 1229 1230 try { 1231 MBeanServer mbs = MBeanServerFactory.getMBeanServer(); 1232 1233 ObjectName objectName = new ObjectName ( 1234 getDomainName()+":type=configs,category=config"); 1235 String operationName1 = "getConfig"; 1236 ObjectName [] configs = ( 1237 ObjectName [])mbs.invoke(objectName,operationName1, 1238 emptyParams,emptySignature); 1239 String configName = (String )mbs.getAttribute(configs[0], "name"); 1240 ObjectName httpService = new ObjectName ( 1241 getDomainName()+":type=http-service,config="+configName+",category=config"); 1242 1243 1245 String operationName2 = "getHttpListener"; 1246 ObjectName [] httpListener = (ObjectName [])mbs.invoke(httpService, 1247 operationName2,emptyParams,emptySignature); 1248 1249 1251 operationName2 = "getVirtualServer"; 1252 ObjectName [] virtualServer = (ObjectName [])mbs.invoke(httpService, 1253 operationName2,emptyParams,emptySignature); 1254 1255 1257 for (int i = 0; i < virtualServer.length; i++) { 1258 1259 AttributeList vsAttrs = mbs.getAttributes(virtualServer[i], vsAttrNames); 1260 1261 1267 String id = (String )getNamedAttributeValue(vsAttrs, ID); 1268 if (! id.equals(vs)) { 1269 continue; 1270 } 1271 1272 1274 1280 String httpListeners = (String ) getNamedAttributeValue(vsAttrs, "http-listeners"); 1281 String vsHttpListener = null; 1282 List httpListenerList = StringUtils.parseStringList(httpListeners, " ,"); 1283 ListIterator hlListIter = httpListenerList.listIterator(); 1284 1285 while(hlListIter.hasNext()) { 1286 1287 vsHttpListener = (String ) hlListIter.next(); 1288 1289 for (int j = 0; j < httpListener.length; j++) { 1290 1291 AttributeList attrs = mbs.getAttributes(httpListener[j], 1292 httpListenerAttrNames); 1293 1294 String listenerId = (String )getNamedAttributeValue(attrs, ID); 1296 if (! listenerId.equals(vsHttpListener)) { 1297 continue; 1298 } 1299 1300 Boolean bb = Boolean.valueOf((String )getNamedAttributeValue( 1301 attrs, LISTENER_ENABLED)); 1302 boolean enabled = ((bb == null) ? false : bb.booleanValue()); 1303 if (!enabled) { 1304 continue; 1306 } 1307 bb = Boolean.valueOf((String )getNamedAttributeValue( attrs, SEC_ENABLED)); 1308 boolean sec_on = ((bb == null) ? false : bb.booleanValue()); 1309 if (securityEnabled == sec_on) { 1310 serverName = (String )getNamedAttributeValue(attrs, SERVER_NAME); 1311 if (serverName == null || serverName.trim().equals("")) { 1312 serverName = getDefaultHostName(); 1313 } 1314 String portStr = (String )getNamedAttributeValue(attrs, PORT); 1315 String redirPort = (String )getNamedAttributeValue(attrs, REDIRECT_PORT); 1316 if (redirPort != null && !redirPort.trim().equals("")) { 1317 portStr = redirPort; 1318 } 1319 final String resolvedPort = 1320 new PropertyResolver(getConfigContext(), 1321 getInstanceName()).resolve(portStr); 1322 port = Integer.parseInt(resolvedPort); 1323 return new HostAndPort(serverName, port); 1324 } 1325 } 1326 } 1327 } 1328 } catch (Exception e) { 1329 throw new ServerInstanceException(e.getLocalizedMessage()); 1330 } 1331 return null; 1332 } 1333 1334 public static DeploymentTarget getDeploymentTarget(String targetName) 1335 throws IASDeploymentException { 1336 try { 1337 final DeploymentTarget target = DeploymentTargetFactory.getDeploymentTargetFactory().getTarget(getConfigContext(), getDomainName(), targetName); 1338 return target; 1339 } catch (IASDeploymentException ex) { 1340 throw (ex); 1341 } catch (Exception ex) { 1342 throw new IASDeploymentException(ex); 1343 } 1344 } 1345 1346 1347 public static void checkAppReferencesBeforeUndeployFromDomain( 1348 String appName) throws IASDeploymentException { 1349 try { 1350 if (ApplicationHelper.isApplicationReferenced( 1352 getConfigContext(), appName)) { 1353 throw new IASDeploymentException(localStrings.getString("applicationIsReferenced", appName, ApplicationHelper.getApplicationReferenceesAsString(getConfigContext(), appName))); 1354 } 1355 } catch (IASDeploymentException ex) { 1356 throw (ex); 1357 } catch (Exception ex) { 1358 throw new IASDeploymentException(ex); 1359 } 1360 } 1361 1362 1368 public static DeployableObjectType getRegisteredType(String name) 1369 throws DeploymentException { 1370 try{ 1371 for(int i = 0; i< deployableObjectTypes.length; i++) 1372 { 1373 if (isRegistered(name, deployableObjectTypes[i])) { 1374 return deployableObjectTypes[i]; 1375 } 1376 } 1377 }catch(Exception e){ 1378 throw new DeploymentException(e.getMessage()); 1379 } 1380 String msg = localStrings.getString( 1381 "enterprise.deployment.component.not.registered", name); 1382 throw new DeploymentException(msg); 1383 } 1384 1385 static String getCreateOperationName(DeployableObjectType type) 1386 throws IASDeploymentException { 1387 if (type.isAPP()) { 1388 return CREATE_J2EE_APPLICATION; 1389 } 1390 else if(type.isEJB()) { 1391 return CREATE_EJB_MODULE; 1392 } 1393 else if(type.isWEB()) { 1394 return CREATE_WEB_MODULE; 1395 } 1396 else if(type.isCONN()) { 1397 return CREATE_CONNECTOR_MODULE; 1398 } 1399 else if(type.isCAR()) { 1400 return CREATE_APPCLIENT_MODULE; 1401 } 1402 else return null; 1403 } 1404 1405 static String getGetOperationName(DeployableObjectType type) 1406 throws IASDeploymentException { 1407 if (type.isAPP()) { 1408 return GET_J2EE_APPLICATION; 1409 } 1410 else if (type.isEJB()) { 1411 return GET_EJB_MODULE; 1412 } 1413 else if (type.isWEB()) { 1414 return GET_WEB_MODULE; 1415 } 1416 else if (type.isCONN()) { 1417 return GET_CONNECTOR_MODULE; 1418 } 1419 else if (type.isCAR()) { 1420 return GET_APPCLIENT_MODULE; 1421 } 1422 else return null; 1423 } 1424 1425 static String getRemoveOperationName(DeployableObjectType type) 1426 throws IASDeploymentException { 1427 if(type.isAPP()) { 1428 return REMOVE_J2EE_APPLICATION; 1429 } 1430 else if(type.isEJB()) { 1431 return REMOVE_EJB_MODULE; 1432 } 1433 else if(type.isWEB()) { 1434 return REMOVE_WEB_MODULE; 1435 } 1436 else if(type.isCONN()) { 1437 return REMOVE_CONNECTOR_MODULE; 1438 } 1439 else if(type.isCAR()) { 1440 return REMOVE_APPCLIENT_MODULE; 1441 } 1442 else return null; 1443 } 1444 1445 1449 public static DeployableObjectType getDeployableObjectType(ModuleType type) { 1450 if (ModuleType.EAR.equals(type)) { 1451 return DeployableObjectType.APP; 1452 } else if (ModuleType.EJB.equals(type)) { 1453 return DeployableObjectType.EJB; 1454 } else if (ModuleType.WAR.equals(type)) { 1455 return DeployableObjectType.WEB; 1456 } else if (ModuleType.CAR.equals(type)) { 1457 return DeployableObjectType.CAR; 1458 } else if (ModuleType.RAR.equals(type)) { 1459 return DeployableObjectType.CONN; 1460 } 1461 return null; 1462 } 1463 1464 1465 private static final String CREATE_J2EE_APPLICATION = 1466 "createJ2eeApplication"; 1467 private static final String CREATE_EJB_MODULE = 1468 "createEjbModule"; 1469 private static final String CREATE_WEB_MODULE = 1470 "createWebModule"; 1471 private static final String CREATE_CONNECTOR_MODULE = 1472 "createConnectorModule"; 1473 private static final String CREATE_APPCLIENT_MODULE = 1474 "createAppclientModule"; 1475 private static final String GET_J2EE_APPLICATION = 1476 "getJ2eeApplicationByName"; 1477 private static final String GET_EJB_MODULE = 1478 "getEjbModuleByName"; 1479 private static final String GET_WEB_MODULE = 1480 "getWebModuleByName"; 1481 private static final String GET_CONNECTOR_MODULE = 1482 "getConnectorModuleByName"; 1483 private static final String GET_APPCLIENT_MODULE = 1484 "getAppclientModuleByName"; 1485 private static final String REMOVE_J2EE_APPLICATION = 1486 "removeJ2eeApplicationByName"; 1487 private static final String REMOVE_EJB_MODULE = 1488 "removeEjbModuleByName"; 1489 private static final String REMOVE_WEB_MODULE = 1490 "removeWebModuleByName"; 1491 private static final String REMOVE_CONNECTOR_MODULE = 1492 "removeConnectorModuleByName"; 1493 private static final String REMOVE_APPCLIENT_MODULE = 1494 "removeAppclientModuleByName"; 1495 1496 private static final String appsConfigMBeanName = 1497 "com.sun.appserv:type=applications,category=config"; 1498 private static final String SYSTEM_PREFIX = "system-"; 1499 1500 private static final String ADMIN_VS = "__asadmin"; 1501 1502 private static final String PORT = "port"; 1504 private static final String DEF_VS = "default-virtual-server"; 1505 private static final String SERVER_NAME = "server-name"; 1506 private static final String REDIRECT_PORT = "redirect-port"; 1507 private static final String SEC_ENABLED = "security-enabled"; 1508 private static final String LISTENER_ENABLED = "enabled"; 1509 private static final String OBJECT_TYPE = "object-type"; 1510 1511 private static final String HOSTS = "hosts"; 1513 private static final String HTTP_LISTENERS = "http_listeners"; 1514 private static final String DEFAULT_WEB_MODULE = "default_web_module"; 1515 private static final String STATE = "state"; 1516 private static final String ID = "id"; 1517 1518 private static final String SUN_RESOURCE_XML = "sun-resources.xml"; 1520 private static final String SUN_RESOURCE_XML_PATH = 1521 "META-INF" + File.separator + "sun-resources.xml"; 1522 1523 private static final DeployableObjectType[] deployableObjectTypes = 1524 new DeployableObjectType[] { DeployableObjectType.APP, 1525 DeployableObjectType.EJB, DeployableObjectType.WEB, 1526 DeployableObjectType.CONN, DeployableObjectType.CAR }; 1527 1528 private static String [] httpListenerAttrNames = {LISTENER_ENABLED, 1529 DEF_VS, SERVER_NAME, REDIRECT_PORT, PORT, SEC_ENABLED, ID }; 1530 1531 private static String [] vsAttrNames = {HOSTS, HTTP_LISTENERS, 1532 DEFAULT_WEB_MODULE, STATE, ID}; 1533 1534} 1535 | Popular Tags |