Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 101337 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/jst/ws/internal/creation/ui/widgets/runtime/ServerRuntimeSelectionWidgetDefaultingCommand.java (-12 / +64 lines)
Lines 84-103 Link Here
84
    {
84
    {
85
      serviceJ2EEVersion_ = webServiceRuntimeJ2EEType.getJ2eeVersionId();
85
      serviceJ2EEVersion_ = webServiceRuntimeJ2EEType.getJ2eeVersionId();
86
      serviceIds_.setRuntimeId(webServiceRuntimeJ2EEType.getWsrId()); 
86
      serviceIds_.setRuntimeId(webServiceRuntimeJ2EEType.getWsrId()); 
87
    }
87
    }	 
88
	 
89
	 //serviceIds_.setRuntimeId(WebServiceRuntimeExtensionUtils.getDefaultRuntimeValueFor(serviceIds_.getTypeId()));
90
	 //serviceJ2EEVersion_ = (WebServiceRuntimeExtensionUtils.getWebServiceRuntimeById(serviceIds_.getRuntimeId()).getJ2eeLevels())[0]; 
91
92
	 
93
     // Set the default client type to a web client type.
94
     // setWebClientType();
95
     
88
     
96
     setServiceComponentType();
89
     setServiceComponentType();
97
     // Default projects EARs and servers.
90
     // Default projects EARs and servers.
98
     setDefaultProjects();
91
     setDefaultProjects();
99
     setDefaultEARs();
92
     setDefaultEARs();
100
     setDefaultServer();
93
     Status serverStatus = setDefaultServer();
94
     if (serverStatus.getSeverity()== Status.ERROR)
95
     {
96
         env.getStatusHandler().reportError(serverStatus);
97
         return serverStatus;
98
     }
101
     updateServiceEARs();
99
     updateServiceEARs();
102
     //updateClientProject(getServiceProject2EARProject().getList().getSelection(), serviceComponentName_, serviceIds_.getTypeId());
100
     //updateClientProject(getServiceProject2EARProject().getList().getSelection(), serviceComponentName_, serviceIds_.getTypeId());
103
     updateClientEARs();
101
     updateClientEARs();
Lines 164-170 Link Here
164
162
165
    if (project != null && project.exists())
163
    if (project != null && project.exists())
166
    {
164
    {
167
      if (J2EEUtils.isWebComponent(project, componentName ) || J2EEUtils.isEJBComponent(project, componentName))
165
      boolean isValidComponentType = false;
166
      if (componentName != null && componentName.length()>0)
167
      {
168
        isValidComponentType = J2EEUtils.isWebComponent(project, componentName) ||
169
                                     J2EEUtils.isEJBComponent(project, componentName);
170
      }
171
      if (isValidComponentType)
168
      {
172
      {
169
        //WebServiceServerRuntimeTypeRegistry wssrtReg = WebServiceServerRuntimeTypeRegistry.getInstance();
173
        //WebServiceServerRuntimeTypeRegistry wssrtReg = WebServiceServerRuntimeTypeRegistry.getInstance();
170
        
174
        
Lines 638-645 Link Here
638
  }
642
  }
639
  */
643
  */
640
644
641
  private void setDefaultServer()
645
  private Status setDefaultServer()
642
  {
646
  {
647
	Status status = new SimpleStatus("");
643
    //Calculate reasonable default server based on the default project selection. 
648
    //Calculate reasonable default server based on the default project selection. 
644
649
645
    String initialProjectName = getServiceProject2EARProject().getList().getSelection(); 
650
    String initialProjectName = getServiceProject2EARProject().getList().getSelection(); 
Lines 698-706 Link Here
698
            serviceIds_.setServerInstanceId(serverInfo[1]);
703
            serviceIds_.setServerInstanceId(serverInfo[1]);
699
          }        
704
          }        
700
        }
705
        }
706
        else
707
        {
708
        	//Since the project and the EAR are both new, try changing the J2EE level
709
        	boolean foundServer = false;
710
        	WebServiceRuntimeInfo wsrt = WebServiceRuntimeExtensionUtils.getWebServiceRuntimeById(serviceIds_.getRuntimeId());
711
            if (wsrt != null)
712
            {
713
              String[] versions = wsrt.getJ2eeLevels();
714
              if (versions != null && versions.length > 0)
715
              {
716
            	  for (int k=0; k<versions.length; k++)
717
            	  {
718
            		  //If this J2EE version is different from the current one, see if there is
719
            		  //a server available.
720
            		  if (serviceJ2EEVersion_!=versions[k])
721
            		  {
722
            			  String[] si = ServerSelectionUtils.getServerFromWebServceRuntimeAndJ2EE(serviceIds_.getRuntimeId(), versions[k]);
723
             		      if (si!=null)
724
            		      {
725
            		        if (si[0]!=null && si[0].length()>0)
726
            		        {
727
            		          serviceIds_.setServerId(si[0]);
728
            		        }
729
            		        if (si[1]!=null && si[1].length()>0)
730
            		        {
731
            		          serviceIds_.setServerInstanceId(si[1]);
732
            		        }             
733
            		        serviceJ2EEVersion_ = versions[k];
734
            		        foundServer = true;
735
            		        break;
736
            		      }
737
            		  
738
            	      }
739
                  }
740
               }
741
            }
742
        	//No valid server runtimes appear to be configured, this is an error condition.
743
            if (!foundServer)
744
            {
745
              String runtimeLabel = WebServiceRuntimeExtensionUtils.getRuntimeLabelById(serviceIds_.getRuntimeId());
746
              String serverLabels = getServerLabels(serviceIds_.getRuntimeId());            	
747
        	  status = new SimpleStatus("", msgUtils_.getMessage("MSG_ERROR_NO_SERVER_RUNTIME", new String[]{runtimeLabel, serverLabels}),Status.ERROR);
748
            }
749
        	
750
        }
701
      }
751
      }
702
      
752
      
703
    }    
753
    }
754
    
755
    return status;
704
  }
756
  }
705
757
706
  
758
  

Return to bug 101337