Package nexj.core.util

Examples of nexj.core.util.HashHolder


               Metaclass metaclass = instance.getLazyMetaclass().getPersistenceRoot();
               Set oidSet = (Set)whereMap.get(metaclass);

               if (oidSet == null)
               {
                  oidSet = new HashHolder();
                  whereMap.put(metaclass, oidSet);
               }

               oidSet.add(oid);
            }
View Full Code Here


            return new SQLWriterConnection(adapter, out, false);
         }
      };

      List/*<SQLAdapter>*/ adapterList = new ArrayList/*<SQLAdapter>*/();
      Set importDataSourceSet = new HashHolder();

      // inject a stream outputting component into every DataSource so none hits DB
      for (Iterator/*<DataSource>*/ itr = getDataSourceIterator(dataSourceSet);
           itr.hasNext();)
      {
         DataSource ds = (DataSource)itr.next();

         // only support RelationalDatabase for SQL dump
         if (!(ds instanceof RelationalDatabase))
         {
            continue; // skip DataSources without any Metaclasses mapped to them
         }

         importDataSourceSet.add(ds);

         SQLAdapter adapter = (SQLAdapter)ds.getComponent().getInstance(m_context);

         adapterList.add(adapter); //reference locally so not GCed
         adapter.setConnectionFactory(outCF); // override adapter's SQLConnectionFactory
View Full Code Here

    */
   public void addSteppingBreakpoint(Object spec)
   {
      if (m_steppingBreakpointSet == null)
      {
         m_steppingBreakpointSet = new HashHolder(2);
      }

      m_steppingBreakpointSet.add(spec);
   }
View Full Code Here

         instanceSet = (Set)m_parentInstanceMap.get(oid);
      }

      if (instanceSet == null)
      {
         instanceSet = new HashHolder(2);
         m_parentInstanceMap.put(oid, instanceSet);
      }

      instanceSet.add(instance);
   }
View Full Code Here

            s_logger.debug("Joining " + m_parent.getMetaclass().getName() + '.' +
               m_attribute.getName() + '(' + m_metaclass.getName() + ')' +
               ((isCached()) ? " from cache" : ""));
         }

         Set oidSet = new HashHolder(m_parentInstanceMap.size());

         for (Iterator itr = m_parentInstanceMap.iterator(); itr.hasNext();)
         {
            oidSet.add(itr.next());
         }

         AttributeOperator aop = new AttributeOperator(new Field(this, m_mapping, m_childItem, m_metaclass, null, null, false));

         if (isCached() && m_persistenceMapping.getCaching() == PersistenceMapping.CACHING_INSTANCE)
         {
            EqualsOperator eq = new EqualsOperator();

            eq.setLeft(aop);
            eq.setRight(new ConstantOperator(null));

            for (Iterator itr = oidSet.iterator(); itr.hasNext();)
            {
               EqualsOperator clone = (oidSet.size() == 1) ? eq : (EqualsOperator)eq.clone();

               clone.getRight().setValue(itr.next());
               read(clone);
            }
         }
         else
         {
            InOperator in = new InOperator();

            in.addOperand(aop);

            for (Iterator itr = oidSet.iterator(); itr.hasNext();)
            {
               in.addOperand(new ConstantOperator(itr.next()));
            }

            read(in);
View Full Code Here

    * @param resourceColItr An iterator over ResourceCollection instances
    * @return A Set of files
    */
   private Collection collectFiles(Iterator resourceColItr)
   {
      Set fileSet = new HashHolder();
     
      // collect using a TreeSet to weed out duplicates
      while (resourceColItr.hasNext())
      {
         ResourceCollection rc = (ResourceCollection)resourceColItr.next();
         File file, dir = null;
         String[] sNameArray = null;
        
         int nIndex;

         if (rc instanceof FileSet)
         {
            FileSet fset = (FileSet)rc;
            sNameArray = fset.getDirectoryScanner(getProject()).getIncludedFiles();
            dir = fset.getDir();
         }
         else if (rc instanceof FileList)
         {
            FileList flist = (FileList)rc;
            sNameArray = flist.getFiles(getProject());
            dir = flist.getDir(getProject());
         }
         else if (rc instanceof DirSet)
         {
            DirSet dset = (DirSet)rc;
            dir = dset.getDir(getProject());

            if (dir.exists())
            {
               DirectoryScanner ds = dset.getDirectoryScanner(getProject());
               sNameArray = ds.getIncludedFiles();
               fileSet.add(dir);
            }
         }
         else
         {
            raiseBuildException("Unknown ResourceCollection: " + rc.getClass().getCanonicalName(), null);
         }

         if (sNameArray == null || dir == null)
         {
            continue;
         }

         for (nIndex = 0; nIndex < sNameArray.length; nIndex++)
         {
            file = new File(dir, sNameArray[nIndex]);
            fileSet.add(file);

            // get parent dirs between target file and dir (fileset directory)
            for (;;)
            {
               file = file.getParentFile();

               if (file.equals(dir))
               {
                  break;
               }

               fileSet.add(file);
            }
         }
      }

      return fileSet;
View Full Code Here

      {
         return null;
      }

      PersistenceMapping[] mappings = null;
      Set restrictionSet = new HashHolder(1);

      addRestrictions(restrictionSet, getWhere());
      addRestrictions(restrictionSet, where);

      if (assocs != null)
      {
         mappings = new PersistenceMapping[assocs.length];

         for (int i = 0; i < assocs.length; ++i)
         {
            Attribute attribute = assocs[i];

            mappings[i] = attribute.getMetaclass().getPersistenceMapping();
            addRestrictions(restrictionSet, attribute.getWhere());
         }
      }

      return m_persistenceMapping.getSortKeys(assocs, mappings, (restrictionSet.isEmpty()) ? null :
            (Attribute[])restrictionSet.toArray(new Attribute[restrictionSet.size()]));
   }
View Full Code Here

      // Process sources
      m_root.resolveInheritance(base.m_root);

      // Process mappings
      Lookup mappingMap = m_mappingMap;
      Set mappingSet = new HashHolder(m_mappingList.size()); // TransformationMapping[]

      mappingSet.addAll(m_mappingList);
      m_mappingList.clear();
      m_mappingMap = new HashTab(mappingSet.size());

      for (int i = 0, nCount = base.m_mappingList.size(); i < nCount; ++i)
      {
         TransformationMapping baseMapping = (TransformationMapping)base.m_mappingList.get(i);
         TransformationMapping mapping = null;

         if (baseMapping.getName() != null)
         {
            mapping = (TransformationMapping)mappingMap.get(baseMapping.getName());
         }

         if (mapping == null)
         {
            // Copy base transformation mapping to derived transformation
            TransformationMapping copy = (TransformationMapping)baseMapping.clone();

            // Argument sources must point to the derived transformation
            for (Iterator argItr = copy.getArgumentIterator(); argItr.hasNext(); )
            {
               TransformationArgument arg = (TransformationArgument)argItr.next();
               TransformationSource source = arg.getSource();
               TransformationSource newSource = null;

               if (source != null)
               {
                  newSource = m_root;

                  for (int k = 1; k <= source.getLevel(); ++k)
                  {
                     newSource = newSource.findChild(source.getPath(k).getPart().getName());
                  }

                  arg.setSource(newSource);

                  if (arg.isNull())
                  {
                     newSource.setNull(true);
                  }
               }
            }

            // Inherited mappings should reference the base script.
            if (baseMapping.getScript() != null)
            {
               copy.setScript(
                  new Pair(Transformation.BASE, baseMapping)
               );
            }

            addMapping(copy);
         }
         else
         {
            // Base transformation mapping overridden in derived transformation, so use
            // mapping from derived transformation.
            addMapping(mapping);
            mappingSet.remove(mapping);
         }
      }

      // Put the mappings defined only in the derived transformation on the end
      for (Iterator itr = mappingSet.iterator(); itr.hasNext(); )
      {
         addMapping((TransformationMapping)itr.next());
      }

      for (Lookup.Iterator it = base.m_posMap.iterator(); it.hasNext();)
View Full Code Here

      if (obj instanceof Instance && ((Instance)obj).getState() != Instance.DELETED &&
         instance.getValueDirect(m_eventAttribute.getOrdinal()) instanceof Symbol)
      {
         work.setValue(column, null);
         addDependency(uow, work, obj, new HashHolder());
      }
   }
View Full Code Here

   {
      SQLJoin join = (SQLJoin)query.getMapping();

      if (m_columnSet == null)
      {
         m_columnSet = new HashHolder(query.getFieldCount());
      }
      else
      {
         m_columnSet.clear();
      }
View Full Code Here

TOP

Related Classes of nexj.core.util.HashHolder

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.