Package nexj.core.util

Examples of nexj.core.util.HashTab


    * @param machine The virtual machine.
    */
   public void initDefinitions(Machine machine)
   {
      Compiler compiler = new Compiler();
      Lookup posMap = new HashTab();

      for (Iterator defItr = m_definitionMap.valueIterator(); defItr.hasNext(); )
      {
         Definition def = (Definition)defItr.next();

         for (Iterator typeItr = def.getTypesIterator(); typeItr.hasNext(); )
         {
            ModelType type = (ModelType)typeItr.next();
            Object code = type.getCode();
            PCodeFunction fun;

            posMap.clear();
            posMap.put(code, new TextPosition(0, 0, "definition:" + type.getGlobalName()));
            fun = compiler.compile(code, posMap, machine, false);
            machine.invoke(fun, (Pair)null);
         }

         for (Iterator intItr = def.getInterfacesIterator(); intItr.hasNext(); )
         {
            Interface iface = (Interface)intItr.next();
            Object code = iface.getCode();
            PCodeFunction fun;

            posMap.clear();
            posMap.put(code, new TextPosition(0, 0, "definition:" + iface.getGlobalName()));
            fun = compiler.compile(code, posMap, machine, false);
            machine.invoke(fun, (Pair)null);
         }

         for (Iterator svcItr = def.getServicesIterator(); svcItr.hasNext(); )
         {
            Service service = (Service)svcItr.next();
            Object code = service.getCode();
            PCodeFunction fun;

            posMap.clear();
            posMap.put(code, new TextPosition(0, 0, "definition:" + service.getGlobalName()));
            fun = compiler.compile(code, posMap, machine, false);
            machine.invoke(fun, (Pair)null);
         }
      }

      for (Iterator implItr = m_implementationMap.valueIterator(); implItr.hasNext(); )
      {
         Implementation impl = (Implementation)implItr.next();
         Object code = impl.getCode();
         PCodeFunction fun;

         posMap.clear();
         posMap.put(code, new TextPosition(0, 0, "implementation:" + impl.getNamePrefix()));

         try
         {
            machine.getGlobalEnvironment().defineVariable(Symbol.SYS_CURRENT_LOGGER,
               Logger.getLogger(SysUtil.NAMESPACE + ".soa." +
View Full Code Here


      }

      return getInstance(context,
         (m_nActivation == CONTEXT && context != null) ?
            context.getComponentInstanceMap() :
            new HashTab(8),
          new Object[1]);
   }
View Full Code Here

    */
   public void setProperty(String sName, Object value)
   {
      if (m_propertyMap == null)
      {
         m_propertyMap = new HashTab();
      }
     
      m_propertyMap.put(sName, value);
   }
View Full Code Here

      }
      else
      {
         if (m_fragmentMap == null)
         {
            m_fragmentMap = new HashTab(4);

            if (m_defaultFragment != null)
            {
               m_fragmentMap.put("", m_defaultFragment);
            }
View Full Code Here

    * @param service The service definition.
    * @param converter The schema converter for creating the message schemas.
    */
   protected void exportMessage(nexj.core.meta.integration.Message msg, SOAPService service, MessageSchemaConverter converter)
   {
      Lookup envelopeHeaderMap = new HashTab();

      converter.setEnvelopeHeaderMap(envelopeHeaderMap);

      Element element = converter.add(msg);
      RootXMLMessagePartMapping rootMapping = (RootXMLMessagePartMapping)msg.getRoot().getMapping();
View Full Code Here

            // Attribute defined in subclass, add to polymorphic attribute list
            assert query.getMetaclass().isUpcast(metaclass);

            if (polymorphicAttrMap == null)
            {
               polymorphicAttrMap = new HashTab(2);
            }

            Pair subclassAttrs = (Pair)polymorphicAttrMap.get(metaclass);

            subclassAttrs = new Pair(attribute.getSymbol(), subclassAttrs);
            polymorphicAttrMap.put(metaclass, subclassAttrs);
         }
      }

      // Add non-primitive output attributes
      for (Iterator itr = query.getAssocIterator(Query.ASSOC_QUERY); itr.hasNext(); )
      {
         Query subQuery = (Query)itr.next();
         Attribute attribute = subQuery.getAttribute();
         Pair subQueryAttrs = getAttributes(subQuery);
         Metaclass metaclass = attribute.getMetaclass();
         Object itemToAdd = (subQueryAttrs == null) ? (Object)attribute.getSymbol() : new Pair(attribute.getSymbol(), subQueryAttrs);

         if (metaclass.isUpcast(query.getMetaclass()))
         {
            attributes = new Pair(itemToAdd, attributes);
         }
         else
         {
            // Attribute defined in subclass, add to polymorphic attribute list
            assert query.getMetaclass().isUpcast(metaclass);

            if (polymorphicAttrMap == null)
            {
               polymorphicAttrMap = new HashTab(2);
            }

            Pair subclassAttrs = (Pair)polymorphicAttrMap.get(metaclass);

            subclassAttrs = new Pair(itemToAdd, subclassAttrs);
View Full Code Here

         int nRefCount = 1;
         Object key = toKey(typeDef);
        
         if (m_msgRefCountMap == null)
         {
            m_msgRefCountMap = new HashTab();
         }
         else
         {
            Integer store = (Integer)m_msgRefCountMap.get(key);
           
View Full Code Here

   public static Lookup/*<Object, UpgradeState>*/ getInitialState(VersionUpgrade version)
      throws MetadataException
   {
      assert version != null;

      Lookup stateMap = new HashTab();

      // need to roll back all to validate that all alter/drop steps have associated create steps
      for (VersionUpgrade u = version.getUpgrade().getLastVersion(); u != null; u = u.getPrev())
      {
         u.undo(getState(stateMap, u));
      }

      // validate state initial state to catch alter/drop steps lacking associated create steps
      for (Lookup.Iterator itr = stateMap.valueIterator(); itr.hasNext();)
      {
         ((UpgradeState)itr.next()).start();
      }

      // roll forward to the requested version
View Full Code Here

    */
   public void validate(ContextMetadata metadata, ExceptionHolder warnings)
   {
      super.validate(metadata, warnings);

      Lookup stateMap = new HashTab();
      MetadataCompoundValidationException eh = null;

      if (m_lastVersion != null && !m_metadata.getVersion().equals(m_lastVersion.getName()))
      {
         eh = new MetadataCompoundValidationException();

         MetadataValidationException e = new MetadataValidationException("err.upgrade.lastVersion",
            new Object[]{m_lastVersion.getName(), m_metadata.getVersion()});

         setProperties(e);
         eh.addException(e);
      }

      // roll back the state and validate that can undo each step and state is still valid
      for (VersionUpgrade version = m_lastVersion; version != null; version = version.getPrev())
      {
         try
         {
            version.undo(getState(stateMap, version));
         }
         catch (UncheckedException e)
         {
            eh = version.addException(eh, e);
         }
      }

      if (eh != null)
      {
         throw eh;
      }

      // validate initial state to catch alter/drop steps lacking associated create steps
      for (Lookup.Iterator itr = stateMap.valueIterator(); itr.hasNext();)
      {
         ((UpgradeState)itr.next()).start();
      }

      // validate that the overall state is still valid after every upgrade version is applied
      for (VersionUpgrade version = m_firstVersion; version != null; version = version.getNext())
      {
         try
         {
            version.apply(getState(stateMap, version));
         }
         catch (UncheckedException e)
         {
            eh = version.addException(eh, e);
         }
      }

      if (eh != null)
      {
         throw eh;
      }

      for (Lookup.Iterator itr = stateMap.valueIterator(); itr.hasNext();)
      {
         ((UpgradeState)itr.next()).end();
      }
   }
View Full Code Here

   public Table clone(final RelationalSchema schema)
   {
      Table table = (Table)super.clone();

      table.m_schema = schema;
      table.m_columnMap = new HashTab(m_columnMap.size());
      table.m_columnList = new ArrayList(m_columnList.size());
      table.m_indexList = new ArrayList(m_indexList.size());

      for (int i = 0, n = m_columnList.size(); i < n; ++i)
      {
         Column column = (Column)((Column)m_columnList.get(i)).clone();

         column.m_table = table;
         table.m_columnList.add(column);
         table.m_columnMap.put(column.getName(), column);
      }

      for (int i = 0, n = m_indexList.size(); i < n; ++i)
      {
         Index oldIndex = (Index)m_indexList.get(i);
         Index newIndex = oldIndex.clone(table);

         table.m_indexList.add(newIndex);

         if (oldIndex == m_primaryKey)
         {
            table.m_primaryKey = newIndex;
         }

         if (schema != m_schema && !isTemporary())
         {
            schema.m_indexMap.put(newIndex.getName(), newIndex);
         }
      }

      if (m_pointcutHelper != null)
      {
         table.m_pointcutHelper = (TablePointcutHelper)m_pointcutHelper.clone(
            new PointcutHelper.AspectLookup()
            {
               public Aspect get(String sName) throws MetadataException
               {
                  return schema.getTable(sName);
               }
            });

         table.m_pointcutHelper.m_table = table;
      }

      if (m_aspectHelper != null)
      {
         table.m_aspectHelper = (TableAspectHelper)m_aspectHelper.clone();
         table.m_aspectHelper.m_table = table;
      }

      table.m_mappingMap = new HashTab(m_mappingMap.size());

      // make a copy of the Metaclass Attribute->Column mappings since modified on column add/remove
      for (Lookup.Iterator itr = m_mappingMap.iterator(); itr.hasNext();)
      {
         table.m_mappingMap.put(itr.next(), ((RelationalPrimitiveMapping[])itr.getValue()).clone());
View Full Code Here

TOP

Related Classes of nexj.core.util.HashTab

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.