Package nexj.core.util

Examples of nexj.core.util.Lookup


    * @return A map (String[String]) from Java class name to its scripting type
    *         alias.
    */
   protected Lookup findTypeAliases(List classDocList)
   {
      Lookup typeAliasMap = new HashTab();

      for (Iterator iterator = classDocList.iterator(); iterator.hasNext();)
      {
         ClassDoc classDoc = (ClassDoc)iterator.next();

         if (classDoc.tags(TYPE_ALIAS_TAG).length == 1)
         {
            typeAliasMap.put(classDoc.name(), classDoc.tags(TYPE_ALIAS_TAG)[0].text());
         }
      }

      return typeAliasMap;
   }
View Full Code Here


   {
      // Sort topologically the aspects, the least dependency distance
      // first, and then by name within the aspects with the same distance

      ClassAspect[] aspectArray = new ClassAspect[metadata.getClassAspectCount()];
      Lookup predCountMap = new HashTab(metadata.getClassAspectCount());
      int nStart = 0;
      int nEnd = 0;

      for (Iterator itr = metadata.getClassAspectIterator(); itr.hasNext();)
      {
         ClassAspect aspect = (ClassAspect)itr.next();
         int nCount = aspect.getAspectCount();

         if (nCount == 0)
         {
            aspectArray[nEnd++] = aspect;
         }
         else
         {
            predCountMap.put(aspect, Primitive.createInteger(nCount));
         }
      }

      while (nStart < nEnd)
      {
         Arrays.sort(aspectArray, nStart, nEnd, Named.COMPARATOR);

         int nNewEnd;

         for (nNewEnd = nEnd; nStart < nEnd; ++nStart)
         {
            ClassAspect aspect = aspectArray[nStart];

            for (Iterator itr = metadata.getClassAspectIterator(); itr.hasNext();)
            {
               ClassAspect successor = (ClassAspect)itr.next();

               if (successor.hasAspect(aspect))
               {
                  Integer predCount = (Integer)predCountMap.get(successor);

                  if (predCount != null)
                  {
                     int nPredCount = predCount.intValue();

                     if (--nPredCount == 0)
                     {
                        predCountMap.remove(successor);
                        aspectArray[nNewEnd++] = successor;
                     }
                     else
                     {
                        predCountMap.put(successor, Primitive.createInteger(nPredCount));
                     }
                  }
               }
            }
         }

         nEnd = nNewEnd;
      }

      ExceptionHolder eh = null;

      if (predCountMap.size() != 0)
      {
         for (Iterator itr = predCountMap.iterator(); itr.hasNext();)
         {
            ClassAspect aspect = (ClassAspect)itr.next();
            MetadataValidationException e = new MetadataValidationException("err.meta.classAspectCircularDep",
               new Object[]{aspect.getName()});
View Full Code Here

      if (optionArray == null || optionArray.length == 0)
      {
         return 0;
      }

      Lookup optionLookup = new HashTab(optionArray.length);

      for (int i = 0; i < optionArray.length; i++)
      {
         Option option = optionArray[i];

         optionLookup.put(option.getName(), option);
      }

      while (nArg < sArgArray.length)
      {
         String sArg = sArgArray[nArg];

         if (sArg.charAt(0) != '-')
         {
            break;
         }

         nArg++;

         String sName = sArg.substring(1);
         Option option = (Option)optionLookup.get(sName);
         String sValue = option.getValue();

         if (option.isArgRequired())
         {
            if (nArg >= sArgArray.length)
View Full Code Here

   public TransferObject transformNested(PropertyMap tobj, String sTransformationName, Pair arguments) throws IntegrationException
   {
      Transformation transformation = m_context.getMetadata().getTransformation(sTransformationName);
      TransferObject outputSaved = m_output;
      Object[] sourceArraySaved = m_sourceArray;
      Lookup listMapSaved = m_listMap;
      ListKey listKeySaved = m_listKey;
      Object[] scriptArraySaved = m_scriptArray;

      try
      {
View Full Code Here

         while (!parents.isEmpty());

      }

      // Keep track of which root directories have been written
      Lookup installDirIdSet = new HashTab();

      // Write out each of the non-subdirectory install directories
      for (Iterator it = m_archiveGroupList.iterator(); it.hasNext();)
      {
         ArchiveGroup archiveGroup = (ArchiveGroup)it.next();
         String sInstallDirId = archiveGroup.getInstallDirId();
         String sSubdir = archiveGroup.getSubdir();

         // Check the install directory
         if (sInstallDirId == null)
         {
            throw new BuildException("Undefined 'installdirid' attribute of archivegroup");
         }

         // Only write each install directory once
         if (sSubdir == null && !installDirIdSet.contains(sInstallDirId))
         {
            // Write out the ID'd top directory
            openDirectoryElement(sInstallDirChild, sInstallDirId);
            closeDirectoryElement();

            installDirIdSet.put(sInstallDirId, null);
         }
      }

      // Write out each of the subdirectory install directories
      openDirectoryElement(sInstallDirChild, identifierFactory.getUniqueId(m_sInstallDirectory));

      for (Iterator it = m_archiveGroupList.iterator(); it.hasNext();)
      {
         ArchiveGroup archiveGroup = (ArchiveGroup)it.next();
         String sInstallDirId = archiveGroup.getInstallDirId();
         String sSubdir = archiveGroup.getSubdir();

         // Only write each install directory once
         if (sSubdir != null && !installDirIdSet.contains(sInstallDirId))
         {
            // Write out the ID'd top directory
            openDirectoryElement(sSubdir, sInstallDirId);
            closeDirectoryElement();

            installDirIdSet.put(sInstallDirId, null);
         }
      }

      closeDirectoryElement();
View Full Code Here

    * Exports the data from the system.
    */
   protected void exportData() throws Exception
   {
      final Set dataSourceSet = getDataSourceSet();
      final Lookup whereMap;

      if (!StringUtil.parseBoolean(getProperty("enums.enabled", "true")))
      {
         String[] names =
         {
            "EnumTypeDisplay", "EnumUserPickList", "EnumType", "EnumCode",
            "EnumDisplay", "EnumBase", "EnumDependency", "EnumDependencyType"
         };

         whereMap = new HashTab(names.length);

         for (int i = 0; i < names.length; ++i)
         {
            Metaclass metaclass = m_context.getMetadata().findMetaclass(names[i]);

            if (metaclass != null)
            {
               whereMap.put(metaclass, Boolean.FALSE);
            }
         }
      }
      else
      {
View Full Code Here

   protected void exportData() throws Exception
   {
      String sDataURL = getRequiredProperty("data.url");
      File file = (URLUtil.isURL(sDataURL)) ? new File(new URI(sDataURL)) : new File(sDataURL);
      List resultList = new ArrayList();
      Lookup identityMap = new IdentityHashTab();
      boolean bDeleteFile = false;
      Writer writer = null;
     
      try
      {
View Full Code Here

    */
   protected Object eval(String sExpr) throws Exception
   {
      try
      {
         Lookup posMap = new HashTab();
         Object code = parse(sExpr, posMap);
         PCodeFunction fun = m_compiler.compile(code, posMap, m_context.getMachine(), true);

         return m_context.getMachine().invoke(fun, (Pair)null);
      }
View Full Code Here

         "   firstName=\"John\"," + SysUtil.LINE_SEP + "   self=REF:TO<Contact'new, 12345, OID:1:I3:123>," + SysUtil.LINE_SEP +
         "   selfArray=#(REF:TO<Contact'new, 12345, OID:1:I3:123> REF:TO<Contact'new, 12345, OID:1:I3:123>)" + SysUtil.LINE_SEP +
         ")", m_tobj.toString());

      TransferObject tobj = new TransferObject(1);
      Lookup map = new HashTab(1);

      map.put("tobj", tobj);
      tobj.setValue("map", map);

      assertEquals("TO<, @>(" + SysUtil.LINE_SEP + "   map={\"tobj\"=REF:TO<, @>}" + SysUtil.LINE_SEP + ")",
         tobj.toString().replaceAll("@\\d+", "@"));
   }
View Full Code Here

      List actualData = new ArrayList(8);

      attributes = parse(sReferenceQueryAttributes);
      query(clazz, attributes, expectedData, orderBy);

      Lookup mapCopy = (Lookup)m_context.getComponentInstanceMap().clone();

      m_context.initialize(m_context.getPrincipal(), m_context.getMachine().getGlobalEnvironment());

      for (Iterator itr = mapCopy.iterator(); itr.hasNext(); )
      {
         Object key = itr.next();

         m_context.getComponentInstanceMap().put(key, mapCopy.get(key));
      }

      attributes = parse(sTestQueryAttributes);
      query(clazz, attributes, actualData, orderBy);
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.