/*
(non-Javadoc)

@see com.emc.ecs.nfsclient.nfs.NfsRequestBase#marshalling(com.emc.ecs.
nfsclient.rpc.Xdr)
514488
public void marshalling(Xdr xdr) {
        super.marshalling(xdr);
        xdr.putLong(_offset);
        xdr.putUnsignedInt(_size);
    }
956067
@Override
  protected void marshallElementContent(XMLObject xmlObject, Element domElement) throws MarshallingException {

    // Find out if the our namespace already has been defined, and if so, get the prefix.
    //
    final String namespace = CurrentAddressType.TYPE_NAME.getNamespaceURI();
    String prefix = CurrentAddressType.TYPE_NAME.getPrefix();
    for (Namespace ns : xmlObject.getNamespaceManager().getNamespaces()) {
      if (namespace.equals(ns.getNamespaceURI())) {
        prefix = ns.getNamespacePrefix();
        break;
      }
    }    
    StringBuilder sb = new StringBuilder();

    final List<XMLObject> childXMLObjects = xmlObject.getOrderedChildren();
    if (childXMLObjects != null && childXMLObjects.size() > 0) {
      for (final XMLObject childXMLObject : childXMLObjects) {
        if (childXMLObject == null) {
          continue;
        }
        if (!(childXMLObject instanceof XSString)) {
          throw new MarshallingException("Unexpected type of child element - " + childXMLObject.getClass().getName());
        }
        XSString childString = (XSString) childXMLObject;
        if (childString.getValue() == null) {
          continue;
        }
        String localPart = childString.getElementQName().getLocalPart();
        sb.append(String.format("<%s:%s>%s</%s:%s>", prefix, localPart, childString.getValue(), prefix, localPart));
      }
    }
    if (sb.length() > 0) {
      byte[] bytes;
      try {
        bytes = sb.toString().getBytes("UTF-8");
      }
      catch (UnsupportedEncodingException e) {
        throw new MarshallingException(e);
      }
      String base64String = Base64.encodeBytes(bytes, Base64.NO_OPTIONS); 
      XMLHelper.appendTextContent(domElement, base64String);
    }
  }
610691
private void xdr_string(String s) {
    byte[] bytes = s.getBytes();
    int len = bytes.length;
    xdr_int(len);
    System.arraycopy(bytes, 0, buffer, offset, len);
    offset += len;
    pad();
  }
460248
public void marshalling(Xdr xdr) {
        marshalling(xdr, _mode);
        marshalling(xdr, _uid);
        marshalling(xdr, _gid);
        if (_size != null) {
            xdr.putBoolean(true);
            xdr.putLong(_size.longValue());
        } else {
            xdr.putBoolean(false);
        }
        marshalling(xdr, _atime);
        marshalling(xdr, _mtime);
    }
1242901
public static <T> String marshal(Marshaller self, T jaxbElement) throws JAXBException {
        StringWriter sw = new StringWriter();
        self.marshal(jaxbElement, sw);
        return sw.toString();
    }
529804
public void marshal(Object obj, HierarchicalStreamWriter writer,
			MarshallingContext context) {
		XEvent event = (XEvent) obj;
		writer.addAttribute("xid", event.getID().toString());
		if (event.getAttributes().size() > 0) {
			writer.startNode("XAttributeMap");
			context.convertAnother(event.getAttributes(), XesXStreamPersistency.attributeMapConverter);
			writer.endNode();
		}

	}
653300
public function marshall()
    {
        $toMarshall = $this->getToMarshall();

        try {
            if ($toMarshall instanceof QtiCoords) {
                $this->marshallCoords();

                return;
            } elseif ($toMarshall instanceof QtiPair) {
                $this->marshallPair();

                return;
            } elseif ($toMarshall instanceof QtiDuration) {
                $this->marshallDuration();

                return;
            } elseif ($toMarshall instanceof QtiPoint) {
                $this->marshallPoint();

                return;
            } else if ($toMarshall instanceof QtiIdentifier) {
                $this->marshallIdentifier();
                
                return;
            }
        } catch (PhpMarshallingException $e) {
            $msg = "An error occured while marshalling a QtiDatatype object.";
            throw new PhpMarshallingException($msg, PhpMarshallingException::RUNTIME, $e);
        }

        $className = get_class($toMarshall);
        $msg = "Cannot deal with QtiDatatype '${className}'.";
        throw new PhpMarshallingException($msg, PhpMarshallingException::RUNTIME);
    }
1266556
public void marshall(MarshallLocation marshallLocation, Object val) {
        marshallerRegistry().getMarshaller(marshallLocation, val).marshall(val, this, null);
    }
810888
public Vector<Object> marshallize()
    {
        Vector<Object> parameters = new Vector<Object>();
        parameters.add(RUNNER_NAME_IDX, name);
        parameters.add(RUNNER_CMDLINE_IDX, defaultString(cmdLineTemplate));
        parameters.add(RUNNER_ENVTYPE_IDX, envType != null ? envType.marshallize() : EnvironmentType.newInstance("").marshallize());
        parameters.add(RUNNER_SERVER_NAME_IDX, defaultString(serverName));
        parameters.add(RUNNER_SERVER_PORT_IDX, defaultString(serverPort));
        parameters.add(RUNNER_MAINCLASS_IDX, defaultString(mainClass));
        parameters.add(RUNNER_CLASSPATH_IDX, new Vector<String>(classpaths));
        parameters.add(RUNNER_SECURED_IDX, isSecured());
        return parameters;
    }
1251394
@Override
    public void enlistAsyncResource(String xaResFactoryFilter, Serializable xaResInfo, Xid xid) throws SystemException // @LIDB1922-5C
    {
        if (tc.isEntryEnabled())
            Tr.entry(tc, "enlistAsyncResource (SPI): args: ", new Object[] { xaResFactoryFilter, xaResInfo, xid });
        try {
            final WSATAsyncResource res = new WSATAsyncResource(xaResFactoryFilter, xaResInfo, xid);
            final WSATParticipantWrapper wrapper = new WSATParticipantWrapper(res);
            getResources().addAsyncResource(wrapper);
        } finally {
            if (tc.isEntryEnabled())
                Tr.exit(tc, "enlistAsyncResource (SPI)");
        }
    }
18956
public void unmarshalling(Xdr xdr) throws RpcException {
        super.unmarshalling(xdr);
        unmarshallingAttributes(xdr);
        if (stateIsOk()) {
            _attributes = new NfsPosixAttributes();
            _attributes.unmarshalling(xdr);
        }
    }
921264
private static NfsGetAttributes makeAttributes(Xdr xdr) {
        NfsGetAttributes attributes = null;
        if (xdr != null) {
            attributes = NfsResponseBase.makeNfsGetAttributes(xdr);
        }
        return attributes;
    }
711530
public void marshal(Object obj, HierarchicalStreamWriter writer,
			MarshallingContext context) {
		XAttribute attribute = (XAttribute) obj;
		writer.addAttribute("key", attribute.getKey());
		writer.addAttribute("type", XAttributeUtils.getTypeString(attribute));
		String value = attribute.toString();
		if (value == null) {
			throw new AssertionError("Attribute value must not be null");
		}
		writer.addAttribute("value", value);
		if (attribute.getExtension() != null) {
			writer.addAttribute("extension", attribute.getExtension().getUri()
					.toString());
		}
		// marshal meta-attributes
		if (attribute.getAttributes().size() > 0) {
			writer.startNode("XAttributeMap");
			XAttribute oldParent = (XAttribute) context.get(PARENT);
			context.put(PARENT, attribute); 
			context.convertAnother(attribute.getAttributes(),
					XesXStreamPersistency.attributeMapConverter);
			context.put(PARENT, oldParent);
			writer.endNode();
		}
	}
397444
public Vector<Object> marshallize()
    {
        Vector<Object> parameters = new Vector<Object>();
        parameters.add(REPOSITORY_NAME_IDX, StringUtils.defaultString(name));
        parameters.add(REPOSITORY_UID_IDX, StringUtils.defaultString(uid));
        parameters.add(REPOSITORY_PROJECT_IDX, project != null ? project.marshallize() : Project.newInstance("").marshallize());
        parameters.add(REPOSITORY_TYPE_IDX, type != null ? type.marshallize() : RepositoryType.newInstance("").marshallize());
        parameters.add(REPOSITORY_CONTENTTYPE_IDX, contentType.toString());
        parameters.add(REPOSITORY_BASE_URL_IDX, StringUtils.defaultString(getBaseUrl()));
        parameters.add(REPOSITORY_BASEREPO_URL_IDX, StringUtils.defaultString(getBaseRepositoryUrl()));
        parameters.add(REPOSITORY_BASETEST_URL_IDX, StringUtils.defaultString(getBaseTestUrl()));
        parameters.add(REPOSITORY_USERNAME_IDX, StringUtils.defaultString(username));
        parameters.add(REPOSITORY_PASSWORD_IDX, StringUtils.defaultString(password));
        parameters.add(REPOSITORY_MAX_USERS_IDX, maxUsers);
        return parameters;
    }
17003
public static void marshallByteArray(byte[] array, ObjectOutput out) throws IOException {
      final int size = array == null ? NULL_VALUE : array.length;
      marshallSize(out, size);
      if (size <= 0) {
         return;
      }
      out.write(array);
   }
218082
public Marshaller createMarshaller(Class<?> clazz) throws JAXBException {
    Marshaller marshaller = getContext(clazz).createMarshaller();
    setMarshallerProperties(marshaller);
    return marshaller;
  }
150097
public Marshaller getMarshaller(boolean reuse)
    throws JAXBException {
    if (!reuse || this.marshaller == null) {
      Marshaller marshaller = context.createMarshaller();
      marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
      marshaller.setProperty(Marshaller.JAXB_ENCODING,         "UTF-8");
      this.marshaller = marshaller;
    }
    return this.marshaller;
  }