예제 #1
0
파일: Type.java 프로젝트: nypgit/alto
    /**
     * File type operator accepts <code>"path/file.(type)"<code> and
     * <code>"path/file.(type).other"</code> (as in
     * <code>"path/file.(type).xml"</code> and
     * <code>"path/file.(type).txt"</code>) conventions.
     *
     * @param path File path string
     * @return File type string
     */
    public static final java.lang.String FextI(java.lang.String path) {
      if (null == path || 1 > path.length()) return null;
      else {
        java.lang.String p = path;
        int idx = p.lastIndexOf('/');
        if (-1 < idx)
          /*
           * (trim)
           */
          p = p.substring(idx + 1);

        int i0 = p.lastIndexOf('.');
        if (-1 < i0) {
          int i1 = p.lastIndexOf('.', (i0 - 1));
          if (-1 < i1 && i1 < i0)
            /*
             * file.(type).xml
             */
            return p.substring(i1 + 1, i0);
          else
            /*
             * file.(type)
             */
            return p.substring(i0 + 1);
        } else
          /*
           * (punt)
           */
          return p;
      }
    }
예제 #2
0
    /**
     * static method to create the object Precondition: If this object is an element, the current or
     * next start element starts this object and any intervening reader events are ignorable If this
     * object is not an element, it is a complex type and the reader is at the event just after the
     * outer start element Postcondition: If this object is an element, the reader is positioned at
     * its end element If this object is a complex type, the reader is positioned at the end element
     * of its outer element
     */
    public static LifecycleManager parse(javax.xml.stream.XMLStreamReader reader)
        throws java.lang.Exception {
      LifecycleManager object = null;

      int event;
      java.lang.String nillableValue = null;
      java.lang.String prefix = "";
      java.lang.String namespaceuri = "";
      try {

        while (!reader.isStartElement() && !reader.isEndElement()) reader.next();

        if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type") != null) {
          java.lang.String fullTypeName =
              reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type");
          if (fullTypeName != null) {
            java.lang.String nsPrefix = null;
            if (fullTypeName.indexOf(":") > -1) {
              nsPrefix = fullTypeName.substring(0, fullTypeName.indexOf(":"));
            }
            nsPrefix = nsPrefix == null ? "" : nsPrefix;

            java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":") + 1);

            if (!"LifecycleManager".equals(type)) {
              // find namespace for the prefix
              java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix);
              return (LifecycleManager)
                  org.apache.axis2.transaction.xsd.ExtensionMapper.getTypeObject(
                      nsUri, type, reader);
            }

            throw new org.apache.axis2.databinding.ADBException(
                "The an abstract class can not be instantiated !!!");
          }
        }

        // Note all attributes that were handled. Used to differ normal attributes
        // from anyAttributes.
        java.util.Vector handledAttributes = new java.util.Vector();

        reader.next();

        while (!reader.isStartElement() && !reader.isEndElement()) reader.next();

        if (reader.isStartElement())
          // A start element we are not expecting indicates a trailing invalid property
          throw new org.apache.axis2.databinding.ADBException(
              "Unexpected subelement " + reader.getName());

      } catch (javax.xml.stream.XMLStreamException e) {
        throw new java.lang.Exception(e);
      }

      return object;
    }
예제 #3
0
 private static final java.lang.String mangle(java.lang.String s, Ceylon ann) {
   int i = s.indexOf("$");
   if (i > 0) {
     s = s.substring(0, i) + s.substring(i + 1);
   }
   if (s.endsWith("_") && ann != null) {
     s = s.substring(0, s.length() - 1);
   }
   return s;
 }
예제 #4
0
 public TreeNode(java.util.Map map, java.lang.String s) throws java.lang.Exception {
   this(map);
   int i = s.indexOf(": ");
   if (i < 0) {
     throw new Exception("Invalid node name, ': ' expected: " + s);
   } else {
     cls = s.substring(0, i);
     name = s.substring(i + 2);
     return;
   }
 }
예제 #5
0
 public static java.lang.String getGroupFromCounterName(java.lang.String s) {
   int i = s.indexOf("group: ");
   if (i < 0) {
     return null;
   }
   int j = s.indexOf('/', i);
   if (j < 0) {
     return null;
   } else {
     java.lang.String s1 = s.substring(i + 7, j);
     return s.substring(6, i - 1) + " " + s1;
   }
 }
예제 #6
0
    /**
     * static method to create the object Precondition: If this object is an element, the current or
     * next start element starts this object and any intervening reader events are ignorable If this
     * object is not an element, it is a complex type and the reader is at the event just after the
     * outer start element Postcondition: If this object is an element, the reader is positioned at
     * its end element If this object is a complex type, the reader is positioned at the end element
     * of its outer element
     */
    public static hr.ponge.pfa.axis.core.operations.CreateDocumentReq parse(
        javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception {
      hr.ponge.pfa.axis.core.operations.CreateDocumentReq object =
          new hr.ponge.pfa.axis.core.operations.CreateDocumentReq();
      int event;
      java.lang.String nillableValue = null;
      java.lang.String prefix = "";
      java.lang.String namespaceuri = "";
      try {
        while ((!(reader.isStartElement())) && (!(reader.isEndElement()))) reader.next();
        if ((reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type"))
            != null) {
          java.lang.String fullTypeName =
              reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type");
          if (fullTypeName != null) {
            java.lang.String nsPrefix = null;
            if ((fullTypeName.indexOf(":")) > (-1)) {
              nsPrefix = fullTypeName.substring(0, fullTypeName.indexOf(":"));
            }
            nsPrefix = nsPrefix == null ? "" : nsPrefix;
            java.lang.String type = fullTypeName.substring(((fullTypeName.indexOf(":")) + 1));
            if (!("CreateDocumentReq".equals(type))) {
              java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix);
              return ((hr.ponge.pfa.axis.core.operations.CreateDocumentReq)
                  (hr.ponge.pfa.axis.ExtensionMapper.getTypeObject(nsUri, type, reader)));
            }
          }
        }
        java.util.Vector handledAttributes = new java.util.Vector();
        reader.next();
        while ((!(reader.isStartElement())) && (!(reader.isEndElement()))) reader.next();
        if ((reader.isStartElement())
            && (new javax.xml.namespace.QName(
                    "http://ponge.hr/pfa/axis/core/operations", "document")
                .equals(reader.getName()))) {
          object.setDocument(hr.ponge.pfa.axis.core.Document.Factory.parse(reader));
          reader.next();
        } else {
          throw new org.apache.axis2.databinding.ADBException(
              ("Unexpected subelement " + (reader.getName())));
        }
        while ((!(reader.isStartElement())) && (!(reader.isEndElement()))) reader.next();
        if (reader.isStartElement())
          throw new org.apache.axis2.databinding.ADBException(
              ("Unexpected subelement " + (reader.getName())));

      } catch (javax.xml.stream.XMLStreamException e) {
        throw new java.lang.Exception(e);
      }
      return object;
    }
예제 #7
0
 public static java.lang.String className(
     @Name("obj") @TypeInfo("ceylon.language::Object") final java.lang.Object object) {
   // TODO: type args?
   Name annot = object.getClass().getAnnotation(Name.class);
   if (annot != null) {
     if (object.getClass().getPackage() != null) {
       return object.getClass().getPackage().getName() + "::" + annot.value();
     } else {
       return annot.value();
     }
   } else {
     Ceylon ann = object.getClass().getAnnotation(Ceylon.class);
     java.lang.String pkg =
         object.getClass().getPackage() == null ? "" : object.getClass().getPackage().getName();
     java.lang.String name = object.getClass().getSimpleName();
     if (name.isEmpty()) {
       name = object.getClass().getName();
       // Remove the package from the classname
       if (!pkg.isEmpty()) {
         name = name.substring(pkg.length() + 1);
       }
     }
     // FIXME The mangle part really shouldn't be necessary as long as we add @Name
     // annotations to all classes with mangled names
     return mangle(pkg, ann) + "::" + mangle(name, ann);
   }
 }
예제 #8
0
  public static void textPack(byte packedData[], java.lang.String text) {
    if (text.length() > 80) text = text.substring(0, 80);
    text = text.toLowerCase();

    int carryOverNibble = -1;
    int ofs = 0;
    for (int idx = 0; idx < text.length(); idx++) {
      char c = text.charAt(idx);
      int tableIdx = 0;
      for (int i = 0; i < xlateTable.length; i++) {
        if (c == xlateTable[i]) {
          tableIdx = i;
          break;
        }
      }
      if (tableIdx > 12) tableIdx += 195;
      if (carryOverNibble == -1) {
        if (tableIdx < 13) carryOverNibble = tableIdx;
        else packedData[ofs++] = (byte) (tableIdx);
      } else if (tableIdx < 13) {
        packedData[ofs++] = (byte) ((carryOverNibble << 4) + tableIdx);
        carryOverNibble = -1;
      } else {
        packedData[ofs++] = (byte) ((carryOverNibble << 4) + (tableIdx >> 4));
        carryOverNibble = tableIdx & 0xf;
      }
    }

    if (carryOverNibble != -1) packedData[ofs++] = (byte) (carryOverNibble << 4);
  }
  /**
   * Establece un nuevo valor para la propiedad <code>idUsuarioRegistro</code> .
   *
   * @param idUsuarioRegistro1 El valor a establecer para la propiedad <code>idUsuarioRegistro
   *     </code>.
   */
  public void setIdUsuarioRegistro(String idUsuarioRegistro1) {
    this.idUsuarioRegistro = idUsuarioRegistro1;

    if (idUsuarioRegistro != null && idUsuarioRegistro.length() > 32) {
      idUsuarioRegistro = idUsuarioRegistro.substring(0, 32);
    }
  }
  /**
   * Establece un nuevo valor para la propiedad <code>idUsuarioModificacion</code>.
   *
   * @param idUsuarioModificacion1 El valor a establecer para la propiedad <code>
   *     idUsuarioModificacion</code>.
   */
  public void setIdUsuarioModificacion(String idUsuarioModificacion1) {
    this.idUsuarioModificacion = idUsuarioModificacion1;

    if (idUsuarioModificacion != null && idUsuarioModificacion.length() > 32) {
      idUsuarioModificacion = idUsuarioModificacion.substring(0, 32);
    }
  }
  /**
   * Establece un nuevo valor para la propiedad <code>estado</code>.
   *
   * @param estado1 El valor a establecer para la propiedad <code>estado</code>.
   */
  public void setEstado(String estado1) {
    this.estado = estado1;

    if (estado != null && estado.length() > 1) {
      estado = estado.substring(0, 1);
    }
  }
 public java.lang.String getDefaultValueFor(java.lang.String optionName) {
   int index = 0;
   while (index < optionName.length() && !Character.isLetterOrDigit(optionName.charAt(index))) {
     index++;
   }
   java.lang.String key = optionName.substring(index--);
   return m_properties.getProperty(key);
 }
예제 #13
0
파일: Type.java 프로젝트: nypgit/alto
 /**
  * Fext operator of last resort takes the right hand side terminal of any dot concatenated
  * sequence.
  *
  * @param name Any string
  * @return A filename extension or the input string.
  */
 public static final java.lang.String FextR(java.lang.String name) {
   if (null != name) {
     int idx = IndexOfFext(name);
     if (0 < idx) name = name.substring(idx + 1);
     //
     return name.toLowerCase();
   } else return null;
 }
예제 #14
0
 public void addValue(
     com.beust.jcommander.Parameterized parameterized,
     java.lang.Object object,
     java.lang.Object value) {
   if (m_parameter != null) {
     parameterized.set(object, value);
   } else {
     java.lang.String a = m_dynamicParameter.assignment();
     java.lang.String sv = value.toString();
     int aInd = sv.indexOf(a);
     if (aInd == -1) {
       throw new com.beust.jcommander.ParameterException(
           "Dynamic parameter expected a value of the form a" + a + "b" + " but got:" + sv);
     }
     callPut(object, parameterized, sv.substring(0, aInd), sv.substring(aInd * 1));
   }
 }
    /**
     * static method to create the object Precondition: If this object is an element, the current or
     * next start element starts this object and any intervening reader events are ignorable If this
     * object is not an element, it is a complex type and the reader is at the event just after the
     * outer start element Postcondition: If this object is an element, the reader is positioned at
     * its end element If this object is a complex type, the reader is positioned at the end element
     * of its outer element
     */
    public static GetServerListForActivity parse(javax.xml.stream.XMLStreamReader reader)
        throws java.lang.Exception {
      GetServerListForActivity object = new GetServerListForActivity();

      int event;
      java.lang.String nillableValue = null;
      java.lang.String prefix = "";
      java.lang.String namespaceuri = "";
      try {

        while (!reader.isStartElement() && !reader.isEndElement()) reader.next();

        if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type") != null) {
          java.lang.String fullTypeName =
              reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type");
          if (fullTypeName != null) {
            java.lang.String nsPrefix = null;
            if (fullTypeName.indexOf(":") > -1) {
              nsPrefix = fullTypeName.substring(0, fullTypeName.indexOf(":"));
            }
            nsPrefix = nsPrefix == null ? "" : nsPrefix;

            java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":") + 1);

            if (!"getServerListForActivity".equals(type)) {
              // find namespace for the prefix
              java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix);
              return (GetServerListForActivity)
                  org.wso2.carbon.bam.ExtensionMapper.getTypeObject(nsUri, type, reader);
            }
          }
        }

        // Note all attributes that were handled. Used to differ normal attributes
        // from anyAttributes.
        java.util.Vector handledAttributes = new java.util.Vector();

        reader.next();

      } catch (javax.xml.stream.XMLStreamException e) {
        throw new java.lang.Exception(e);
      }

      return object;
    }
 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;
 }
예제 #17
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]));
   }
 }
예제 #18
0
  /**
   * RatesSetting de-serialization from input byte array
   *
   * @param ab Byte Array
   * @throws java.lang.Exception Thrown if RatesSetting cannot be properly de-serialized
   */
  public RatesSetting(final byte[] ab) throws java.lang.Exception {
    if (null == ab || 0 == ab.length)
      throw new java.lang.Exception("RatesSetting de-serializer: Invalid input Byte array");

    java.lang.String strRawString = new java.lang.String(ab);

    if (null == strRawString || strRawString.isEmpty())
      throw new java.lang.Exception("RatesSetting de-serializer: Empty state");

    java.lang.String strSerializedRatesSetting =
        strRawString.substring(0, strRawString.indexOf(getObjectTrailer()));

    if (null == strSerializedRatesSetting || strSerializedRatesSetting.isEmpty())
      throw new java.lang.Exception("RatesSetting de-serializer: Cannot locate state");

    java.lang.String[] astrField =
        org.drip.math.common.StringUtil.Split(strSerializedRatesSetting, getFieldDelimiter());

    if (null == astrField || 5 > astrField.length)
      throw new java.lang.Exception("RatesSetting de-serializer: Invalid reqd field set");

    // double dblVersion = new java.lang.Double (astrField[0]);

    if (null == astrField[1]
        || astrField[1].isEmpty()
        || org.drip.service.stream.Serializer.NULL_SER_STRING.equalsIgnoreCase(astrField[1]))
      throw new java.lang.Exception("RatesSetting de-serializer: Cannot locate Trade Currency");

    _strTradeDiscountCurve = astrField[1];

    if (null == astrField[2]
        || astrField[2].isEmpty()
        || org.drip.service.stream.Serializer.NULL_SER_STRING.equalsIgnoreCase(astrField[2]))
      throw new java.lang.Exception("RatesSetting de-serializer: Cannot locate Coupon Currency");

    _strCouponDiscountCurve = astrField[2];

    if (null == astrField[3]
        || astrField[3].isEmpty()
        || org.drip.service.stream.Serializer.NULL_SER_STRING.equalsIgnoreCase(astrField[3]))
      throw new java.lang.Exception("RatesSetting de-serializer: Cannot locate Principal Currency");

    _strPrincipalDiscountCurve = astrField[3];

    if (null == astrField[4]
        || astrField[4].isEmpty()
        || org.drip.service.stream.Serializer.NULL_SER_STRING.equalsIgnoreCase(astrField[4]))
      throw new java.lang.Exception(
          "RatesSetting de-serializer: Cannot locate Redemption Currency");

    _strRedemptionDiscountCurve = astrField[4];

    if (!validate()) throw new java.lang.Exception("RatesSetting de-serializer: Cannot validate!");
  }
 public static EnumMWSAttributeFormCategories_type0 fromString(
     javax.xml.stream.XMLStreamReader xmlStreamReader, java.lang.String content) {
   if (content.indexOf(":") > -1) {
     java.lang.String prefix = content.substring(0, content.indexOf(":"));
     java.lang.String namespaceUri =
         xmlStreamReader.getNamespaceContext().getNamespaceURI(prefix);
     return EnumMWSAttributeFormCategories_type0.Factory.fromString(content, namespaceUri);
   } else {
     return EnumMWSAttributeFormCategories_type0.Factory.fromString(content, "");
   }
 }
예제 #20
0
    /**
     * static method to create the object Precondition: If this object is an element, the current or
     * next start element starts this object and any intervening reader events are ignorable If this
     * object is not an element, it is a complex type and the reader is at the event just after the
     * outer start element Postcondition: If this object is an element, the reader is positioned at
     * its end element If this object is a complex type, the reader is positioned at the end element
     * of its outer element
     */
    public static DebugLevel parse(javax.xml.stream.XMLStreamReader reader)
        throws java.lang.Exception {
      DebugLevel object = null;
      // initialize a hash map to keep values
      java.util.Map attributeMap = new java.util.HashMap();
      java.util.List extraAttributeList =
          new java.util.ArrayList<org.apache.axiom.om.OMAttribute>();

      int event;
      java.lang.String nillableValue = null;
      java.lang.String prefix = "";
      java.lang.String namespaceuri = "";
      try {

        while (!reader.isStartElement() && !reader.isEndElement()) reader.next();

        // Note all attributes that were handled. Used to differ normal attributes
        // from anyAttributes.
        java.util.Vector handledAttributes = new java.util.Vector();

        while (!reader.isEndElement()) {
          if (reader.isStartElement() || reader.hasText()) {

            nillableValue =
                reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "nil");
            if ("true".equals(nillableValue) || "1".equals(nillableValue)) {
              throw new org.apache.axis2.databinding.ADBException(
                  "The element: " + "DebugLevel" + "  cannot be null");
            }

            java.lang.String content = reader.getElementText();

            if (content.indexOf(":") > 0) {
              // this seems to be a Qname so find the namespace and send
              prefix = content.substring(0, content.indexOf(":"));
              namespaceuri = reader.getNamespaceURI(prefix);
              object = DebugLevel.Factory.fromString(content, namespaceuri);
            } else {
              // this seems to be not a qname send and empty namespace incase of it is
              // check is done in fromString method
              object = DebugLevel.Factory.fromString(content, "");
            }

          } else {
            reader.next();
          }
        } // end of while loop

      } catch (javax.xml.stream.XMLStreamException e) {
        throw new java.lang.Exception(e);
      }

      return object;
    }
예제 #21
0
 public static TimeZone fromString(
     javax.xml.stream.XMLStreamReader xmlStreamReader, java.lang.String content) {
   if (content.indexOf(":") > -1) {
     java.lang.String prefix = content.substring(0, content.indexOf(":"));
     java.lang.String namespaceUri =
         xmlStreamReader.getNamespaceContext().getNamespaceURI(prefix);
     return TimeZone.Factory.fromString(content, namespaceUri);
   } else {
     return TimeZone.Factory.fromString(content, "");
   }
 }
  /**
   * TerminationSetting de-serialization from input byte array
   *
   * @param ab Byte Array
   * @throws java.lang.Exception Thrown if TerminationSetting cannot be properly de-serialized
   */
  public TerminationSetting(final byte[] ab) throws java.lang.Exception {
    if (null == ab || 0 == ab.length)
      throw new java.lang.Exception("TerminationSetting de-serializer: Invalid input Byte array");

    java.lang.String strRawString = new java.lang.String(ab);

    if (null == strRawString || strRawString.isEmpty())
      throw new java.lang.Exception("TerminationSetting de-serializer: Empty state");

    java.lang.String strSerializedTerminationSetting =
        strRawString.substring(0, strRawString.indexOf(getObjectTrailer()));

    if (null == strSerializedTerminationSetting || strSerializedTerminationSetting.isEmpty())
      throw new java.lang.Exception("TerminationSetting de-serializer: Cannot locate state");

    java.lang.String[] astrField =
        org.drip.quant.common.StringUtil.Split(
            strSerializedTerminationSetting, getFieldDelimiter());

    if (null == astrField || 4 > astrField.length)
      throw new java.lang.Exception("TerminationSetting de-serializer: Invalid reqd field set");

    // double dblVersion = new java.lang.Double (astrField[0]);

    if (null == astrField[1]
        || astrField[1].isEmpty()
        || org.drip.service.stream.Serializer.NULL_SER_STRING.equalsIgnoreCase(astrField[1]))
      throw new java.lang.Exception(
          "TerminationSetting de-serializer: Cannot locate perpetual flag");

    _bIsPerpetual = new java.lang.Boolean(astrField[1]);

    if (null == astrField[2]
        || astrField[2].isEmpty()
        || org.drip.service.stream.Serializer.NULL_SER_STRING.equalsIgnoreCase(astrField[2]))
      throw new java.lang.Exception(
          "TerminationSetting de-serializer: Cannot locate defaulted flag");

    _bIsDefaulted = new java.lang.Boolean(astrField[2]);

    if (null == astrField[3]
        || astrField[3].isEmpty()
        || org.drip.service.stream.Serializer.NULL_SER_STRING.equalsIgnoreCase(astrField[3]))
      throw new java.lang.Exception(
          "TerminationSetting de-serializer: Cannot locate exercised flag");

    _bHasBeenExercised = new java.lang.Boolean(astrField[3]);

    if (!validate())
      throw new java.lang.Exception("TerminationSetting de-serializer: Cannot validate!");
  }
    /**
     * static method to create the object Precondition: If this object is an element, the current or
     * next start element starts this object and any intervening reader events are ignorable If this
     * object is not an element, it is a complex type and the reader is at the event just after the
     * outer start element Postcondition: If this object is an element, the reader is positioned at
     * its end element If this object is a complex type, the reader is positioned at the end element
     * of its outer element
     */
    public static EnumMWSAttributeFormCategories_type0 parse(
        javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception {
      EnumMWSAttributeFormCategories_type0 object = null;
      // initialize a hash map to keep values
      java.util.Map attributeMap = new java.util.HashMap();
      java.util.List extraAttributeList = new java.util.ArrayList();

      int event;
      java.lang.String nillableValue = null;
      java.lang.String prefix = "";
      java.lang.String namespaceuri = "";
      try {

        while (!reader.isStartElement() && !reader.isEndElement()) reader.next();

        // Note all attributes that were handled. Used to differ normal
        // attributes
        // from anyAttributes.
        java.util.Vector handledAttributes = new java.util.Vector();

        while (!reader.isEndElement()) {
          if (reader.isStartElement() || reader.hasText()) {

            java.lang.String content = reader.getElementText();

            if (content.indexOf(":") > 0) {
              // this seems to be a Qname so find the namespace
              // and send
              prefix = content.substring(0, content.indexOf(":"));
              namespaceuri = reader.getNamespaceURI(prefix);
              object =
                  EnumMWSAttributeFormCategories_type0.Factory.fromString(content, namespaceuri);
            } else {
              // this seems to be not a qname send and empty
              // namespace incase of it is
              // check is done in fromString method
              object = EnumMWSAttributeFormCategories_type0.Factory.fromString(content, "");
            }

          } else {
            reader.next();
          }
        } // end of while loop

      } catch (javax.xml.stream.XMLStreamException e) {
        throw new java.lang.Exception(e);
      }

      return object;
    }
예제 #24
0
 public java.lang.String getMetricList(java.lang.StringBuffer stringbuffer) {
   java.lang.String s;
   try {
     s = doRequest("/?id=10&type=0", true, null);
   } catch (java.lang.Exception exception) {
     stringbuffer.append(exception.getMessage());
     return "";
   }
   int i = s.indexOf("<browse_data>");
   if (i > 0) {
     s = s.substring(i);
   }
   return s;
 }
예제 #25
0
 public Connection connect(java.lang.String dburl, java.util.Properties info) throws SQLException {
   if (acceptsURL(dburl)) {
     String dbname = dburl.substring(URL_PREFIX_LEN);
     try {
       java.util.Vector param = TextUtils.getWords(dbname, "/");
       if (param.size() > 1)
         return DBLogicalManager.getPoolConnection(
             param.elementAt(0).toString(), getIntValue(param.elementAt(1).toString(), 0));
       else return DBLogicalManager.getPoolConnection(dbname);
     } catch (ConnectTimeoutException cte) {
       throw new SQLException(cte.getMessage(), "TIMEOUT");
     } catch (DatabaseMarkdownException dme) {
       throw new SQLException(dme.getMessage(), "MARKDOWN");
     }
   }
   throw new SQLException("invalid url string error.");
 }
예제 #26
0
  public void addExceptions(java.lang.String exceptionStr) {
    if (Configuration.getShowImport().equalsIgnoreCase("true")) {
      java.lang.String simplename = "";
      java.lang.String fullName = exceptionStr;
      int lastSlash = fullName.lastIndexOf("/");
      if (lastSlash == -1) {
        lastSlash = fullName.lastIndexOf(".");
      }
      if (lastSlash != -1) {
        simplename = fullName.substring(lastSlash + 1);
      } else simplename = fullName;
      fullName = fullName.replace('/', '.');
      ConsoleLauncher.addImportClass(fullName);
      exceptions.add(simplename);

    } else exceptions.add(exceptionStr);
  }
  /**
   * De-serialize the FloatFloatComponent from the byte array
   *
   * @param ab Byte Array
   * @throws java.lang.Exception Thrown if the FloatFloatComponent cannot be de-serialized from the
   *     byte array
   */
  public FloatFloatComponent(final byte[] ab) throws java.lang.Exception {
    if (null == ab || 0 == ab.length)
      throw new java.lang.Exception("FloatFloatComponent de-serializer: Invalid input Byte array");

    java.lang.String strRawString = new java.lang.String(ab);

    if (null == strRawString || strRawString.isEmpty())
      throw new java.lang.Exception("FloatFloatComponent de-serializer: Empty state");

    java.lang.String strSerializedFloatFloatComponent =
        strRawString.substring(0, strRawString.indexOf(getObjectTrailer()));

    if (null == strSerializedFloatFloatComponent || strSerializedFloatFloatComponent.isEmpty())
      throw new java.lang.Exception("FloatFloatComponent de-serializer: Cannot locate state");

    java.lang.String[] astrField =
        org.drip.quant.common.StringUtil.Split(
            strSerializedFloatFloatComponent, getFieldDelimiter());

    if (null == astrField || 3 > astrField.length)
      throw new java.lang.Exception("FloatFloatComponent de-serializer: Invalid reqd field set");

    // double dblVersion = new java.lang.Double (astrField[0]).doubleValue();

    if (null == astrField[1] || astrField[1].isEmpty())
      throw new java.lang.Exception(
          "FloatFloatComponent de-serializer: Cannot locate visible floating stream");

    if (org.drip.service.stream.Serializer.NULL_SER_STRING.equalsIgnoreCase(astrField[1]))
      _floatReference = null;
    else _floatReference = new org.drip.product.rates.FloatingStream(astrField[1].getBytes());

    if (null == astrField[2] || astrField[2].isEmpty())
      throw new java.lang.Exception(
          "FloatFloatComponent de-serializer: Cannot locate work-out floating stream");

    if (org.drip.service.stream.Serializer.NULL_SER_STRING.equalsIgnoreCase(astrField[2]))
      _floatDerived = null;
    else _floatDerived = new org.drip.product.rates.FloatingStream(astrField[2].getBytes());
  }
  /**
   * De-serialization of DateAdjustParams from byte stream
   *
   * @param ab Byte stream
   * @throws java.lang.Exception Thrown if cannot properly de-serialize DateAdjustParams
   */
  public DateAdjustParams(final byte[] ab) throws java.lang.Exception {
    if (null == ab || 0 == ab.length)
      throw new java.lang.Exception("DateAdjustParams de-serialize: Invalid byte stream input");

    java.lang.String strRawString = new java.lang.String(ab);

    if (null == strRawString || strRawString.isEmpty())
      throw new java.lang.Exception("DateAdjustParams de-serializer: Empty state");

    java.lang.String strDAP = strRawString.substring(0, strRawString.indexOf(getObjectTrailer()));

    if (null == strDAP || strDAP.isEmpty())
      throw new java.lang.Exception("DateAdjustParams de-serializer: Cannot locate state");

    java.lang.String[] astrField =
        org.drip.analytics.support.GenericUtil.Split(strDAP, getFieldDelimiter());

    if (null == astrField || 3 > astrField.length)
      throw new java.lang.Exception("DateAdjustParams de-serialize: Invalid number of fields");

    // double dblVersion = new java.lang.Double (astrField[0]);

    if (null == astrField[1]
        || astrField[1].isEmpty()
        || org.drip.service.stream.Serializer.NULL_SER_STRING.equals(astrField[1]))
      throw new java.lang.Exception("DateAdjustParams de-serializer: Cannot locate roll mode");

    _iRollMode = new java.lang.Integer(astrField[1]).intValue();

    if (null == astrField[2]
        || astrField[2].isEmpty()
        || org.drip.service.stream.Serializer.NULL_SER_STRING.equals(astrField[2]))
      throw new java.lang.Exception("DateAdjustParams de-serializer: Cannot locate calendar");

    _strCalendar = astrField[2];
  }
    /**
     * static method to create the object Precondition: If this object is an element, the current or
     * next start element starts this object and any intervening reader events are ignorable If this
     * object is not an element, it is a complex type and the reader is at the event just after the
     * outer start element Postcondition: If this object is an element, the reader is positioned at
     * its end element If this object is a complex type, the reader is positioned at the end element
     * of its outer element
     */
    public static DescribeSoqlListViewResult parse(javax.xml.stream.XMLStreamReader reader)
        throws java.lang.Exception {
      DescribeSoqlListViewResult object = new DescribeSoqlListViewResult();

      int event;
      java.lang.String nillableValue = null;
      java.lang.String prefix = "";
      java.lang.String namespaceuri = "";
      try {

        while (!reader.isStartElement() && !reader.isEndElement()) reader.next();

        if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type") != null) {
          java.lang.String fullTypeName =
              reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type");
          if (fullTypeName != null) {
            java.lang.String nsPrefix = null;
            if (fullTypeName.indexOf(":") > -1) {
              nsPrefix = fullTypeName.substring(0, fullTypeName.indexOf(":"));
            }
            nsPrefix = nsPrefix == null ? "" : nsPrefix;

            java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":") + 1);

            if (!"DescribeSoqlListViewResult".equals(type)) {
              // find namespace for the prefix
              java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix);
              return (DescribeSoqlListViewResult)
                  com.salesforce.soap.partner.sobject.ExtensionMapper.getTypeObject(
                      nsUri, type, reader);
            }
          }
        }

        // Note all attributes that were handled. Used to differ normal attributes
        // from anyAttributes.
        java.util.Vector handledAttributes = new java.util.Vector();

        reader.next();

        java.util.ArrayList list1 = new java.util.ArrayList();

        while (!reader.isStartElement() && !reader.isEndElement()) reader.next();

        if (reader.isStartElement()
            && new javax.xml.namespace.QName("urn:partner.soap.sforce.com", "describeSoqlListViews")
                .equals(reader.getName())) {

          // Process the array and step past its final element's end.
          list1.add(com.salesforce.soap.partner.DescribeSoqlListView.Factory.parse(reader));

          // loop until we find a start element that is not part of this array
          boolean loopDone1 = false;
          while (!loopDone1) {
            // We should be at the end element, but make sure
            while (!reader.isEndElement()) reader.next();
            // Step out of this element
            reader.next();
            // Step to next element event.
            while (!reader.isStartElement() && !reader.isEndElement()) reader.next();
            if (reader.isEndElement()) {
              // two continuous end elements means we are exiting the xml structure
              loopDone1 = true;
            } else {
              if (new javax.xml.namespace.QName(
                      "urn:partner.soap.sforce.com", "describeSoqlListViews")
                  .equals(reader.getName())) {
                list1.add(com.salesforce.soap.partner.DescribeSoqlListView.Factory.parse(reader));

              } else {
                loopDone1 = true;
              }
            }
          }
          // call the converter utility to convert and set the array

          object.setDescribeSoqlListViews(
              (com.salesforce.soap.partner.DescribeSoqlListView[])
                  org.apache.axis2.databinding.utils.ConverterUtil.convertToArray(
                      com.salesforce.soap.partner.DescribeSoqlListView.class, list1));

        } // End of if for expected property start element
        else {
          // A start element we are not expecting indicates an invalid parameter was passed
          throw new org.apache.axis2.databinding.ADBException(
              "Unexpected subelement " + reader.getName());
        }

        while (!reader.isStartElement() && !reader.isEndElement()) reader.next();

        if (reader.isStartElement())
          // A start element we are not expecting indicates a trailing invalid property
          throw new org.apache.axis2.databinding.ADBException(
              "Unexpected subelement " + reader.getName());

      } catch (javax.xml.stream.XMLStreamException e) {
        throw new java.lang.Exception(e);
      }

      return object;
    }
예제 #30
0
    /**
     * static method to create the object Precondition: If this object is an element, the current or
     * next start element starts this object and any intervening reader events are ignorable If this
     * object is not an element, it is a complex type and the reader is at the event just after the
     * outer start element Postcondition: If this object is an element, the reader is positioned at
     * its end element If this object is a complex type, the reader is positioned at the end element
     * of its outer element
     */
    public static XGetUserOutput parse(javax.xml.stream.XMLStreamReader reader)
        throws java.lang.Exception {
      XGetUserOutput object = new XGetUserOutput();

      int event;
      java.lang.String nillableValue = null;
      java.lang.String prefix = "";
      java.lang.String namespaceuri = "";
      try {

        while (!reader.isStartElement() && !reader.isEndElement()) reader.next();

        if (reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type") != null) {
          java.lang.String fullTypeName =
              reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance", "type");
          if (fullTypeName != null) {
            java.lang.String nsPrefix = null;
            if (fullTypeName.indexOf(":") > -1) {
              nsPrefix = fullTypeName.substring(0, fullTypeName.indexOf(":"));
            }
            nsPrefix = nsPrefix == null ? "" : nsPrefix;

            java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":") + 1);

            if (!"XGetUserOutput".equals(type)) {
              // find namespace for the prefix
              java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix);
              return (XGetUserOutput)
                  vng.zingme.payment.paymentgateway.push.ws.ExtensionMapper.getTypeObject(
                      nsUri, type, reader);
            }
          }
        }

        // Note all attributes that were handled. Used to differ normal attributes
        // from anyAttributes.
        java.util.Vector handledAttributes = new java.util.Vector();

        reader.next();

        while (!reader.isStartElement() && !reader.isEndElement()) reader.next();

        if (reader.isStartElement()
            && new javax.xml.namespace.QName("", "code").equals(reader.getName())) {

          java.lang.String content = reader.getElementText();

          object.setCode(org.apache.axis2.databinding.utils.ConverterUtil.convertToString(content));

          reader.next();

        } // End of if for expected property start element
        else {
          // A start element we are not expecting indicates an invalid parameter was passed
          throw new org.apache.axis2.databinding.ADBException(
              "Unexpected subelement " + reader.getLocalName());
        }

        while (!reader.isStartElement() && !reader.isEndElement()) reader.next();

        if (reader.isStartElement()
            && new javax.xml.namespace.QName("", "userID").equals(reader.getName())) {

          java.lang.String content = reader.getElementText();

          object.setUserID(
              org.apache.axis2.databinding.utils.ConverterUtil.convertToString(content));

          reader.next();

        } // End of if for expected property start element
        else {
          // A start element we are not expecting indicates an invalid parameter was passed
          throw new org.apache.axis2.databinding.ADBException(
              "Unexpected subelement " + reader.getLocalName());
        }

        while (!reader.isStartElement() && !reader.isEndElement()) reader.next();

        if (reader.isStartElement())
          // A start element we are not expecting indicates a trailing invalid property
          throw new org.apache.axis2.databinding.ADBException(
              "Unexpected subelement " + reader.getLocalName());

      } catch (javax.xml.stream.XMLStreamException e) {
        throw new java.lang.Exception(e);
      }

      return object;
    }