Package gri.data.serializers.jdom

Examples of gri.data.serializers.jdom.JDOMSerializer


    // ------------------------------------------------- Constructors
   
    public AclEntrySerializer() {
        principalSerializer = new NamedPrincipalAndGroupSerializer();
       
        JDOMSerializer permSerializer = new PermissionSerializer();
        permissionListSerializer = new ListSerializer(permSerializer, "perm");
    }
View Full Code Here


  public ParamFactoryWrapper(NamedJDOMSerializerFactory factory) {
      this.factory = factory;
  }
 
  public JDOMSerializer getSerializer(String name) {
      JDOMSerializer serializer = factory.getSerializer(name);
      if (serializer != null)
    serializer = new ReferenceAwareSerializerWrapper(serializer);
      return serializer;
  }
View Full Code Here

  public ParamFactoryWrapper(NamedJDOMSerializerFactory factory) {
      this.factory = factory;
  }
 
  public JDOMSerializer getSerializer(String name) {
      JDOMSerializer serializer = factory.getSerializer(name);
      if (serializer != null)
    serializer = new ReferenceAwareSerializerWrapper(serializer);
      return serializer;
  }
View Full Code Here

            config.put("JOB_ID", req.getJobId());
            config.put("TASK_ID", taskId);
            config.put("WORKING_DIRECTORY", info.getWorkingDirectory());
           
           
            JDOMSerializer paramSerializer = serializers
              .getTaskSerializerSet(jobManager, taskId)
              .getOutputParameterSerializer(config);
           
            //get outputs:
            Map outputs = jobManager.getJobOutputs(req.getJobId());
            Element elem = new Element("outputs");
            paramSerializer.write(outputs, elem);
            return serviceUtil.writeXML(elem);
        }
        catch (UnknownJobException e) {
            logger.warn("Unknown job in JobManagerService.getJobOutputs(): " + req.getJobId());
            return serviceUtil.writeFault(e);
View Full Code Here

            config.put("WORKFLOW_ID", wkflId);
           
            WorkflowInfo info = getWorkflowInfo(wkflId);
            String taskId = info.getJobInfo(jobIndex).getTaskId();
                       
            JDOMSerializer serializer = serializers
                .getWorkflowSerializerSet(this)
                .getOutputParameterSerializer(jobIndex, taskId, config);
          
            return (Map)serializer.read(rootElem);
        }
        catch(UnknownWorkflowException e) {
            throw new UnknownWorkflowException(wkflId);
        }
        catch(Exception e) {
View Full Code Here

    Util.createElement("task", taskId));
 
  //inputs and outputs:
        Map inputs = stub.getInputs();
        if (!inputs.isEmpty()) {
            JDOMSerializer inputSerializer = taskSerializerFactory
              .getTaskSerializerSet(taskId)
              .getInputParameterSerializer(config);
           
            Element inputElem = new Element("inputs");
            inputSerializer.write(inputs, inputElem);
            elem.addContent(inputElem);
        }

        Map outputs = stub.getOutputs();
        if (!outputs.isEmpty()) {
            JDOMSerializer outputSerializer = taskSerializerFactory
              .getTaskSerializerSet(taskId)
              .getOutputParameterSerializer(config);
           
            Element outputElem = new Element("outputs");
            outputSerializer.write(outputs, outputElem);
            elem.addContent(outputElem);
        }
       
    }
View Full Code Here

  TaskStub stub = new TaskStub(stubId, taskId);
 
  //parse inputs and outputs:
  Element inputElem = elem.getChild("inputs");
  if (inputElem != null) {
      JDOMSerializer inputSerializer = taskSerializerFactory
        .getTaskSerializerSet(taskId)
        .getInputParameterSerializer(config);
           
      Map inputs = (Map)inputSerializer.read(inputElem);
      stub.setInputs(inputs);
  }
 
  Element outputElem = elem.getChild("outputs");
  if (outputElem != null) {
      JDOMSerializer outputSerializer = taskSerializerFactory
        .getTaskSerializerSet(taskId)
        .getOutputParameterSerializer(config);
           
      Map outputs = (Map)outputSerializer.read(outputElem);
      stub.setOutputs(outputs);
  }
 
  return stub;
    }
View Full Code Here

            config.put("JOB_MANAGER", this);
            config.put("JOB_MANAGER_SERVICE", this.service);
            config.put("JOB_ID", jobId);
            config.put("TASK_ID", taskId);
           
            JDOMSerializer serializer = serializers.getTaskSerializerSet(
              this, taskId
              ).getOutputParameterSerializer(config);
          
            return (Map)serializer.read(rootElem);
        }
        catch(UnknownJobException e) {
            throw new UnknownJobException(jobId);
        }
        catch(Exception e) {
View Full Code Here

       
        //default value and options:
        if (param.hasDefaultValue() || param.hasOptions()) {
           
            //get serializer:
            JDOMSerializer serializer = getSerializer(param);
           
            //default value:
            if (param.hasDefaultValue()) {
                Object defaultValue = param.getDefaultValue();

                Element defaultElem = new Element("default");
                serializer.write(defaultValue, defaultElem);
                elem.addContent(defaultElem);
            }
           
            //options:
            if (param.hasOptions()) {
                Element optionsElem = new Element("options");
               
                Option [] options = param.getOptions();
                for (int i=0; i<options.length; i++) {
                    String displayText = options[i].getDisplayText();
                    Object value = options[i].getValue();
                   
                    Element optionElem = new Element("option");
                    optionElem.setAttribute("displayText", displayText);
                    serializer.write(value, optionElem);
                   
                    optionsElem.addContent(optionElem);
                }
               
                elem.addContent(optionsElem);
View Full Code Here

            throw new IOException("Error: Parameter missing data type");
      
        dataType = dataTypeSerializer.readDataType(typeElem);
        ParameterDef paramDef = new ParameterDef(paramName, dataType);
       
        JDOMSerializer serializer = null;
       
        //parse other info:
        List children = elem.getChildren();
        Element child;
        for (int i=0; i<children.size(); i++) {
            child = (Element)children.get(i);
            String name = child.getName().toLowerCase();
           
            if (name.equals("displayname"))
                paramDef.setDisplayName(child.getText());
            else if (name.equals("description"))
                paramDef.setDescription(child.getText());
           
            else if (name.equals("default")) {
                if (serializer == null)
                    serializer = getSerializer(paramDef);
               
                Object defaultValue = serializer.read(child);
                paramDef.setDefaultValue(defaultValue);
            }
            else if (name.equals("options")) {
                if (serializer == null)
                    serializer = getSerializer(paramDef);
View Full Code Here

TOP

Related Classes of gri.data.serializers.jdom.JDOMSerializer

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.