Package java.util

Examples of java.util.LinkedList


  /**
   * Creates a new MemoryAppender instance.
   */
  public MemoryAppender() {
    mCache = new LinkedList();
    mMaxCacheSize = 30;
  }
View Full Code Here


   * for example, if representing a geographic thesauri: WORLD,AMERICA,NORTH AMERICA,USA,CANADA,MEXICO,SOUTH AMERICA,BRAZIL,ARGENTINA,CHILE,EUROPE,SPAIN,FRANCE,GERMANY
   * @throws SQLException
   */
  public LinkedList getChilds (JDCConnection oConn, int iScope)
    throws SQLException {
    LinkedList oTermsList = new LinkedList();

    if (isNull(DB.gu_term)) {
      if (DebugFile.trace)
        DebugFile.writeln("ERROR - Term.getChilds() Attemped to get childs of an unloaded Term.");

View Full Code Here

            ).booleanValue();
     
      this.xslContentTransformerFileName = prop.getProperty(XSL_CONTENT_TRANSFORMER_FILE_NAME, this.xslContentTransformerFileName);
      //this.xslQosTransformerFileName = prop.getProperty(XSL_QOS_TRANSFORMER_FILE_NAME, this.xslQosTransformerFileName);

      domCache = new LinkedList();

      // attempt to get the mime types from the init properties
      String someMimeTypes = prop.getProperty(XPATH_MIME_TYPES, "text/xml;image/svg+xml");
      StringTokenizer st = new StringTokenizer(someMimeTypes, ";");
      ArrayList list = new ArrayList(st.countTokens() + 1);
View Full Code Here

    Node oCurrentNode = null; // Iterador de nodos hijo
    Node oTag = null; // Nodo nieto <tag>
    NodeList oChilds = oParent.getChildNodes(); // Lista total de nodos hijo
    int iMaxNodes = oChilds.getLength(); // Cuenta de nodos hijo
    LinkedList oList = new LinkedList(); // Lista resultado

    Pattern oPattern = null;
    PatternMatcher oMatcher = new Perl5Matcher();
    PatternCompiler oCompiler = new Perl5Compiler();

    try {
      // Compile regular expression at Pattern Matcher
      oPattern = oCompiler.compile(sPattern);
    } catch(MalformedPatternException e) {}

    // Iterate throught child nodes
    for (int iNode=0; iNode<iMaxNodes; iNode++) {
      // Assign oCurrentNode as an alias for the current node.
      oCurrentNode = oChilds.item(iNode);
      if(Node.ELEMENT_NODE==oCurrentNode.getNodeType()) {

        // Seek grandchild by name
        oTag = seekChildByName(oCurrentNode, "tag");
        if (null!=oTag)
          // If pattern matches add child to list
          if (oMatcher.matches(getTextValue((Element)oTag), oPattern))
            oList.addLast(oCurrentNode);
      } // fi(ELEMENT_NODE)
    } // next(iNode)

    return oList;
  // matchChildsByTag
View Full Code Here

        this.address = address;
        this.port = port;
        this.localAddr = localAddr;
        this.localPort = localPort;

        sessions = new LinkedList();
        responseTable = new HashMap();
        outLock = new Object();
        state = ST_GROUND;

        int i;
View Full Code Here

    String sCol;
    ListIterator oColIterator;
    PreparedStatement oStmt;
    int iAffected;

    LinkedList oStreams;
    InputStream oStream;
    String sClassName;

    if (null==oConn)
      throw new NullPointerException("DBTable.storeRegisterLong() Connection is null");

    if (DebugFile.trace)
      {
      DebugFile.writeln("Begin DBTable.storeRegisterLong([Connection:"+oConn.pid()+"], {" + AllValues.toString() + "})" );
      DebugFile.incIdent();
      }

    oStreams  = new LinkedList();

    if (null!=sUpdate) {

      if (DebugFile.trace) DebugFile.writeln("Connection.prepareStatement(" + sUpdate + ")");

      oStmt = oConn.prepareStatement(sUpdate);

      try { if (oConn.getDataBaseProduct()!=JDCConnection.DBMS_POSTGRESQL) oStmt.setQueryTimeout(10); } catch (SQLException sqle) { if (DebugFile.trace) DebugFile.writeln("Error at PreparedStatement.setQueryTimeout(10)" + sqle.getMessage()); }

      c = 1;
      oColIterator = oColumns.listIterator();
      while (oColIterator.hasNext()) {
        oCol = (DBColumn) oColIterator.next();
        sCol = oCol.getName().toLowerCase();

        if (!oPrimaryKeys.contains(sCol) &&
            (!sCol.equalsIgnoreCase(DB.dt_created))) {

          if (DebugFile.trace) {
            if (oCol.getSqlType()==java.sql.Types.CHAR || oCol.getSqlType()==java.sql.Types.VARCHAR) {
              if (AllValues.get(sCol) != null) {
                DebugFile.writeln("Binding " + sCol + "=" +
                                  AllValues.get(sCol).toString());
                if (AllValues.get(sCol).toString().length() > oCol.getPrecision())
                  DebugFile.writeln("ERROR: value for " + oCol.getName() +
                                    " exceeds columns precision of " +
                                    String.valueOf(oCol.getPrecision()));
              } // fi (AllValues.get(sCol)!=null)
              else
                DebugFile.writeln("Binding " + sCol + "=NULL");
            }
          } // fi (DebugFile.trace)

          if (oCol.getSqlType()==java.sql.Types.LONGVARCHAR || oCol.getSqlType()==java.sql.Types.CLOB || oCol.getSqlType()==java.sql.Types.LONGVARBINARY || oCol.getSqlType()==java.sql.Types.BLOB) {
            if (BinaryLengths.containsKey(sCol)) {
              if (((Long)BinaryLengths.get(sCol)).intValue()>0) {
                sClassName = AllValues.get(sCol).getClass().getName();
                if (sClassName.equals("java.io.File"))
                  oStream = new FileInputStream((File) AllValues.get(sCol));
                else if (sClassName.equals("[B"))
                  oStream = new ByteArrayInputStream((byte[]) AllValues.get(sCol));
                else if (sClassName.equals("[C"))
                  oStream = new StringBufferInputStream(new String((char[]) AllValues.get(sCol)));
                else {
                  Class[] aInts = AllValues.get(sCol).getClass().getInterfaces();
                  if (aInts==null) {
                    throw new SQLException ("Invalid object binding for column " + sCol);
                  } else {
                    boolean bSerializable = false;
                    for (int i=0; i<aInts.length &!bSerializable; i++)
                      bSerializable |= aInts[i].getName().equals("java.io.Serializable");
                    if (bSerializable) {
                      ByteArrayOutputStream oBOut = new ByteArrayOutputStream();
                      ObjectOutputStream oOOut = new ObjectOutputStream(oBOut);
                      oOOut.writeObject(AllValues.get(sCol));
                      oOOut.close();
                      ByteArrayInputStream oBin = new ByteArrayInputStream(oBOut.toByteArray());
                      oStream = new ObjectInputStream(oBin);                   
                    } else {
                      throw new SQLException ("Invalid object binding for column " + sCol);                     
                    }
                  } // fi
                }
                oStreams.addLast(oStream);
                oStmt.setBinaryStream(c++, oStream, ((Long)BinaryLengths.get(sCol)).intValue());
              }
              else
                oStmt.setObject (c++, null, oCol.getSqlType());
            }
            else
             oStmt.setObject (c++, null, oCol.getSqlType());
          }
          else
            oConn.bindParameter (oStmt, c++, AllValues.get(sCol), oCol.getSqlType());
          } // fi (!oPrimaryKeys.contains(sCol))
        } // wend

      oColIterator = oPrimaryKeys.listIterator();
      while (oColIterator.hasNext()) {
        sCol = (String) oColIterator.next();
        oCol = getColumnByName(sCol);

        if (DebugFile.trace) DebugFile.writeln("PreparedStatement.setObject (" + String.valueOf(c) + "," + AllValues.get(sCol) + "," + oCol.getSqlTypeName() + ")");

        oConn.bindParameter (oStmt, c, AllValues.get(sCol), oCol.getSqlType());
        c++;
      } // wend

      if (DebugFile.trace) DebugFile.writeln("PreparedStatement.executeUpdate()");

      iAffected = oStmt.executeUpdate();

      if (DebugFile.trace) DebugFile.writeln(String.valueOf(iAffected) " affected rows");

      oStmt.close();

      oColIterator = oStreams.listIterator();

      while (oColIterator.hasNext())
        ((InputStream) oColIterator.next()).close();

      oStreams.clear();

    }
    else
      iAffected = 0;

    if (0==iAffected)
        {
        bNewRow = true;

        if (DebugFile.trace) DebugFile.writeln("Connection.prepareStatement(" + sInsert + ")");

        oStmt = oConn.prepareStatement(sInsert);

        c = 1;
        oColIterator = oColumns.listIterator();

        while (oColIterator.hasNext()) {

          oCol  = (DBColumn)oColIterator.next();
          sCol = oCol.getName();

          if (DebugFile.trace) {
            if (null!=AllValues.get(sCol))
              DebugFile.writeln("Binding " + sCol + "=" + AllValues.get(sCol).toString());
            else
              DebugFile.writeln("Binding " + sCol + "=NULL");
          }

          if (oCol.getSqlType()==java.sql.Types.LONGVARCHAR || oCol.getSqlType()==java.sql.Types.CLOB || oCol.getSqlType()==java.sql.Types.LONGVARBINARY || oCol.getSqlType()==java.sql.Types.BLOB) {
            if (BinaryLengths.containsKey(sCol)) {
              if ( ( (Long) BinaryLengths.get(sCol)).intValue() > 0) {
                sClassName = AllValues.get(sCol).getClass().getName();
                if (sClassName.equals("java.io.File"))
                  oStream = new FileInputStream((File) AllValues.get(sCol));
                else if (sClassName.equals("[B"))
                  oStream = new ByteArrayInputStream((byte[]) AllValues.get(sCol));
                else if (sClassName.equals("[C"))
                  oStream = new StringBufferInputStream(new String((char[]) AllValues.get(sCol)));
                else {
                  Class[] aInts = AllValues.get(sCol).getClass().getInterfaces();
                  if (aInts==null) {
                    throw new SQLException ("Invalid object binding for column " + sCol);
                  } else {
                    boolean bSerializable = false;
                    for (int i=0; i<aInts.length &!bSerializable; i++)
                      bSerializable |= aInts[i].getName().equals("java.io.Serializable");
                    if (bSerializable) {
                      ByteArrayOutputStream oBOut = new ByteArrayOutputStream();
                      ObjectOutputStream oOOut = new ObjectOutputStream(oBOut);
                      oOOut.writeObject(AllValues.get(sCol));
                      oOOut.close();
                      ByteArrayInputStream oBin = new ByteArrayInputStream(oBOut.toByteArray());
                      oStream = new ObjectInputStream(oBin);                   
                    } else {
                      throw new SQLException ("Invalid object binding for column " + sCol);                     
                    }
                  } // fi
                }
                oStreams.addLast(oStream);
                oStmt.setBinaryStream(c++, oStream, ((Long) BinaryLengths.get(sCol)).intValue());
              }
              else
                oStmt.setObject(c++, null, oCol.getSqlType());
            }
            else
              oStmt.setObject(c++, null, oCol.getSqlType());
          }
          else
            oConn.bindParameter (oStmt, c++, AllValues.get(sCol), oCol.getSqlType());
        } // wend

        if (DebugFile.trace) DebugFile.writeln("PreparedStatement.executeUpdate()");

        iAffected = oStmt.executeUpdate();

        if (DebugFile.trace) DebugFile.writeln(String.valueOf(iAffected) " affected rows");

        oStmt.close();

        oColIterator = oStreams.listIterator();

        while (oColIterator.hasNext())
          ((InputStream) oColIterator.next()).close();

        oStreams.clear();
    }

    else
        bNewRow = false;
View Full Code Here

                        DB.id_domain + "=? AND " + DB.gu_workarea + "=? AND (" +
                        DB.id_scope + "='geozone' OR " +
                        DB.id_scope + "='all') ORDER BY 2", 10);
      int iRoots = oRoots.load (oConn, new Object[]{new Integer(iIdDomain), sGuWorkArea});
   
      LinkedList oTerms = new LinkedList();
     
      for (int r=0; r<iRoots; r++) {
        Term oRoot = new Term();
        if (oRoot.load(oConn, iIdDomain, oRoots.getString(1,r))) {
     
          oTerms.addLast(oRoot);
          oTerms.addAll (oRoot.getChilds(oConn, Term.SCOPE_ALL));
        } // fi
      } // next (r)

      StringBuffer oTermsBuff = new StringBuffer();
   
      ListIterator oIter = oTerms.listIterator();
      while (oIter.hasNext()) {
        Term oChld = (Term) oIter.next();

        oTermsBuff.append("<OPTION VALUE=\"" + oChld.getString(DB.gu_term) + "\">");
        for (int s=1; s<oChld.level(); s++)
View Full Code Here

    FileInputStream oInProps = new FileInputStream (sPropertiesFilePath);
    oEnvProps = new Properties();
    oEnvProps.load (oInProps);
    oInProps.close ();

    oCallbacks = new LinkedList();

    sProfile = sPropertiesFilePath.substring(sPropertiesFilePath.lastIndexOf(File.separator)+1,sPropertiesFilePath.lastIndexOf('.'));

  } // SchedulerDaemon
View Full Code Here

   * @since 3.0
   */
  public String[] runningJobs() {
    Atom[] aAtoms = runningAtoms();
    if (aAtoms==null) return null;
    LinkedList oJobs = new LinkedList();
    String sJob;
    int nAtoms = aAtoms.length;
    for (int a=0; a<nAtoms; a++) {
      sJob = aAtoms[a].getString(DB.gu_job);
      if (oJobs.contains(sJob)) oJobs.add(sJob);
    }
    if (oJobs.size()==0) return null;
    String[] aJobs = new String[oJobs.size()];
    ListIterator oIter = oJobs.listIterator();
    int j = 0;
    while (oIter.hasNext()) {
      aJobs[j] = (String) oIter.next();
    } // wend
    return aJobs;
View Full Code Here

    sContext = "";
    sNode = "";
    oFromPKs = new HashMap (5,3);
    oToPKs = new HashMap (5,3);

    InitStmts = new LinkedList();
    TermStmts = new LinkedList();

    if (DebugFile.trace) {
      DebugFile.decIdent();
      DebugFile.writeln ("End DataStruct.startDocument()");
    }
View Full Code Here

TOP

Related Classes of java.util.LinkedList

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.