Examples of ObjectDescriptor


Examples of org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor

  public HistoryServiceBinding() {
    super("history-service");
  }

  public Object parse(Element element, Parse parse, Parser parser) {
    ObjectDescriptor descriptor = new ObjectDescriptor(HistoryServiceImpl.class);
    descriptor.addInjection("commandService", new ContextTypeRefDescriptor(CommandService.class));
    return descriptor;
  }
View Full Code Here

Examples of org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor

  public TransactionBinding() {
    super("transaction");
  }

  public Object parse(Element element, Parse parse, Parser parser) {
    ObjectDescriptor transactionDescriptor = null;

    String type = "standard";
    if (element.hasAttribute("type")) {
      type = element.getAttribute("type");
    }
   
    if ("standard".equals(type)) {
      transactionDescriptor = new ObjectDescriptor(StandardTransaction.class);
    } else if ("jta".equals(type)){
      transactionDescriptor = new ObjectDescriptor(JtaTransaction.class);
    } else {
      parse.addProblem("unsupported transaction type: "+type, element);
    }
   
    return transactionDescriptor;
View Full Code Here

Examples of org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor

  public TimerSessionBinding() {
    super("timer-session");
  }

  public Object parse(Element element, Parse parse, Parser parser) {
    ObjectDescriptor objectDescriptor = new ObjectDescriptor();
   
    String target = XmlUtil.attribute(element, "target");

    if ((target!=null) && ("ejb".equalsIgnoreCase(target))) {
      objectDescriptor.setClassName("org.jbpm.enterprise.internal.ejb.EnterpriseTimerSession");

    } else {
      // wire the JobExecutorTimerSession
      objectDescriptor.setClassName(JobExecutorTimerSession.class.getName());

      // inject fields
      objectDescriptor.addInjection("transaction", new TransactionRefDescriptor());
      objectDescriptor.addInjection("jobExecutor", new EnvDescriptor(JobExecutor.class));
      objectDescriptor.addInjection("session", new ContextTypeRefDescriptor(Session.class));
    }

    return objectDescriptor;
  }
View Full Code Here

Examples of org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor

    }
    return false;
  }

  public Object parse(Element element, Parse parse, Parser parser) {
    ObjectDescriptor descriptor = new ObjectDescriptor();

    Parser wireParser = (Parser) parser;
    String className = XmlUtil.attribute(element, "class");
    String expr = XmlUtil.attribute(element, "expr");
    String factoryObjectName = XmlUtil.attribute(element, "factory");
    Element factoryElement = XmlUtil.element(element, "factory");

    if (className!=null) {
      descriptor.setClassName(className);
      if (factoryObjectName!=null) {
        parse.addProblem("attribute 'factory' is specified together with attribute 'class' in element 'object': "+XmlUtil.toString(element), element);
      }
      if (factoryElement!=null) {
        parse.addProblem("element 'factory' is specified together with attribute 'class' in element 'object': "+XmlUtil.toString(element), element);
      }

      Element constructorElement = XmlUtil.element(element, "constructor");
      if (constructorElement!=null) {
        List<Element> argElements = XmlUtil.elements(constructorElement, "arg");
        List<ArgDescriptor> argDescriptors = wireParser.parseArgs(argElements, parse);
        descriptor.setArgDescriptors(argDescriptors);

        if (element.hasAttribute("method")) {
          parse.addProblem("attributes 'class' and 'method' indicate static method and also a 'constructor' element is specified for element 'object': "+XmlUtil.toString(element), element);
        }
      }

    } else if (factoryObjectName!=null) {
      descriptor.setFactoryObjectName(factoryObjectName);
      if (factoryElement!=null) {
        parse.addProblem("element 'factory' is specified together with attribute 'factory' in element 'object': "+XmlUtil.toString(element), element);
      }

    } else if (factoryElement!=null) {
      Element factoryDescriptorElement = XmlUtil.element(factoryElement);
      Descriptor factoryDescriptor = (Descriptor) parser.parseElement(factoryDescriptorElement, parse, WireParser.CATEGORY_DESCRIPTOR);
      descriptor.setFactoryDescriptor(factoryDescriptor);

    } else if (expr!=null) {
      descriptor.setExpr(expr);
      String lang = XmlUtil.attribute(element, "lang");
      descriptor.setLang(lang);
     
    } else {
      parse.addProblem("element 'object' must have one of {attribute 'class', attribute 'expr', attribute 'factory' or element 'factory'}: "+XmlUtil.toString(element), element);
    }

    // method
    if (element.hasAttribute("method")) {
      descriptor.setMethodName(element.getAttribute("method"));

      List<Element> argElements = XmlUtil.elements(element, "arg");
      List<ArgDescriptor> argDescriptors = wireParser.parseArgs(argElements, parse);
      descriptor.setArgDescriptors(argDescriptors);
    } else if ( (factoryObjectName!=null)
                || (factoryElement!=null)
              ) {
      parse.addProblem("element 'object' with a element 'factory' or a attribute 'factory' must have a attribute 'method': "+XmlUtil.toString(element), element);
    }

    if( (className == null)
        && (XmlUtil.element(element, "constructor") != null)
      ) {
      parse.addProblem("element 'object' with a 'constructor' element must have 'class' attribute: "+XmlUtil.toString(element), element);
    }

    // read the operations elements
    List<Operation> operations = null;
    List<Element> elements = XmlUtil.elements(element);
   
    Set<String> operationTagNames = null;
    Bindings bindings = parser.getBindings();
    if (bindings!=null) {
      operationTagNames = bindings.getTagNames(WireParser.CATEGORY_OPERATION);
    } else {
      operationTagNames = Collections.EMPTY_SET;
    }

    for (Element childElement: elements) {
      if (operationTagNames.contains(childElement.getTagName())) {
        Operation operation = (Operation) parser.parseElement(childElement, parse, WireParser.CATEGORY_OPERATION);
        if (operations==null) {
          operations = new ArrayList<Operation>();
        }
        operations.add(operation);
      }
    }
    descriptor.setOperations(operations);

    // autowiring
    Boolean isAutoWireEnabled = XmlUtil.attributeBoolean(element, "auto-wire", false, parse);
    if (isAutoWireEnabled!=null) {
      descriptor.setAutoWireEnabled(isAutoWireEnabled.booleanValue());
    }
    return descriptor;
  }
View Full Code Here

Examples of org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor

  public Object parse(Element element, Parse parse, Parser parser) {
    // mail servers
    List<Descriptor> serverDescriptors = new ArrayList<Descriptor>();
    for (Element serverElement : XmlUtil.elements(element, "mail-server")) {
      // mail server
      ObjectDescriptor serverDescriptor = new ObjectDescriptor(MailServer.class);
      serverDescriptors.add(serverDescriptor);

      // address filter
      Element filterElement = XmlUtil.element(serverElement, "address-filter");
      if (filterElement != null) {
        // includes
        List<Descriptor> includeDescriptors = new ArrayList<Descriptor>();
        for (Element includeElement : XmlUtil.elements(filterElement, "include")) {
          includeDescriptors.add(parsePattern(includeElement, parse, parser));
        }
        ListDescriptor includesDescriptor = new ListDescriptor();
        includesDescriptor.setValueDescriptors(includeDescriptors);

        // excludes
        List<Descriptor> excludeDescriptors = new ArrayList<Descriptor>();
        for (Element excludeElement : XmlUtil.elements(filterElement, "exclude")) {
          excludeDescriptors.add(parsePattern(excludeElement, parse, parser));
        }
        ListDescriptor excludesDescriptor = new ListDescriptor();
        excludesDescriptor.setValueDescriptors(excludeDescriptors);

        // address filter
        ObjectDescriptor filterDescriptor = new ObjectDescriptor(AddressFilter.class);
        filterDescriptor.addInjection("includePatterns", includesDescriptor);
        filterDescriptor.addInjection("excludePatterns", excludesDescriptor);

        serverDescriptor.addInjection("addressFilter", filterDescriptor);
      }

      // mail session properties
      Element propertiesElement = XmlUtil.element(serverElement, "session-properties");
      if (propertiesElement != null) {
        Descriptor propertiesDescriptor =
            (Descriptor) propertiesBinding.parse(propertiesElement, parse, parser);
        serverDescriptor.addInjection("sessionProperties", propertiesDescriptor);
      }
      else {
        parse.addProblem("missing mail session properties", element);
      }

      // authenticator
      Element authenticatorElement = XmlUtil.element(serverElement, "authenticator");
      if (authenticatorElement != null) {
        Descriptor authenticatorDescriptor =
            (Descriptor) objectBinding.parse(authenticatorElement, parse, parser);
        serverDescriptor.addInjection("authenticator", authenticatorDescriptor);
      }
    }

    // mail servers
    ListDescriptor serversDescriptor = new ListDescriptor();
    serversDescriptor.setValueDescriptors(serverDescriptors);

    // mail session
    ObjectDescriptor sessionDescriptor = new ObjectDescriptor(MailSessionImpl.class);
    sessionDescriptor.addInjection("mailServers", serversDescriptor);
    return sessionDescriptor;
  }
View Full Code Here

Examples of org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor

  public RepositoryCacheBinding() {
    super("repository-cache");
  }

  public Object parse(Element element, Parse parse, Parser parser) {
    ObjectDescriptor objectDescriptor = new ObjectDescriptor(RepositoryCacheImpl.class);
    objectDescriptor.setAutoWireEnabled(true);
    return objectDescriptor;
  }
View Full Code Here

Examples of org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor

      invokeOperation.setArgDescriptors(argDescriptors);
      javaActivity.setInvokeOperation(invokeOperation);
    }

    if (element.hasAttribute("class")) {
      ObjectDescriptor objectDescriptor = JpdlParser.parseObjectDescriptor(element, parse);
      Object target = WireContext.create(objectDescriptor);
      javaActivity.setTarget(target);

    } else if (element.hasAttribute("expr")) {
      String expression = element.getAttribute("expr");
View Full Code Here

Examples of org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor

    super("custom");
  }

  public Object parse(Element element, Parse parse, Parser parser) {
    CustomActivity customActivity = new CustomActivity();
    ObjectDescriptor descriptor = (ObjectDescriptor)
        objectBinding.parse(element, parse, wireParser);
    ActivityBehaviour customActivityBehaviour = (ActivityBehaviour) WireContext.create(descriptor);
    customActivity.setCustomBehaviour(customActivityBehaviour);
    return customActivity;
  }
View Full Code Here

Examples of org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor

    }

    Element handlerElement = XmlUtil.element(element, "handler");
    if (handlerElement!=null) {
      DecisionHandlerActivity decisionHandlerActivity = new DecisionHandlerActivity();
      ObjectDescriptor decisionHandlerDescriptor = (ObjectDescriptor)
          objectBinding.parse(handlerElement, parse, wireParser);
      DecisionHandler decisionHandler = (DecisionHandler) WireContext.create(decisionHandlerDescriptor);
      decisionHandlerActivity.setDecisionHandler(decisionHandler);
      return decisionHandlerActivity;
    }
   
    boolean hasConditions = false;
    List<Element> transitionElements = XmlUtil.elements(element, "transition");
    ActivityImpl activity = parse.findObject(ActivityImpl.class);
    List<TransitionImpl> transitions = (List) activity.getOutgoingTransitions();
   
    for (int i=0; i<transitionElements.size(); i++) {
      TransitionImpl transition = transitions.get(i);
      Element transitionElement = transitionElements.get(i);

      Element conditionElement = XmlUtil.element(transitionElement, "condition");
      if (conditionElement!=null) {
        hasConditions = true;
       
        if (conditionElement.hasAttribute("expr")) {
          String expr = conditionElement.getAttribute("expr");
          String lang = XmlUtil.attribute(conditionElement, "expr-lang");
          ExpressionEvaluatorDescriptor expressionDescriptor = new ExpressionEvaluatorDescriptor(expr, lang);
          transition.setConditionDescriptor(expressionDescriptor);
         
        } else if (conditionElement.hasAttribute("ref")) {
          String expr = conditionElement.getAttribute("ref");
          ReferenceDescriptor refDescriptor = new ReferenceDescriptor(expr);
          transition.setConditionDescriptor(refDescriptor);
         
        } else if (ObjectBinding.isObjectDescriptor(conditionElement)) {
          ObjectDescriptor conditionDescriptor = (ObjectDescriptor) objectBinding.parse(conditionElement, parse, parser);
          transition.setConditionDescriptor(conditionDescriptor);
        }
      }
    }
   
View Full Code Here

Examples of org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor

      assignableDefinition.setDescription(description);
    }
 
    Element assignmentHandlerElement = XmlUtil.element(element, "assignment-handler");
    if (assignmentHandlerElement!=null) {
      ObjectDescriptor objectDescriptor = parseObjectDescriptor(assignmentHandlerElement, parse);
      AssignmentHandler assignmentHandler = (AssignmentHandler) WireContext.create(objectDescriptor);
      assignableDefinition.setAssignmentHandler(assignmentHandler);
    }
 
    String assigneeExpression = XmlUtil.attribute(element, "assignee");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.