コード例 #1
0
  /*
   * Deploy all jars in the supplied jarList
   * @param admin the Admin instance
   * @param jarList the colon-separated list of jar path locations
   */
  private void deployJars(Admin admin, String jarList) {
    // Path Entries are colon separated
    String[] jarPathStrs = jarList.split("[:]"); // $NON-NLS-1$

    // Attempt to deploy each jar
    for (String jarPathStr : jarPathStrs) {
      File theFile = new File(jarPathStr);
      if (theFile.exists()) {
        if (theFile.canRead()) {
          String fileName = theFile.getName();
          InputStream iStream = null;
          try {
            iStream = new FileInputStream(theFile);
          } catch (FileNotFoundException ex) {
            LogManager.logError(
                getClass().getSimpleName(),
                ex,
                NLS.bind(Messages.JarDeploymentJarNotFound, theFile.getPath()));
            continue;
          }
          try {
            admin.deployVDB(fileName, iStream);
          } catch (Exception ex) {
            // Jar deployment failed
            LogManager.logError(
                getClass().getSimpleName(),
                ex,
                NLS.bind(Messages.JarDeploymentFailed, theFile.getPath()));
          }
        } else {
          // Could not read the file
          LogManager.logError(
              getClass().getSimpleName(),
              NLS.bind(Messages.JarDeploymentJarNotReadable, theFile.getPath()));
        }
      } else {
        // The file was not found
        LogManager.logError(
            getClass().getSimpleName(),
            NLS.bind(Messages.JarDeploymentJarNotFound, theFile.getPath()));
      }
    }
  }
コード例 #2
0
  private IStatus pingJdbc() {
    String host = teiidServer.getHost();
    ITeiidJdbcInfo teiidJdbcInfo = teiidServer.getTeiidJdbcInfo();

    Connection teiidJdbcConnection = null;
    String url = "jdbc:teiid:ping@mm://" + host + ':' + teiidJdbcInfo.getPort(); // $NON-NLS-1$

    try {
      admin.deployVDB(
          "ping-vdb.xml",
          (InputStream) new ByteArrayInputStream(TEST_VDB.getBytes())); // $NON-NLS-1$
      try {
        String urlAndCredentials =
            url
                + ";user="******";password="******"ping", 1); // $NON-NLS-1$

        if (teiidJdbcConnection != null) {
          teiidJdbcConnection.close();
        }
      }
    } catch (Exception ex) {
      String msg = NLS.bind(Messages.serverDeployUndeployProblemPingingTeiidJdbc, url);
      return new Status(IStatus.ERROR, PLUGIN_ID, msg, ex);
    }

    return Status.OK_STATUS;
  }
コード例 #3
0
  @Override
  public void deployVdb(IFile vdbFile) throws Exception {
    ArgCheck.isNotNull(vdbFile, "vdbFile"); // $NON-NLS-1$

    String vdbName = vdbFile.getFullPath().lastSegment();
    String vdbNameNoExt = vdbFile.getFullPath().removeFileExtension().lastSegment();

    admin.deployVDB(vdbName, vdbFile.getContents());

    // Refresh VDBs list
    refreshVDBs();

    // TODO should get version from vdbFile
    VDB vdb = admin.getVDB(vdbNameNoExt, 1);

    // If the VDB is still loading, refresh again and potentially start refresh job
    if (!vdb.getStatus().equals(VDB.Status.ACTIVE) && vdb.getValidityErrors().isEmpty()) {
      // Give a 0.5 sec pause for the VDB to finish loading metadata.
      try {
        Thread.sleep(500);
      } catch (InterruptedException e) {
      }
      // Refresh again to update vdb states
      refreshVDBs();
      vdb = admin.getVDB(vdbNameNoExt, 1);
      // Determine if still loading, if so start refresh job.  User will get dialog that the
      // vdb is still loading - and try again in a few seconds
      if (!vdb.getStatus().equals(VDB.Status.ACTIVE) && vdb.getValidityErrors().isEmpty()) {
        final Job refreshVDBsJob = new RefreshVDBsJob(vdbNameNoExt);
        refreshVDBsJob.schedule();
      }
    }

    this.eventManager.notifyListeners(
        ExecutionConfigurationEvent.createDeployVDBEvent(vdb.getName()));
  }