public WadlModel getModel() throws IOException {
   if (model != null) return model;
   WadlDataObject dobj = getEnv().getWadlDataObject();
   ModelSource modelSource = Utilities.getModelSource(dobj.getPrimaryFile(), true);
   boolean validModelSource =
       modelSource != null && modelSource.getLookup().lookup(Document.class) != null;
   if (!validModelSource) {
     throw new IOException(
         NbBundle.getMessage(WadlEditorSupport.class, "MSG_UnableToCreateModel"));
   }
   model = WadlModelFactory.getDefault().getModel(modelSource);
   return model;
 }
Esempio n. 2
0
  public static List<WSDLModel> getNonImportedModels(TMapModel tMapModel, PortType ptTreeFilter) {
    assert tMapModel != null;
    List<WSDLModel> result = new ArrayList<WSDLModel>();
    Project project = SoaUtil.getProject(SoaUtil.getFileObjectByModel(tMapModel));
    if (project == null) {
      LOGGER.log(
          Level.WARNING,
          NbBundle.getMessage(ServiceParamTreeModel.class, "MSG_EMPTY_PROJECT")); // NOI18N
      return result;
    }
    List<FileObject> wsdlFiles = new ArrayList<FileObject>();
    List<ReferenceFile> projectWsdlFiles = ReferenceUtil.getWSDLResources(project);
    if (projectWsdlFiles == null) {
      return result;
    }
    for (ReferenceFile projectWSDL : projectWsdlFiles) {
      wsdlFiles.add(projectWSDL.getFile());
    }

    for (FileObject wsdlFo : wsdlFiles) {
      if (wsdlFo == null) {
        continue;
      }
      ModelSource ms = Utilities.getModelSource(wsdlFo, false);
      if (ms == null) {
        continue;
      }
      WSDLModel wsdlModel = WSDLModelFactory.getDefault().getModel(ms);
      if (wsdlModel != null && hasPortType(wsdlModel, ptTreeFilter)) {
        result.add(wsdlModel);
      }
    }

    result.removeAll(getImportedModels(tMapModel, ptTreeFilter));

    return result;
  }
Esempio n. 3
0
 public ClickModel createEmptyClickModel() {
   FileObject fo = createEmptyClickFO();
   writeFile("<click-app></click-app>", fo);
   return ClickModelFactory.getInstance().createFreshModel(Utilities.getModelSource(fo, true));
 }