Package nexj.core.util

Examples of nexj.core.util.Lookup


   protected void query(Metaclass metaclass, Pair attributes, List table, Pair orderBy) throws Exception
   {
      Query query = Query.createRead(metaclass, attributes, null, orderBy, -1, 0, false, Query.SEC_ALL, m_context);
      Cursor cursor = query.openCursor();
      Lookup map = new HashTab();

      while (cursor.step(map))
      {
         Instance instance = (Instance)map.get(query);
         List row = new ArrayList();

         for (Pair pair = attributes; pair != null; pair = pair.getNext())
         {
            Object head = pair.getHead();
View Full Code Here


            orderedPartSet.put(part.getName(), part);
         }

         int nSize = baseMessagePartComp.m_partList.size();
         Lookup oldPartMap = m_partMap;

         m_partList = new ArrayList(nSize + m_partList.size());
         m_partMap = new HashTab(nSize);

         // Add parts defined in the base message.
         for (int i = 0; i < nSize; i++)
         {
            MessagePart baseMessageChildPart = (MessagePart)baseMessagePartComp.m_partList.get(i);
            MessagePart childPart = (MessagePart)oldPartMap.get(baseMessageChildPart.getName());

            if (childPart == null)
            {
               addPart(baseMessageChildPart.copy(this));
            }
View Full Code Here

   }

   public static Message[] createMessageParts(URL xsdURL, final Metadata metadata, final MessageNameResolver msgNameResolver, final boolean createMessagesForSingleReferences) throws IOException
   {
      final List messageList = new ArrayList();
      final Lookup namespaceRegistry = new HashTab();
      final MessageRegistry msgRegistry = new MessageRegistry();
     
      forEachXSModel(xsdURL, new IXSModelHandler()
      {
         public boolean handle(XSModel xsModel, Document wsdlDoc) throws IOException
View Full Code Here

   }

   public static Message createMessagePart(URL xsdURL, final Metadata metadata, final String rootElement, final MessageNameResolver msgNameResolver) throws IOException
   {
      final Message retVal[] = new Message[1];
      final Lookup namespaceRegistry = new HashTab();
     
      forEachXSModel(xsdURL, new IXSModelHandler()
      {
         public boolean handle(XSModel xsModel, Document wsdlDoc) throws IOException
         {
View Full Code Here

      {
         return;
      }

      //Ensure fragments do not duplicate dataDirectory or temporaryDirectory
      Lookup dataDirLookup = new HashTab(getFragmentCount());
      Lookup tempDirLookup = new HashTab(getFragmentCount());
     
      for (Iterator itr = getFragmentIterator(); itr.hasNext(); )
      {
         FileDataSourceFragment fragment = (FileDataSourceFragment)itr.next();
         FileDataSourceFragment oldFragment;
        
         oldFragment = (FileDataSourceFragment)dataDirLookup.put(fragment.getDataDirectory(), fragment);
        
         if (oldFragment != null)
         {
            throw new MetadataException("err.meta.persistence.file.duplicateDataDirectory",
               new Object[]{fragment.getName(), oldFragment.getName(), getName()});
         }
        
         oldFragment = (FileDataSourceFragment)tempDirLookup.put(fragment.getTemporaryDirectory(), fragment);
        
         if (oldFragment != null)
         {
            throw new MetadataException("err.meta.persistence.file.duplicateTemporaryDirectory",
               new Object[]{fragment.getName(), oldFragment.getName(), getName()});
View Full Code Here

    * @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 The compiled function.
    */
   protected PCodeFunction compile(Pair args, Pair body, Machine machine)
   {
      Flow flow = m_activity.getFlow();
      Lookup posMap = flow.getPosMap();

      if (posMap != null && body != null && !posMap.contains(body))
      {
         posMap.put(body, new TextPosition(0, 0));
      }

      setPosURLs(body);

      return new Compiler().compile(flow.getVariables(),
View Full Code Here

    */
   protected void setPosURLs(Pair body)
   {
      super.setPosURLs(body);

      Lookup urlMap = m_activity.getFlow().getURLMap();

      if (urlMap != null)
      {
         Lookup posMap = m_macro.getTextPositionMap();

         if (posMap != null)
         {
            String sURL = m_macro.getURL();

            for (Lookup.Iterator itr = posMap.iterator(); itr.hasNext();)
            {
               urlMap.put(itr.next(), sURL);
            }
         }
      }
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

    * @return The attributes being queried, in Object'read attribute list form.
    */
   public static Pair getAttributes(Query query)
   {
      Pair attributes = null;
      Lookup polymorphicAttrMap = null;

      // Add primitive output attributes
      for (Field field = query.getFirstOutputField(); field != null; field = field.getNext())
      {
         Attribute attribute = field.getAttribute();
         Metaclass metaclass = attribute.getMetaclass();

         if (metaclass.isUpcast(query.getMetaclass()))
         {
            attributes = new Pair(attribute.getSymbol(), 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(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);
            polymorphicAttrMap.put(metaclass, subclassAttrs);
         }
      }

      // Merge the polymorphic attributes
      if (polymorphicAttrMap != null)
      {
         for (Lookup.Iterator itr = (Lookup.Iterator)polymorphicAttrMap.iterator(); itr.hasNext(); )
         {
            Metaclass subClass = (Metaclass)itr.next();
            Pair subclassAttrs = (Pair)itr.getValue();

            attributes = new Pair(
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.