Package nexj.core.meta.integration

Examples of nexj.core.meta.integration.Channel


    * export.
    */
   public void testInterfaceToWSDLWithSeveralNamespaces() throws Exception
   {
      Interface iface = m_metadata.getInterface("WSDLExportTest1");
      Channel channel = m_metadata.getChannel("WSDLExportTestChannel1");

      m_exporter.setOutputMode(XSDMessageExporter.OUTMODE_WSDL);
      m_exporter.export(iface, channel, m_resultWriter);

      assertEquals("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
View Full Code Here


   }

   public void testMessageReference() throws Exception
   {
      Interface iface = m_metadata.getInterface("WSDLExportTest2");
      Channel channel = m_metadata.getChannel("WSDLExportTestChannel1");

      m_exporter.setOutputMode(XSDMessageExporter.OUTMODE_WSDL);
      m_exporter.export(iface, channel, m_resultWriter);

      assertEquals("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
View Full Code Here

         String sOriginalContents = format(doc);
         Element server = doc.getDocumentElement();

         for (Iterator itr = m_metadata.getChannelIterator(); itr.hasNext();)
         {
            Channel channel = (Channel)itr.next();

            if (channel instanceof MessageQueue && channel.isEnabled())
            {
               MessageQueue mq = (MessageQueue)channel;

               if (mq.isDestinationManaged() && mq.isFirst())
               {
View Full Code Here

         String sOriginalContents = format(doc);
         Element server = doc.getDocumentElement();

         for (Iterator itr = m_metadata.getChannelIterator(); itr.hasNext();)
         {
            Channel channel = (Channel)itr.next();

            if (channel instanceof MessageQueue && channel.isEnabled())
            {
               MessageQueue mq = (MessageQueue)channel;

               if (mq.isDestinationManaged() && mq.isFirst())
               {
View Full Code Here

                     return XMLUtil.getReqStringAttr(element, "channel");
                  }

                  public void handleElement(Element connectionElement, String sChannel)
                  {
                     Channel channel = m_metadata.getChannel(sChannel);
                     String sExpectedElement = m_metadata.getChannelTypeElement(channel.getType()) + "Connection";

                     if (!sExpectedElement.equals(connectionElement.getNodeName()))
                     {
                        throw new MetadataException("err.meta.channelConnectionElement",
                           new Object[]{connectionElement.getNodeName(), channel.getName(),
                           sConnectionsName, sExpectedElement});
                     }

                     if (!connectionSet.add(channel))
                     {
                        throw new MetadataException("err.meta.dupChannelConnection", new Object[]{sChannel});
                     }

                     //Load Channel-specific attributes
                     ((XMLIntegrationMetadataLoader)m_helper.getClassInstance(channel.getType().getLoader()))
                        .loadConnection(connectionElement, channel, XMLMetadataLoader.this);
                  }
               });
            }
         });
      }

      //Call loadConnection to initialize Channels with no entry in the .connections file.
      for (Iterator itr = m_metadata.getChannelIterator(); itr.hasNext();)
      {
         Channel channel = (Channel)itr.next();

         if (!connectionSet.contains(channel))
         {
            int nCookie = getHelper().pushMarker(MetadataValidationException.TYPE_NAME, "ChannelConnection");
            getHelper().pushMarker("channelConnection", channel.getName());

            try
            {
               ((XMLIntegrationMetadataLoader)m_helper.getClassInstance(channel.getType().getLoader()))
                  .loadConnection(null, channel, XMLMetadataLoader.this);
            }
            catch (MetadataException e)
            {
               m_helper.addException(e);
View Full Code Here

      boolean bFirstMessageQueue = true;

      for (Iterator itr = loader.getMetadata().getChannelIterator(); itr.hasNext() && bFirstMessageQueue; )
      {
         Channel channel = (Channel)itr.next();

         if (channel instanceof MessageQueue)
         {
            bFirstMessageQueue = false;
         }
      }

      if (bFirstMessageQueue)
      {
         loader.addIOFixup(new XMLMetadataHelper.ContextFixup(loader.getHelper())
         {
            public void fixup()
            {
               Lookup aliasQueueMap = new HashTab();

               for (Iterator itr = loader.getMetadata().getChannelIterator(); itr.hasNext(); )
               {
                  Channel channel = (Channel)itr.next();

                  if (channel instanceof MessageQueue)
                  {
                     MessageQueue queue = (MessageQueue)channel;
                     MessageQueue oldQueue = (MessageQueue)aliasQueueMap.put(queue.getAlias(), queue);
View Full Code Here

      boolean bFirstMailChannel = true;

      for (Iterator itr = loader.getMetadata().getChannelIterator(); itr.hasNext() && bFirstMailChannel; )
      {
         Channel channel = (Channel)itr.next();

         if (channel instanceof Mail)
         {
            bFirstMailChannel = false;
         }
      }

      if (bFirstMailChannel)
      {
         loader.addIOFixup(new XMLMetadataHelper.ContextFixup(loader.getHelper())
         {
            public void fixup()
            {
               Lookup aliasMailMap = new HashTab();

               for (Iterator itr = loader.getMetadata().getChannelIterator(); itr.hasNext(); )
               {
                  Channel channel = (Channel)itr.next();

                  if (channel instanceof Mail)
                  {
                     Mail mailChannel = (Mail)channel;
                     Mail oldMailChannel = (Mail)aliasMailMap.put(mailChannel.getAlias(), mailChannel);
View Full Code Here

   public void complete(Instance instance, ActionContext actx)
   {
      State state = (State)instance.getValue("state");
      Service service = (Service)state.getFlow();
      String sChannel = (String)state.getValue(Service.OUTPUT);
      Channel channel = (StringUtil.isEmpty(sChannel)) ? null : m_context.getMetadata().getChannel(sChannel);
      Object value = state.getToken(null);

      if (s_logger.isDumpEnabled())
      {
         s_logger.dump("Output message:");
         s_logger.dump(value);
      }
     
      if (service.getInterface() != null)
      {
         MessageTable responseTable = service.getInterface().getResponseTable();
         Message message = null;

         if (responseTable.getMessageCount() != 0)
         {
            if (!(value instanceof TransferObject) ||
               (message = responseTable.findMessage(((TransferObject)value).getClassName())) == null)
            {
               throw new IntegrationException("err.integration.service.outputMessage", new Object[]{service.getFullName()});
            }

            if (message.getFormat() == null)
            {
               message = null;
            }
         }
         else if (responseTable.getFormat() != null)
         {
            channel = null;
         }

         if (channel != null && message != null)
         {
            if (channel.getSender() == null)
            {
               throw new RPCException("err.rpc.notSender", new Object[]{channel.getName()});
            }

            Sender sender = (Sender)channel.getSender().getInstance(m_context);
            ObjectOutput output = sender.createOutput();

            ((MessageFormatter)message.getFormat().getFormatter().getInstance(m_context)).format((TransferObject)value, message, output);
            TransferObject tobj = new TransferObject(1);
            tobj.setValue(Sender.BODY, output.getObject());
View Full Code Here

         clonedProperties.setValue(ObjectSender.USER, m_context.getPrincipal().getName());
      }

      clonedProperties.setValue(ObjectSender.PROTECTED, Boolean.FALSE);

      Channel channel = m_context.getMetadata().getChannel(sChannel);
      MessageFactory mf = getSecureMessageFactory(channel, bNoLocal, clonedProperties);

      addMessage(channel, new AccessorEnvelope(mf, accessor, event, args,
         correlator, corEvent, clonedProperties, nPriority, lTTL));
   }
View Full Code Here

         // Send the accumulated messages
         if (m_messageMap != null)
         {
            for (Lookup.Iterator itr = m_messageMap.iterator(); itr.hasNext();)
            {
               Channel channel = (Channel)itr.next();
               Sender sender = (Sender)channel.getSender().getInstance(m_context);
               List list = (List)itr.getValue();

               for (int i = 0, n = list.size(); i != n; ++i)
               {
                  Object msg = list.get(i);

                  if (msg instanceof Envelope)
                  {
                     list.set(i, ((Envelope)msg).getMessage());
                  }
               }

               if (s_logger.isDebugEnabled())
               {
                  s_logger.debug("Sending " + list.size() + " message(s) on channel \"" + channel.getName() + "\"");
               }

               sender.send(list);
            }
         }
View Full Code Here

TOP

Related Classes of nexj.core.meta.integration.Channel

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.