Ejemplo n.º 1
0
 public boolean acceptsURL(java.lang.String dburl) throws SQLException {
   try {
     return dburl.startsWith(URL_PREFIX);
   } catch (NullPointerException e) {
     return false;
   }
 }
 public java.lang.String getTokenName(java.lang.String[] tokenNames, int index) {
   if (tokenNames == null) {
     return null;
   }
   java.lang.String tokenName = tokenNames[index];
   if (tokenName != null && tokenName.startsWith("'")) {
     tokenName = tokenName.substring(1, tokenName.length() - 1).trim();
   }
   return tokenName;
 }
Ejemplo n.º 3
0
 protected java.lang.String doRequest(java.lang.String s, boolean flag, java.lang.String s1)
     throws java.lang.Exception {
   if (s == null) {
     throw new Exception("Paramater uri cannot be null");
   }
   com.dragonflow.Utils.SocketSession socketsession =
       com.dragonflow.Utils.SocketSession.getSession(null);
   java.lang.StringBuffer stringbuffer = new StringBuffer(10000);
   java.lang.String s2 = "http://" + getConnID() + s;
   jgl.Array array = null;
   if (s1 != null) {
     array = new Array();
     array.add("Custom-Content: " + s1);
   }
   long al[] =
       com.dragonflow.StandardMonitor.URLMonitor.checkURL(
           socketsession,
           s2,
           null,
           null,
           null,
           null,
           null,
           array,
           null,
           null,
           null,
           stringbuffer,
           0x989680L,
           null,
           0,
           60000,
           null);
   java.lang.String s3 =
       com.dragonflow.StandardMonitor.URLMonitor.getHTTPContent(stringbuffer.toString());
   if (al[0] == 200L) {
     s3 = s3.trim();
     if (s3.startsWith("<") && flag) {
       java.lang.String s5 = s3.substring(0, 50);
       java.lang.String s4;
       if (s3.indexOf("<P>") >= 0) {
         xmlKeys = xmlShortKeys;
         s4 = "J2EEGetListShort.xsl";
       } else {
         xmlKeys = xmlLongKeys;
         s4 = "J2EEGetList.xsl";
       }
       return J2EEConnection.transform(s3, "templates.applications/" + s4);
     } else {
       return s3;
     }
   } else {
     throw new Exception(com.dragonflow.StandardMonitor.URLMonitor.lookupStatus(al[0]));
   }
 }
Ejemplo n.º 4
0
  public static java.util.Vector getScriptList(
      java.lang.String s, com.dragonflow.HTTP.HTTPRequest httprequest) {
    java.util.Vector vector = new Vector();
    if (com.dragonflow.SiteView.Platform.isCommandLineRemote(s)) {
      com.dragonflow.Utils.RemoteFile remotefile = new RemoteFile(s, "scripts");
      int i = com.dragonflow.SiteView.Machine.getOS(s);
      jgl.Array array = remotefile.listFiles();
      for (int k = 0; k < array.size(); k++) {
        java.lang.String s2 = (java.lang.String) array.at(k);
        if (!s2.endsWith(".txt")
            && (!com.dragonflow.SiteView.Platform.isUnix(i) || !s2.startsWith("."))) {
          vector.addElement(s2);
          vector.addElement(s2);
        }
      }

    } else {
      java.io.File file =
          new File(
              com.dragonflow.SiteView.Platform.getUsedDirectoryPath(
                  "scripts", httprequest.getAccount()));
      java.lang.String as[] = file.list();
      for (int j = 0; j < as.length; j++) {
        java.lang.String s1 = as[j];
        if (s1.endsWith(".txt")
            || com.dragonflow.SiteView.Platform.isUnix() && s1.startsWith(".")) {
          continue;
        }
        java.io.File file1 = new File(file, as[j]);
        if (!file1.isDirectory()) {
          vector.addElement(s1);
          vector.addElement(s1);
        }
      }
    }
    return vector;
  }
Ejemplo n.º 5
0
  public void parseDescriptor(java.lang.String descriptor) {
    if (methodName.equalsIgnoreCase("<clinit>")) {
      methodName = "static";
      descriptor = "";
      accessSpecifiers = new java.lang.String[] {""};
      return;
    }
    int charIndex = 0;
    java.lang.String parameterString = descriptor.substring(1, descriptor.lastIndexOf(")"));
    java.lang.String returnString = descriptor.substring(descriptor.lastIndexOf(")") + 1);
    if (returnString.trim().charAt(0) == 'L' || returnString.trim().charAt(0) == '[')
      this.setReturnTypeAsObjectOrArrayType(true);
    else this.setReturnTypeAsObjectOrArrayType(false);

    java.lang.String arrString = "";
    // while(charIndex < parameterString.length())
    while (parameterString.length() > 0) {
      if (parameterString.startsWith("L")) {
        java.lang.String objectString = parameterString.substring(0, parameterString.indexOf(";"));
        objectString = objectString.replace('/', '.');
        parameters.add(objectString);
        charIndex = charIndex + (objectString.length() + 2);
        parameterString = parameterString.substring(parameterString.indexOf(";") + 1);
      } else {
        char parameterChar = parameterString.charAt(0);
        if (parameterChar == '[') {
          arrString = "";
          while (parameterString.startsWith("[")) {
            arrString += "[";
            parameterString = parameterString.substring(1, parameterString.length());
            isParameterArray = true;
          }
          java.lang.String objectString = "";
          if (parameterString.charAt(0) == 'L') {
            objectString = parameterString.substring(0, parameterString.indexOf(";"));
            parameterString = parameterString.substring(parameterString.indexOf(";") + 1);
            objectString = objectString.replace('/', '.');
            parameters.add(arrString + objectString);
            isParameterArray = false;
          }
          /*
           * while(objectString.startsWith("[")) { arrString += "[";
           * objectString =
           * objectString.substring(1,objectString.length()); }
           * objectString = objectString.substring(1); objectString =
           * objectString.replace('/','.');
           * parameters.add(objectString); charIndex = charIndex +
           * (objectString.length() + 2);
           * parameters.add(arrString+objectString);
           */

        } else {
          if (parameterChar == 'I') {
            if (isParameterArray) {
              parameters.add(arrString + "int");
              isParameterArray = false;
            } else {
              parameters.add("int");
            }
          }
          if (parameterChar == 'B') {
            if (isParameterArray) {
              parameters.add(arrString + "byte");
              isParameterArray = false;
            } else {
              parameters.add("byte");
            }
          }
          if (parameterChar == 'C') {
            if (isParameterArray) {
              parameters.add(arrString + "char");
              isParameterArray = false;
            } else {
              parameters.add("char");
            }
          }
          if (parameterChar == 'D') {
            if (isParameterArray) {
              parameters.add(arrString + "double");
              isParameterArray = false;
            } else {
              parameters.add("double");
            }
          }
          if (parameterChar == 'F') {
            if (isParameterArray) {
              parameters.add(arrString + "float");
              isParameterArray = false;
            } else {
              parameters.add("float");
            }
          }
          if (parameterChar == 'J') {
            if (isParameterArray) {
              parameters.add(arrString + "long");
              isParameterArray = false;
            } else {
              parameters.add("long");
            }
          }
          if (parameterChar == 'S') {
            if (isParameterArray) {
              parameters.add(arrString + "short");
              isParameterArray = false;
            } else {
              parameters.add("short");
            }
          }
          if (parameterChar == 'Z') {
            if (isParameterArray) {
              parameters.add(arrString + "boolean");
              isParameterArray = false;
            } else {
              parameters.add("boolean");
            }
          }
          parameterString = parameterString.substring(1);
        }
      }
    }

    if (returnString.indexOf(";") != -1) {
      returnString = returnString.substring(0, returnString.indexOf(";"));
    }

    while (returnString.length() > 0) {
      // System.out.println();
      if (returnString.startsWith("L")) {
        // System.out.println(returnString + " "+returnType.length());
        returnType = returnString.substring(1, returnString.length());
        returnType = returnType.replace('/', '.');
        returnString = "";
      } else {
        if (returnString.equals("I")) {
          returnType = "int";
          returnString = "";
        }
        if (returnString.equals("B")) {
          returnType = "byte";
          returnString = "";
        }
        if (returnString.equals("C")) {
          returnType = "char";
          returnString = "";
        }
        if (returnString.equals("D")) {
          returnType = "double";
          returnString = "";
        }
        if (returnString.equals("F")) {
          returnType = "float";
          returnString = "";
        }
        if (returnString.equals("J")) {
          returnType = "long";
          returnString = "";
        }
        if (returnString.equals("S")) {
          returnType = "short";
          returnString = "";
        }
        if (returnString.equals("Z")) {
          returnType = "boolean";
          returnString = "";
        }
        if (returnString.equals("V")) {
          returnType = "void";
          returnString = "";
        }
        if (returnString.startsWith("[")) {
          returnTypeIsArray = true;
          returnTypeArrayDimension = returnString.lastIndexOf("[") + 1;
          if (returnString.indexOf("L") != -1) {
            returnType = returnString.substring(returnString.lastIndexOf("[") + 2);
            returnType = returnType.replace('/', '.');
            returnString = "";
            // returnString =returnType;
          } else {
            returnString = returnString.substring(returnString.lastIndexOf("[") + 1);
            // returnString = "";

          }
        }
      }
    }
  }
Ejemplo n.º 6
0
  @Override
  public void consume(
      java.lang.Object multiCtx,
      java.lang.String path,
      java.util.Map<java.lang.String, java.lang.String> parameters,
      XmlDoc.Element userMeta,
      XmlDoc.Element meta,
      LongInputStream in,
      java.lang.String appMimeType,
      java.lang.String streamMimeType,
      long length)
      throws Throwable {

    Connection conn = multiCtx == null ? null : ((MultiTransferContext) multiCtx).connection;
    Session session = multiCtx == null ? null : ((MultiTransferContext) multiCtx).session;
    Params params = Params.parse(parameters);
    if (multiCtx == null) {
      conn = Ssh.get().getConnection(params.serverDetails());
      session = conn.connect(params.userDetails(), true);
    }

    String assetId = meta != null ? meta.value("@id") : null;
    String ext = meta != null ? meta.value("content/type/@ext") : null;

    try {

      String baseDir = params.directory != null ? params.directory : session.getHome();
      StringBuilder sb = new StringBuilder(baseDir);
      if (!baseDir.endsWith("/")) {
        sb.append("/");
      }
      if (path != null) {
        path = path.replace("\\\\", "/").replace("\\", "/");
        while (path.startsWith("/")) {
          path = path.substring(1);
        }
        sb.append(path);
      }

      Set<String> existingDirs =
          multiCtx == null
              ? Collections.newSetFromMap(new ConcurrentHashMap<String, Boolean>())
              : ((MultiTransferContext) multiCtx).existingDirectories;
      if (params.decompress
          && streamMimeType != null
          && ArchiveRegistry.isAnArchive(streamMimeType)) {
        // decompress archive
        if (assetId != null) {
          sb.append("/");
          sb.append("asset_");
          sb.append(assetId);
        }
        if (RemoteArchiveExtractor.canExtract(session, streamMimeType)) {
          sb.append("/");
          sb.append(PathUtil.getRandomFileName(8));
          sb.append(".tmp");
          String remotePath = sb.toString();
          transfer(session, in, length, remotePath, params.fileMode, existingDirs);
          RemoteArchiveExtractor.extract(session, remotePath);
        } else {
          extractAndTransfer(
              session,
              sb.toString(),
              ArchiveRegistry.createInput(in, new NamedMimeType(streamMimeType)),
              params.fileMode,
              existingDirs);
        }
      } else {
        // single file
        if (assetId != null) {
          sb.append("/");
          sb.append("asset_");
          sb.append(assetId);
        }
        if (ext != null) {
          sb.append(".");
          sb.append(ext);
        }
        transfer(session, in, length, sb.toString(), params.fileMode, existingDirs);
      }
    } finally {
      if (multiCtx == null) {
        if (session != null) {
          session.close();
        }
        if (conn != null) {
          conn.disconnect();
        }
      }
    }
  }