Пример #1
0
  /**
   * Gets the name of the CASA file in the given project.
   *
   * @param project a JBI project
   * @return CASA file name
   */
  public static String getCasaFileName(Project project) {
    ProjectInformation projInfo = project.getLookup().lookup(ProjectInformation.class);
    String projName = projInfo.getName();

    File pf = FileUtil.toFile(project.getProjectDirectory());
    return pf.getPath() + CASA_DIR_NAME + projName + CASA_EXT;
  }
Пример #2
0
  private static File getCompAppWSDLLockFile(Project project) {
    ProjectInformation projInfo = project.getLookup().lookup(ProjectInformation.class);
    String projName = projInfo.getName();
    FileObject srcDirFO = ((JbiProject) project).getSourceDirectory();
    if (srcDirFO != null) {
      // FileObject doesn't work:
      // srcDirFO.getFileObject(
      //     LOCK_FILE_PREFIX + projName + WSDL_EXT + LOCK_FILE_SUFFIX);
      File lockFile =
          new File(
              FileUtil.toFile(srcDirFO), LOCK_FILE_PREFIX + projName + WSDL_EXT + LOCK_FILE_SUFFIX);
      return lockFile;
    }

    return null;
  }
Пример #3
0
  private static File getCasaLockFile(Project project) {
    ProjectInformation projInfo = project.getLookup().lookup(ProjectInformation.class);
    assert projInfo != null;

    String projName = projInfo.getName();

    FileObject confFO = project.getProjectDirectory().getFileObject(CASA_DIR_NAME);
    if (confFO != null) {
      // FileObject doesn't work:
      // confFO.getFileObject(
      //        LOCK_FILE_PREFIX + projName + CASA_EXT + LOCK_FILE_SUFFIX);
      File lockFile =
          new File(
              FileUtil.toFile(confFO), LOCK_FILE_PREFIX + projName + CASA_EXT + LOCK_FILE_SUFFIX);
      return lockFile;
    }

    return null;
  }
Пример #4
0
  /**
   * Creates the default CASA file object in the JBI project.
   *
   * @param project a JBI project
   * @return the newly created CASA file object
   */
  public static FileObject createDefaultCasaFileObject(JbiProject project) {
    ProjectInformation projInfo = project.getLookup().lookup(ProjectInformation.class);
    assert projInfo != null;
    String projName = projInfo.getName();
    FileObject confFO = project.getProjectDirectory().getFileObject(CASA_DIR_NAME);
    FileObject casaFO = null;
    try {
      FileObject casaTemplateFO =
          FileUtil.getConfigFile(
              "org-netbeans-modules-compapp-projects-jbi/project.casa" // NOI18N
              );
      casaFO = FileUtil.copyFile(casaTemplateFO, confFO, projName);
      //            registerCasaFileListener(project);
    } catch (IOException ex) {
      ex.printStackTrace();
    }

    return casaFO;
  }
Пример #5
0
  /**
   * Gets the CASA file object in the given JBI project.
   *
   * @param project a JBI project
   * @param create if <code>true</code> and the CASA file doesn't exist in the project, then an
   *     empty CASA file will be created
   * @return CASA file object
   */
  public static FileObject getCasaFileObject(JbiProject project, boolean create) {
    ProjectInformation projInfo = project.getLookup().lookup(ProjectInformation.class);
    assert projInfo != null;

    String projName = projInfo.getName();

    FileObject confFO = project.getProjectDirectory().getFileObject(CASA_DIR_NAME);
    if (confFO == null) {
      // This could happen during compapp rename with directory name change.
      return null;
    }

    FileObject casaFO = confFO.getFileObject(projName + CASA_EXT);

    if (casaFO == null && create) {
      casaFO = createDefaultCasaFileObject(project);
      updateCasaWithJBIModules(project);
    }

    return casaFO;
  }
Пример #6
0
 public static FileObject getCompAppWSDLFileObject(Project project) {
   ProjectInformation projInfo = project.getLookup().lookup(ProjectInformation.class);
   String projName = projInfo.getName();
   FileObject srcDirFO = ((JbiProject) project).getSourceDirectory();
   return srcDirFO == null ? null : srcDirFO.getFileObject(projName + WSDL_EXT); // NOI18N
 }