Package nexj.core.util

Examples of nexj.core.util.Lookup


            }
         }

         if (isMultipart())
         {
            Lookup paramMap = getMultipartParameters(null, 0);

            if (parameters == null && paramMap.size() > 0)
            {
               parameters = new TransferObject(paramMap.size());
            }

            for (Lookup.Iterator itr = paramMap.iterator(); itr.hasNext();)
            {
               itr.next();
               parameters.setValue((String)itr.getKey(), itr.getValue());
            }
         }
View Full Code Here


    * @param ignoreSet The set of parameters to ignore.
    * @return A map containing the parameters and their values.
    */
   public static Lookup parseQuery(String sQuery, Set ignoreSet)
   {
      Lookup result = null;
     
      int nQueryLength = (sQuery == null) ? 0 : sQuery.length();

      for (int i = 0; i < nQueryLength;)
      {
         int j = sQuery.indexOf('&', i);

         if (j < 0)
         {
            j = nQueryLength;
         }

         int k = sQuery.indexOf('=', i);

         if (k < 0 || k > j)
         {
            k = j;
         }

         try
         {
            String sName = URLDecoder.decode(sQuery.substring(i, k), GenericHTTPServer.ENCODING);
           
            if (ignoreSet == null || !ignoreSet.contains(sName))
            {
               String sValue;

               if (k != j && k + 1 < nQueryLength)
               {
                  sValue = URLDecoder.decode(sQuery.substring(k + 1, j), GenericHTTPServer.ENCODING);
               }
               else
               {
                  sValue = "";
               }

               if (result == null)
               {
                  result = new LookupHashMap();
               }

               String[] sValueArray = (String[])result.get(sName);

               if (sValueArray != null)
               {
                  int n = sValueArray.length;
                  String[] sNewValueArray = new String[n + 1];

                  System.arraycopy(sValueArray, 0, sNewValueArray, 0, n);
                  sNewValueArray[n] = sValue;
                  result.put(sName, sNewValueArray);
               }
               else
               {           
                  result.put(sName, new String[]{sValue});
               }
            }
         }
         // If there is a decoding issue then we do not add the key value pair to the result map
         // and fall back on the value in the request parameter map.
View Full Code Here

    */
   protected Object parseObject()
   {
      String sKey = null;
      Object value = null;
      Lookup objMap = new HashTab(4);

      ++m_nListDepth;

      if (getCurToken() != TOKEN_CBRACE)
      {
         for (;;)
         {
            value = parseValue();
            // key
            if (value instanceof String)
            {
               sKey = (String)m_tokenValue;
            }
            else
            {
               fail("err.parser.json.object.unexpectedKeyValue", new Object[] { value }, getCurTokenPos());
            }

            // value
            if (getCurToken() != TOKEN_COLON)
            {
               fail("err.parser.unexpectedToken", new Object[] { m_tokenValue }, getCurTokenPos());
            }
            else
            {
               forgetToken();
               value = parseValue();
               objMap.put(sKey, value);

               if (getCurToken() == TOKEN_CBRACE)
               {
                  forgetToken();
                  --m_nListDepth;
View Full Code Here

         m_loader.addIOFixup(new ContextFixup(getHelper())
         {
            public void fixup()
            {
               Lookup aliasFragmentMap = new HashTab();

               for (Iterator itr = m_loader.getMetadata().getDataSourceIterator(); itr.hasNext(); )
               {
                  DataSource ds = (DataSource)itr.next();

                  if (ds instanceof RelationalDatabase)
                  {
                     RelationalDatabase rel = (RelationalDatabase)ds;

                     for (Iterator fragItr = rel.getFragmentIterator(); fragItr.hasNext(); )
                     {
                        RelationalDatabaseFragment frag = (RelationalDatabaseFragment)fragItr.next();
                        RelationalDatabaseFragment oldFrag = (RelationalDatabaseFragment)aliasFragmentMap.put(frag.getAlias(), frag);

                        if (oldFrag == null)
                        {
                           frag.setFirst(true);
                        }
                        else
                        {
                           frag.setFirst(false);
                           aliasFragmentMap.put(frag.getAlias(), oldFrag);

                           if (!frag.isCompatible(oldFrag))
                           {
                              throw new MetadataValidationException("err.meta.persistence.fragmentPropertyMismatch",
                                 new Object[]{frag.getDataSource().getName() + frag.getSuffix(), oldFrag.getDataSource().getName() + oldFrag.getSuffix()});
View Full Code Here

    * @param step The upgrade step.
    * @param bPhantom True if the column will be dropped.
    */
   public void addColumn(String sTable, String sName, RelationalSchemaUpgradeStep step, boolean bPhantom)
   {
      Lookup columnMap = (Lookup)m_columnMap.get(sTable);

      if (columnMap == null)
      {
         columnMap = new HashTab();
         m_columnMap.put(sTable, columnMap);
      }

      ColumnUpgradeInfo info = (ColumnUpgradeInfo)columnMap.get(sName);

      if (info != null)
      {
         if (bPhantom && !info.isPhantom())
         {
            info.setPhantom(true);
            info.setStep(step);
         }
      }
      else
      {
         columnMap.put(sName, new ColumnUpgradeInfo(step, bPhantom));
      }
   }
View Full Code Here

    * @param sName The column name.
    * @return True if the column was found and removed.
    */
   public boolean removeColumn(String sTable, String sName)
   {
      Lookup columnMap = (Lookup)m_columnMap.get(sTable);

      if (columnMap == null)
      {
         return false;
      }

      ColumnUpgradeInfo info = (ColumnUpgradeInfo)columnMap.remove(sName);

      return info != null && info.isPhantom();
   }
View Full Code Here

    * @param sNewName The new column name.
    * @return True if the column was found and renamed.
    */
   public boolean renameColumn(String sTable, String sOldName, String sNewName)
   {
      Lookup columnMap = (Lookup)m_columnMap.get(sTable);

      if (columnMap == null)
      {
         return false;
      }

      ColumnUpgradeInfo info = (ColumnUpgradeInfo)columnMap.remove(sOldName);

      if (info == null)
      {
         return false;
      }

      columnMap.put(sNewName, info);

      return info.isPhantom();
   }
View Full Code Here

    * @param sName The column name.
    * @return True if the column exists.
    */
   public boolean containsColumn(String sTable, String sName)
   {
      Lookup columnMap = (Lookup)m_columnMap.get(sTable);

      if (columnMap == null)
      {
         return false;
      }

      ColumnUpgradeInfo info = (ColumnUpgradeInfo)columnMap.get(sName);

      return info != null && info.isPhantom();
   }
View Full Code Here

         }
      }
     
      for (Lookup.Iterator tblItr = m_columnMap.valueIterator(); tblItr.hasNext();)
      {
         Lookup columnMap = (Lookup)tblItr.next();

         try
         {
            Table table = m_schema.getTable((String)tblItr.getKey());

            for (Lookup.Iterator colItr = columnMap.iterator(); colItr.hasNext();)
            {
               String sName = (String)colItr.next();
               ColumnUpgradeInfo info = (ColumnUpgradeInfo)colItr.getValue();
              
               try
               {
                  Column column = table.getColumn(sName);

                  if (!info.isPhantom())
                  {
                     throw new MetadataException("err.meta.upgrade.sql.missingColumnDef",
                        new Object[]{column.getName(), table.getName(), m_final.getDataSource().getName()});
                  }
               }
               catch (UncheckedException e)
               {
                  eh = info.getStep().addException(eh, e);
               }
            }
         }
         catch (UncheckedException e)
         {
            for (Lookup.Iterator/*<String, ColumnUpgradeInfo>*/ colItr = columnMap.valueIterator();
                 colItr.hasNext();)
            {
               eh = ((ColumnUpgradeInfo)colItr.next()).getStep().addException(eh, e);
            }
         }
View Full Code Here

    */
   protected Lookup getMultipartParameters(Lookup sizeMap, long lDefMaxSize) throws IOException, RequestException
   {
      try
      {
         Lookup paramMap = new HashTab();
         MIMEHeader header = new MIMEHeader(null, m_request.getHeader("Content-Type"));

         if (header.getFirstValue() == null || !header.getFirstValue().getName().equals(MULTIPART_FORM_DATA))
         {
            throw new MultipartDataException("Unexpected content type");
View Full Code Here

TOP

Related Classes of nexj.core.util.Lookup

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.