Package org.jboss.soa.esb.addressing

Examples of org.jboss.soa.esb.addressing.PortReference$Extension


     */
    protected EPR createFaultTo(String esbToJBpmXml, Boolean globalProcessScope, ExecutionContext executionContext)
    {
        EPR faultTo = createReplyTo(esbToJBpmXml, globalProcessScope, executionContext);
        if (!exceptionTransition.equals("condition")) {
            PortReference portReference = faultTo.getAddr();
            portReference.addExtension(Constants.TRANSITION_NAME, exceptionTransition);
        }
        return faultTo;
    }
View Full Code Here


   
    public Object execute(JbpmContext jbpmContext)
    {
        final boolean isDebugEnabled = logger.isDebugEnabled() ;
        try {
            PortReference portRef = callbackEpr.getAddr();
            long nodeId  = Long.parseLong(portRef.getExtensionValue(Constants.NODE_ID));
            long tokenId = Long.parseLong(portRef.getExtensionValue(Constants.TOKEN_ID));
            long processInstanceId = Long.parseLong(portRef.getExtensionValue(Constants.PROCESS_INSTANCE_ID));
           
            String counterName = Constants.PROCESS_NODE_VERSION_COUNTER + nodeId + '_' + tokenId;
           
            long processNodeVersion = Long.parseLong(portRef.getExtensionValue(counterName));
           
            if (isDebugEnabled) logger.debug("Expected nodeId=" + nodeId +  ", tokenId=" + tokenId + ", processNodeVersion=" + processNodeVersion);
            //get update on current state of things.
            final Token token = jbpmContext.getToken(tokenId) ;
            if (token == null) {
                throw new CallbackException("Token id " + tokenId + " from process instance " + processInstanceId + " is no longer active") ;
            }
           
            final ProcessInstance instance = token.getProcessInstance() ;
            if (instance == null) {
                throw new CallbackException("Process instance " + processInstanceId + " is no longer active") ;
            }
           
            if (instance.getId() != processInstanceId) {
                throw new CallbackException("Token id " + tokenId + " from process instance " + processInstanceId + " now attached to process instance " + instance.getId()) ;
            }
           
            if (nodeId != token.getNode().getId()) {
                throw new CallbackException("Token id " + tokenId + " from process instance " + processInstanceId + " is no longer on expected node, expected " + nodeId + " but discovered " + token.getNode().getId()) ;
            }
            if (token.hasEnded()) {
                throw new CallbackException("Token id " + tokenId + " from process instance " + processInstanceId + " has already terminated") ;
            }
           
            if (token.isLocked()) {
                throw new CallbackException("Token id " + tokenId + " from process instance " + processInstanceId + " is already locked, another thread is active") ;
            }
           
            final ContextInstance contextInstance = instance.getContextInstance() ;
            final long currentProcessNodeVersion = Long.parseLong(String.valueOf(contextInstance.getVariableLocally(counterName, token)));
            if (isDebugEnabled) logger.debug("ProcessNodeVersion=" + currentProcessNodeVersion);
            if (processNodeVersion!=currentProcessNodeVersion) {
                throw new CallbackException("The current processNodeVersion (id=" + currentProcessNodeVersion + ") is not the expected version (version=" + processNodeVersion + ").");
            }
           
            final String globalProcessScopeVal = portRef.getExtensionValue(Constants.PROCESS_SCOPE_ATTR) ;
            // Default to global scope as that matches the previous functionality
            // N.B. This is different from retrieving variables!!
            final boolean globalProcessScope = (globalProcessScopeVal == null ? true : Boolean.parseBoolean(globalProcessScopeVal));
           
            Map<Mapping, Object> variablesMap = getVariablesMapFromMessage(token.getNode(), message);
View Full Code Here

        parse(in) ;
       
        if (extensions.size() > 0)
        {
            final EPR origEPR = call.getTo() ;
            final PortReference to = origEPR.getAddr() ;
            for(NamedElement element: extensions)
            {
                final QName name = element.getName() ;
                final TextElement content = (TextElement)element.getElementContent() ;
                to.addExtension(name.getLocalPart(), name.getPrefix(), name.getNamespaceURI(), content.getText()) ;
            }
           
            call.setTo(EPRHelper.getSpecificEPR(origEPR)) ;
        }
    }
View Full Code Here

   * @deprecated
   */
 
  public final void setURL (URL url)
  {
    super.setAddr(new PortReference(url.toString()));
  }
View Full Code Here

    if ((protocol == null) || (host == null) || (port == null))
      throw new IllegalArgumentException();
   
    if ((protocol.equals(SMTP_PROTOCOL) || (protocol.equals(POP_PROTOCOL))))
    {
      PortReference addr = new PortReference(protocol+PROTOCOL_SEPARATOR+host+PORT_SEPARATOR+port);
     
      if (username != null)
        addr.addExtension(USERNAME_TAG, username);
     
      if (password != null)
        addr.addExtension(PASSWORD_TAG, password);
     
      setAddr(addr);
    }
    else
      throw new IllegalArgumentException("Invalid email protocol!");
View Full Code Here

   * @param url the address.
   */
 
  public final void setURL (String url)
  {
    super.setAddr(new PortReference(url));
  }
View Full Code Here

   * @deprecated
   */
 
  public final void setURL (URL url)
  {
    super.setAddr(new PortReference(url.toString()));
  }
View Full Code Here

        assertValidLogicalURI(URI.create(addr.getAddress()));
        super.setAddr(addr);
    }

    public Service toService() {
        PortReference portRef = getAddr();

        if(portRef == null) {
            throw new IllegalStateException("Invalid Logical EPR state.  No PortReference set on EPR.");
        }

        URI uri;
        try {
            uri = new URI(portRef.getAddress());
        } catch (URISyntaxException e) {
            throw new IllegalStateException("Invalid Logical EPR state.  '" + portRef.getAddress() + "' is not a valid URI.", e);
        }

        assertValidLogicalURI(uri);

        return new Service(uri.getSchemeSpecificPart(), uri.getFragment());
View Full Code Here

        epr = new LogicalEPR(URI.create("logical:My%20/%20Category#My%20/%20Name"));
        assertEquals("logical:My%20/%20Category#My%20/%20Name", epr.getAddr().getAddress());
        assertEquals("My / Category", epr.toService().getCategory());
        assertEquals("My / Name", epr.toService().getName());

        epr = new LogicalEPR(new PortReference("logical:My%20/%20Category#My%20/%20Name"));
        assertEquals("logical:My%20/%20Category#My%20/%20Name", epr.getAddr().getAddress());
        assertEquals("My / Category", epr.toService().getCategory());
        assertEquals("My / Name", epr.toService().getName());
       
        epr = new LogicalEPR(new EPR(URI.create("logical:My%20/%20Category#My%20/%20Name")));
        assertEquals("logical:My%20/%20Category#My%20/%20Name", epr.getAddr().getAddress());
        assertEquals("My / Category", epr.toService().getCategory());
        assertEquals("My / Name", epr.toService().getName());

        epr = new LogicalEPR(new EPR(new PortReference("logical:My%20/%20Category#My%20/%20Name")));
        assertEquals("logical:My%20/%20Category#My%20/%20Name", epr.getAddr().getAddress());
        assertEquals("My / Category", epr.toService().getCategory());
        assertEquals("My / Name", epr.toService().getName());

        epr = new LogicalEPR();
        epr.setAddr(new PortReference("logical:My%20/%20Category#My%20/%20Name"));
        assertEquals("logical:My%20/%20Category#My%20/%20Name", epr.getAddr().getAddress());
        assertEquals("My / Category", epr.toService().getCategory());
        assertEquals("My / Name", epr.toService().getName());

        epr = new LogicalEPR("1234567890 -=`!\"£$%^&*()_+\\|,./;'#[]<>?:@~{}", "1234567890 -=`!\"£$%^&*()_+\\|,./;'#[]<>?:@~{}");
 
View Full Code Here

        } catch (IllegalArgumentException e) {
            assertEquals("'xxxx:a#b' is not a valid URI for a Logical EPR - URI scheme must be 'logical'.", e.getMessage());
        }

        try {
            new LogicalEPR(new PortReference("logical://a#b"));
            fail("Expected IllegalArgumentException");
        } catch (IllegalArgumentException e) {
            assertEquals("'logical://a#b' is not a valid URI for a Logical EPR - URI must be opaque.", e.getMessage());
        }

        try {
            new LogicalEPR(new EPR(URI.create("xxxx:a#b")));
            fail("Expected IllegalArgumentException");
        } catch (IllegalArgumentException e) {
            assertEquals("'xxxx:a#b' is not a valid URI for a Logical EPR - URI scheme must be 'logical'.", e.getMessage());
        }

        try {
            new LogicalEPR(new EPR(new PortReference("logical://a#b")));
            fail("Expected IllegalArgumentException");
        } catch (IllegalArgumentException e) {
            assertEquals("'logical://a#b' is not a valid URI for a Logical EPR - URI must be opaque.", e.getMessage());
        }

        try {
            LogicalEPR epr = new LogicalEPR();
            epr.setAddr(new PortReference("logical:a"));
            fail("Expected IllegalArgumentException");
        } catch (IllegalArgumentException e) {
            assertEquals("'logical:a' is not a valid URI for a Logical EPR - no URI fragment (service name) part.", e.getMessage());
        }

        try {
            LogicalEPR epr = new LogicalEPR();
            epr.setAddr(new PortReference("logical:#b"));
            fail("Expected IllegalArgumentException");
        } catch (IllegalArgumentException e) {
            assertEquals("Expected scheme-specific part at index 8: logical:#b", e.getCause().getMessage());
        }
    }
View Full Code Here

TOP

Related Classes of org.jboss.soa.esb.addressing.PortReference$Extension

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.