Private method - creates a copy of the metadata that can be written to
@param tiffMetadata - in metadata
@return new metadata node that can be written to
773597
private IIOMetadataNode createNewExifNode( IIOMetadata tiffMetadata, IIOMetadata thumbMeta, BufferedImage thumbnail ) {

        IIOMetadataNode app1Node = null;
        ImageWriter tiffWriter = null;
        try {
            Iterator<ImageWriter> writers = ImageIO.getImageWritersByFormatName("tiff");
            while( writers.hasNext() ) {
                tiffWriter = writers.next();
                if (tiffWriter.getClass().getName().startsWith("com.sun.media")) {
                    // Break on finding the core provider.
                    break;
                }
            }
            if (tiffWriter == null) {
                System.out.println("Cannot find core TIFF writer!");
                System.exit(0);
            }

            ImageWriteParam writeParam = tiffWriter.getDefaultWriteParam();
            writeParam.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);
            writeParam.setCompressionType("EXIF JPEG");

            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            MemoryCacheImageOutputStream app1EXIFOutput = new MemoryCacheImageOutputStream(baos);
            tiffWriter.setOutput(app1EXIFOutput);

            // escribir
            tiffWriter.prepareWriteEmpty(jpegReader.getStreamMetadata(), new ImageTypeSpecifier(image), image.getWidth(),
                    image.getHeight(), tiffMetadata, null, writeParam);

            tiffWriter.endWriteEmpty();

            // Flush data into byte stream.
            app1EXIFOutput.flush();

            // Create APP1 parameter array.
            byte[] app1Parameters = new byte[6 + baos.size()];

            // Add EXIF APP1 ID bytes.
            app1Parameters[0] = (byte) 'E';
            app1Parameters[1] = (byte) 'x';
            app1Parameters[2] = (byte) 'i';
            app1Parameters[3] = (byte) 'f';
            app1Parameters[4] = app1Parameters[5] = (byte) 0;

            // Append TIFF stream to APP1 parameters.
            System.arraycopy(baos.toByteArray(), 0, app1Parameters, 6, baos.size());

            // Create the APP1 EXIF node to be added to native JPEG image metadata.
            app1Node = new IIOMetadataNode("unknown");
            app1Node.setAttribute("MarkerTag", (new Integer(0xE1)).toString());
            app1Node.setUserObject(app1Parameters);
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            if (tiffWriter != null)
                tiffWriter.dispose();
        }

        return app1Node;

    }
72169
public void write(final Metadata metadata, final String pathToMetadata,
        final List<? extends MetadataJavaDoc> javadocTags) {
        try {
            final DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
            final DocumentBuilder docBuilder = docFactory.newDocumentBuilder();

            // root elements
            final Document doc = docBuilder.newDocument();
            final Element rootElement = doc.createElement("metadata");
            doc.appendChild(rootElement);

            final Element javadocsElement = doc.createElement("javadocs");
            rootElement.appendChild(javadocsElement);

            final Set<String> commonPathSet = new HashSet<String>();
            final List<File> fileList = new ArrayList<File>();
            for (final MetadataDescriptor descr : metadata.getMetadataDescriptorList()) {
                if (descr.getCommon() != null) {
                    final String pathTo = descr.getCommon().getPathToCommonApi();
                    final String commonApi = descr.getCommon().getCommonApi().replace('.', '/');
                    commonPathSet.add(pathTo + "/" + commonApi);
                }
            }

            for (final String pathCommonApi : commonPathSet) {
                listFiles(fileList, pathCommonApi);
            }

            final JavaProjectBuilder builder = new JavaProjectBuilder();
            final Element generatedElement = doc.createElement("generatedClasses");
            rootElement.appendChild(generatedElement);
            for (final File file : fileList) {
                final Element generatedClassElement = doc.createElement("generatedClass");
                generatedClassElement.setAttribute("name", file.getName());
                generatedElement.appendChild(generatedClassElement);
                final JavaSource src = builder.addSource(file);
                final JavaClass class1  = src.getClasses().get(0);
                generatedClassElement.setAttribute("commonPackage", class1.getPackageName());
                final List<JavaAnnotation> annotationList = class1.getAnnotations();
                for (JavaAnnotation annotation : annotationList) {
                    final  AnnotationValue value = annotation.getProperty("common");
                    final List<String> commonExtendsList = (List<String>)value.getParameterValue();
                    for (String commonClass : commonExtendsList) {
                        final Element extendsElement = doc.createElement("commonExtends");
                        extendsElement.setAttribute("extends", commonClass.replace('"', ' ').trim());
                        generatedClassElement.appendChild(extendsElement);
                    }
                }
            }

            final Element commonPackagesElement = doc.createElement("commonPackages");
            rootElement.appendChild(commonPackagesElement);
            for (final MetadataDescriptor descr : metadata.getMetadataDescriptorList()) {
                if (descr.isGenerateCommonClasses() != null && !descr.isGenerateCommonClasses()) {
                    final Element generateElement = doc.createElement("package");
                    generateElement.setAttribute("packageApi", descr.getPackageApi());
                    generateElement.setAttribute("generate", Boolean.toString(descr.isGenerateCommonClasses()));
                    commonPackagesElement.appendChild(generateElement);
                }
            }

            final List<String> commonNewFiles = findCommonClasses(metadata);
            final Element commonNewFilesElement = doc.createElement("commonClasses");
            rootElement.appendChild(commonNewFilesElement);
            for (final String type : commonNewFiles) {
                final Element commonType = doc.createElement("typeName");
                commonType.setAttribute("name", type);
                commonNewFilesElement.appendChild(commonType);
            }

            if (javadocTags != null) {
                for (final MetadataJavaDoc javaDoc : javadocTags) {
                    final Attr javadocName = doc.createAttribute("tag");
                    javadocName.setValue(javaDoc.getTag());

                    final Attr javadocValue = doc.createAttribute("value");
                    javadocValue.setValue(javaDoc.getValue());

                    final Element tagElement = doc.createElement("tag");
                    tagElement.setAttributeNode(javadocName);
                    tagElement.setAttributeNode(javadocValue);

                    javadocsElement.appendChild(tagElement);
                }
            }

            // add packages
            final Element packages = doc.createElement("packages");
            rootElement.appendChild(packages);

            for (MetadataDescriptor descriptor : metadata.getMetadataDescriptorList()) {
                final Element packageApi = doc.createElement("api");
                final Attr packageApiName = doc.createAttribute("name");
                packageApiName.setValue(descriptor.getPackageApi());
                packageApi.setAttributeNode(packageApiName);

                final Attr schemaNameApi = doc.createAttribute("schema");
                schemaNameApi.setValue(descriptor.getSchemaName());
                packageApi.setAttributeNode(schemaNameApi);

                final Attr generateClassApi = doc.createAttribute("generateClass");
                generateClassApi.setValue(Boolean.toString(descriptor.isGenerateClasses()));
                packageApi.setAttributeNode(generateClassApi);

                if (descriptor.getPathToPackageInfoApi() != null) {
                    final Attr pathToPackageInfoApi = doc.createAttribute("packageInfo");
                    pathToPackageInfoApi.setValue(descriptor.getPathToPackageInfoApi());
                    packageApi.setAttributeNode(pathToPackageInfoApi);
                }

                if (descriptor.getCommonImports() != null) {
                    final Element commonImport = doc.createElement("commonImport");
                    for (String importDescl : descriptor.getCommonImports()) {
                        final Element importElement = doc.createElement("import");
                        importElement.setAttribute("package", importDescl);
                        commonImport.appendChild(importElement);
                    }
                    packageApi.appendChild(commonImport);
                }

                packages.appendChild(packageApi);
            }

            for (MetadataDescriptor descriptor : metadata.getMetadataDescriptorList()) {
                final Element packageImpl = doc.createElement("impl");
                final Attr packageImplName = doc.createAttribute("name");
                packageImplName.setValue(descriptor.getPackageImpl());
                packageImpl.setAttributeNode(packageImplName);

                final Attr schemaNameImpl = doc.createAttribute("schema");
                schemaNameImpl.setValue(descriptor.getSchemaName());
                packageImpl.setAttributeNode(schemaNameImpl);

                final Attr generateClassImpl = doc.createAttribute("generateClass");
                generateClassImpl.setValue(Boolean.toString(descriptor.isGenerateClasses()));
                packageImpl.setAttributeNode(generateClassImpl);

                if (descriptor.getPathToPackageInfoImpl() != null) {
                    final Attr pathToPackageInfoImpl = doc.createAttribute("packageInfo");
                    pathToPackageInfoImpl.setValue(descriptor.getPathToPackageInfoImpl());
                    packageImpl.setAttributeNode(pathToPackageInfoImpl);
                }

                packages.appendChild(packageImpl);
            }

            // add datatypes
            final Element datatypes = doc.createElement("datatypes");
            rootElement.appendChild(datatypes);
            for (MetadataItem metadataType : metadata.getDataTypeList()) {
                final Element datatype = doc.createElement("datatype");
                final Attr attrName = doc.createAttribute("name");
                attrName.setValue(metadataType.getName());
                datatype.setAttributeNode(attrName);

                final Attr attrMappedTo = doc.createAttribute("mappedTo");
                attrMappedTo.setValue(metadataType.getMappedTo());
                datatype.setAttributeNode(attrMappedTo);

                final Attr attrNamespace = doc.createAttribute("namespace");
                attrNamespace.setValue(metadataType.getNamespace());
                datatype.setAttributeNode(attrNamespace);

                final Attr attrSchemaName = doc.createAttribute("schemaName");
                attrSchemaName.setValue(metadataType.getSchemaName());
                datatype.setAttributeNode(attrSchemaName);

                datatypes.appendChild(datatype);
            }

            final Element enums = doc.createElement("enums");
            rootElement.appendChild(enums);
            for (MetadataEnum metadataEnum : metadata.getEnumList()) {
                final Element enumElement = doc.createElement("enum");
                final Attr attrName = doc.createAttribute("name");
                attrName.setValue(metadataEnum.getName());
                enumElement.setAttributeNode(attrName);

                final Attr attrNamespace = doc.createAttribute("namespace");
                attrNamespace.setValue(metadataEnum.getNamespace());
                enumElement.setAttributeNode(attrNamespace);

                final Attr attrSchemaName = doc.createAttribute("schemaName");
                attrSchemaName.setValue(metadataEnum.getSchemaName());
                enumElement.setAttributeNode(attrSchemaName);

                final Attr attrPackage = doc.createAttribute("package");
                attrPackage.setValue(metadataEnum.getPackageApi());
                enumElement.setAttributeNode(attrPackage);

                final Attr attrDocumentation = doc.createAttribute("documentation");
                attrDocumentation.setValue("");
                enumElement.setAttributeNode(attrDocumentation);

                for (String value : metadataEnum.getValueList()) {
                    final Element valueElement = doc.createElement("value");
                    valueElement.setTextContent(value);
                    enumElement.appendChild(valueElement);
                }

                enums.appendChild(enumElement);
            }

            final Element groups = doc.createElement("groups");
            rootElement.appendChild(groups);
            for (MetadataItem metadataClass : metadata.getGroupList()) {
                final Element classElement = doc.createElement("class");

                final Attr attrName = doc.createAttribute("name");
                attrName.setValue(metadataClass.getName());
                classElement.setAttributeNode(attrName);

                final Attr attrNamespace = doc.createAttribute("namespace");
                attrNamespace.setValue(metadataClass.getNamespace());
                classElement.setAttributeNode(attrNamespace);

                final Attr attrSchemaName = doc.createAttribute("schemaName");
                attrSchemaName.setValue(metadataClass.getSchemaName());
                classElement.setAttributeNode(attrSchemaName);

                final Attr attrPackageApi = doc.createAttribute("package");
                attrPackageApi.setValue(metadataClass.getPackageApi());
                classElement.setAttributeNode(attrPackageApi);

                final Attr attrDocumentation = doc.createAttribute("documentation");
                attrDocumentation.setValue("");
                classElement.setAttributeNode(attrDocumentation);

                for (MetadataElement element : metadataClass.getElements()) {
                    final Element childElement = doc.createElement("element");

                    final Attr elName = doc.createAttribute("name");
                    elName.setValue(element.getName());
                    childElement.setAttributeNode(elName);

                    final Attr elType = doc.createAttribute("type");
                    elType.setValue(element.getType());
                    childElement.setAttributeNode(elType);

                    if (element.getIsAttribute() == true) {
                        final Attr elAttribute = doc.createAttribute("attribute");
                        elAttribute.setValue(Boolean.toString(element.getIsAttribute()));
                        childElement.setAttributeNode(elAttribute);
                    }

                    if (element.getDefaultValue() != null) {
                        final Attr elAttribute = doc.createAttribute("default");
                        elAttribute.setValue(element.getDefaultValue());
                        childElement.setAttributeNode(elAttribute);
                    }

                    if (element.getFixedValue() != null) {
                        final Attr elAttribute = doc.createAttribute("fixed");
                        elAttribute.setValue(element.getFixedValue());
                        childElement.setAttributeNode(elAttribute);
                    }

                    if (element.getUse() != null) {
                        final Attr elAttribute = doc.createAttribute("use");
                        elAttribute.setValue(element.getUse());
                        childElement.setAttributeNode(elAttribute);
                    }

                    if (element.getMaxOccurs() != null) {
                        final Attr elMaxOccurs = doc.createAttribute("maxOccurs");
                        elMaxOccurs.setValue(element.getMaxOccurs());
                        childElement.setAttributeNode(elMaxOccurs);
                    }

                    classElement.appendChild(childElement);
                }

                for (MetadataElement element : metadataClass.getReferences()) {
                    final Element childElement = doc.createElement("include");

                    final Attr elName = doc.createAttribute("name");
                    elName.setValue(element.getRef());
                    childElement.setAttributeNode(elName);

                    classElement.appendChild(childElement);
                }

                groups.appendChild(classElement);
            }

            final Element classes = doc.createElement("classes");
            rootElement.appendChild(classes);
            for (MetadataItem metadataClass : metadata.getClassList()) {
                final Element classElement = doc.createElement("class");

                final Attr attrName = doc.createAttribute("name");
                attrName.setValue(metadataClass.getName());
                classElement.setAttributeNode(attrName);

                final Attr attrNamespace = doc.createAttribute("namespace");
                attrNamespace.setValue(metadataClass.getNamespace());
                classElement.setAttributeNode(attrNamespace);

                final Attr attrSchemaName = doc.createAttribute("schemaName");
                attrSchemaName.setValue(metadataClass.getSchemaName());
                classElement.setAttributeNode(attrSchemaName);

                final Attr attrPackageApi = doc.createAttribute("packageApi");
                attrPackageApi.setValue(metadataClass.getPackageApi());
                classElement.setAttributeNode(attrPackageApi);

                final Attr attrPackageImpl = doc.createAttribute("packageImpl");
                attrPackageImpl.setValue(metadataClass.getPackageImpl());
                classElement.setAttributeNode(attrPackageImpl);

                final Attr attrDocumentation = doc.createAttribute("documentation");
                attrDocumentation.setValue("");
                classElement.setAttributeNode(attrDocumentation);

                for (MetadataElement element : metadataClass.getElements()) {
                    final Element childElement = doc.createElement("element");

                    final Attr elName = doc.createAttribute("name");
                    elName.setValue(element.getName());
                    childElement.setAttributeNode(elName);

                    final Attr elType = doc.createAttribute("type");
                    elType.setValue(element.getType());
                    childElement.setAttributeNode(elType);

                    if (element.getMaxOccurs() != null) {
                        final Attr elMaxOccurs = doc.createAttribute("maxOccurs");
                        elMaxOccurs.setValue(element.getMaxOccurs());
                        childElement.setAttributeNode(elMaxOccurs);
                    }

                    if (element.getIsAttribute() == true) {
                        final Attr elAttribute = doc.createAttribute("attribute");
                        elAttribute.setValue(Boolean.toString(element.getIsAttribute()));
                        childElement.setAttributeNode(elAttribute);
                    }

                    if (element.getDefaultValue() != null) {
                        final Attr elAttribute = doc.createAttribute("default");
                        elAttribute.setValue(element.getDefaultValue());
                        childElement.setAttributeNode(elAttribute);
                    }

                    if (element.getFixedValue() != null) {
                        final Attr elAttribute = doc.createAttribute("fixed");
                        elAttribute.setValue(element.getFixedValue());
                        childElement.setAttributeNode(elAttribute);
                    }

                    if (element.getUse() != null) {
                        final Attr elAttribute = doc.createAttribute("use");
                        elAttribute.setValue(element.getUse());
                        childElement.setAttributeNode(elAttribute);
                    }

                    classElement.appendChild(childElement);
                }

                for (MetadataElement element : metadataClass.getReferences()) {
                    final Element childElement = doc.createElement("include");

                    final Attr elName = doc.createAttribute("name");
                    elName.setValue(element.getRef());
                    childElement.setAttributeNode(elName);

                    if (element.getMaxOccurs() != null) {
                        final Attr elMaxOccurs = doc.createAttribute("maxOccurs");
                        elMaxOccurs.setValue(element.getMaxOccurs());
                        childElement.setAttributeNode(elMaxOccurs);
                    }

                    classElement.appendChild(childElement);
                }

                classes.appendChild(classElement);
            }

            final Element descriptors = doc.createElement("descriptors");
            rootElement.appendChild(descriptors);

            for (MetadataDescriptor descriptor : metadata.getMetadataDescriptorList()) {
                if (descriptor.getRootElementName() != null && descriptor.getRootElementType() != null) {
                    final Element descriptorElement = doc.createElement("descriptor");
                    descriptors.appendChild(descriptorElement);

                    final Attr attrName = doc.createAttribute("name");
                    attrName.setValue(descriptor.getName());
                    descriptorElement.setAttributeNode(attrName);

                    final Attr attrSchemaName = doc.createAttribute("schemaName");
                    attrSchemaName.setValue(descriptor.getSchemaName());
                    descriptorElement.setAttributeNode(attrSchemaName);

                    final Attr attrPackageApi = doc.createAttribute("packageApi");
                    attrPackageApi.setValue(descriptor.getPackageApi());
                    descriptorElement.setAttributeNode(attrPackageApi);

                    final Attr attrPackageImpl = doc.createAttribute("packageImpl");
                    attrPackageImpl.setValue(descriptor.getPackageImpl());
                    descriptorElement.setAttributeNode(attrPackageImpl);

                    final Element element = doc.createElement("element");
                    descriptorElement.appendChild(element);

                    final Attr attElementName = doc.createAttribute("name");
                    attElementName.setValue(descriptor.getRootElementName());
                    element.setAttributeNode(attElementName);

                    final Attr attElementType = doc.createAttribute("type");
                    attElementType.setValue(descriptor.getRootElementType());
                    element.setAttributeNode(attElementType);

                    final Enumeration<?> em = descriptor.getNamespaces().keys();
                    while (em.hasMoreElements()) {
                        final String key = (String) em.nextElement();
                        final String value = (String) descriptor.getNamespaces().get(key);
                        final Attr namespaceAttrName = doc.createAttribute("name");
                        namespaceAttrName.setValue(key);

                        final Attr namespaceAttrValue = doc.createAttribute("value");
                        namespaceAttrValue.setValue(value);

                        final Element namespaceElement = doc.createElement("namespace");
                        namespaceElement.setAttributeNode(namespaceAttrName);
                        namespaceElement.setAttributeNode(namespaceAttrValue);

                        descriptorElement.appendChild(namespaceElement);
                    }

                    if (descriptor.getCommonRef() != null) {
                        final Element commonRefElement = doc.createElement("commonRef");
                        commonRefElement.setAttribute("refid", descriptor.getCommonRef().getRefid());
                        descriptorElement.appendChild(commonRefElement);
                    }

                    if (descriptor.getCommon() != null) {
                        final Element commonElement = doc.createElement("common");
                        commonElement.setAttribute("pathToCommonApi", descriptor.getCommon().getPathToCommonApi());
                        commonElement.setAttribute("commonDescriptorName", descriptor.getCommon().getCommonDescriptorName());
                        commonElement.setAttribute("commonApi", descriptor.getCommon().getCommonApi());
                        commonElement.setAttribute("commonNamespace", descriptor.getCommon().getCommonNamespace());
                        commonElement.setAttribute("id", descriptor.getCommon().getId());
                        commonElement.setAttribute("generate", descriptor.getCommon().getGenerate().toString());

                        if (descriptor.getCommon().getCommonImports() != null) {
                            final Element commonImport = doc.createElement("commonImport");
                            for (String importDescl : descriptor.getCommon().getCommonImports()) {
                                final Element importElement = doc.createElement("import");
                                importElement.setAttribute("package", importDescl);
                                commonImport.appendChild(importElement);
                            }
                            commonElement.appendChild(commonImport);
                        }

                        if (descriptor.getCommon().getTypes() != null) {
                            final Element commonTypes = doc.createElement("commonTypes");
                            for (String type : descriptor.getCommon().getTypes()) {
                                final Element typeElement = doc.createElement("type");
                                final String[] items = type.split(":", -1);
                                if (items.length == 2) {
                                    typeElement.setAttribute("namespace", items[0]);
                                    typeElement.setAttribute("name", items[1]);
                                    commonTypes.appendChild(typeElement);
                                }
                            }
                            commonElement.appendChild(commonTypes);
                        }

                        if (descriptor.getCommon().getExcludes() != null) {
                            final Element excludeTypes = doc.createElement("commonExcludes");
                            for (String exclude : descriptor.getCommon().getExcludes()) {
                                final Element excludeElement = doc.createElement("exclude");
                                final String[] items = exclude.split(":", -1);
                                if (items.length == 2) {
                                    excludeElement.setAttribute("namespace", items[0]);
                                    excludeElement.setAttribute("name", items[1]);
                                    excludeTypes.appendChild(excludeElement);
                                }
                            }
                            commonElement.appendChild(excludeTypes);
                        }

                        descriptorElement.appendChild(commonElement);
                    }
                }
            }

            final TransformerFactory transformerFactory = TransformerFactory.newInstance();
            final Transformer transformer = transformerFactory.newTransformer();
            final DOMSource source = new DOMSource(doc);
            final File file = new File(pathToMetadata);
            final StreamResult result = new StreamResult(file);

            // Output to console for testing
            // StreamResult result = new StreamResult(System.out);

            transformer.transform(source, result);

            if (log.isLoggable(Level.FINE)) {
                log.fine("Saved: " + file.getAbsolutePath());
            }

        } catch (ParserConfigurationException pce) {
            pce.printStackTrace();
        } catch (TransformerException tfe) {
            tfe.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
2044
public TokenMetadata cloneAfterAllSettled()
    {
        lock.readLock().lock();

        try
        {
            TokenMetadata metadata = cloneOnlyTokenMap();

            for (InetAddress endpoint : leavingEndpoints)
                metadata.removeEndpoint(endpoint);


            for (Pair<Token, InetAddress> pair : movingEndpoints)
                metadata.updateNormalToken(pair.left, pair.right);

            return metadata;
        }
        finally
        {
            lock.readLock().unlock();
        }
    }
1029725
function buildMetadata(f, metadataTarget, options, isText) {

  var ext = path.extname(f);
  var name = path.basename(f, ext);

  var data = buildMetadataContent(name, options, ext, isText);

  fs.ensureFileSync(metadataTarget);
  fs.writeFileSync(metadataTarget, data, 'utf8');

}
1316371
@Override
    public IIOMetadata getImageMetadata(final int imageIndex) throws IOException {
        checkBounds(imageIndex);
        readHeader();

        return new TGAMetadata(header, extensions);
    }
133462
private void buildPackageMetadata() throws IOException {
    metadata.validate();
    buildTemplatedMetadataFile(META_DIR + "/" + CONFIG_XML);
    buildPropertiesFile(META_DIR + "/" + PROPERTIES_XML);
    buildTemplatedMetadataFile(META_DIR + "/" + SETTINGS_XML);
    buildTemplatedMetadataFile(META_DIR + "/" + PACKAGE_DEFINITION_XML);
    writeXmlDocument(META_DIR + "/" + FILTER_XML, xmlContentBuilder.buildFilter(metadata.getFilters()));

    // package thumbnail
    byte[] thumbnailImage = metadata.getThumbnailImage();
    if (thumbnailImage != null) {
      zip.putNextEntry(new ZipEntry(META_DIR + "/definition/thumbnail.png"));
      try {
        zip.write(thumbnailImage);
      }
      finally {
        zip.closeEntry();
      }
    }
  }
795790
public CreateCustomMetadataRequest withCustomMetadata(java.util.Map<String, String> customMetadata) {
        setCustomMetadata(customMetadata);
        return this;
    }
1104530
public Object getMetadata(ITree node, String key) {
        Object metadata;
        if (node == null || (metadata = node.getMetadata(key)) == null)
            return getMetadata(key);
        return metadata;
    }
1096197
@SuppressWarnings("unchecked")
    public HashMap<String, HashMap<String, String>> getMetaData() {
        HashMap<String, HashMap<String, String>> result = new HashMap<String, HashMap<String, String>>();
        for (MetaRecord mr : meta) {
            result.put((String) mr.get(FieldName.META_FILENAME),
                    (HashMap<String, String>) mr.get(FieldName.META_PROPERTIES));
        }
        return result;
    }
963181
public com.google.api.ads.admanager.axis.v201902.VideoMetadata getMetadata() {
        return metadata;
    }
523285
function storeMetaData(metaData, file) {
	var json
		, stream;

	try {
		json = JSON.stringify(metaData);
		stream = fs.createWriteStream(file);

		stream.write(json);
		stream.end();
	} catch(e) {
		console.error('Could not save meta data for ' + file);
	}
}
1372721
ITag createFileMeta() {
        log.debug("Creating onMetaData");
        // Create tag for onMetaData event
        IoBuffer buf = IoBuffer.allocate(1024);
        buf.setAutoExpand(true);
        Output out = new Output(buf);
        out.writeString("onMetaData");
        Map<Object, Object> props = new HashMap<Object, Object>();
        // Duration property
        props.put("duration", ((double) duration / (double) timeScale));

        // Audio codec id - watch for mp3 instead of aac
        props.put("audiocodecid", audioCodecId);
        props.put("aacaot", audioCodecType);
        props.put("audiosamplerate", audioTimeScale);
        props.put("audiochannels", audioChannels);
        props.put("canSeekToEnd", false);
        out.writeMap(props);
        buf.flip();

        //now that all the meta properties are done, update the duration
        duration = Math.round(duration * 1000d);

        ITag result = new Tag(IoConstants.TYPE_METADATA, 0, buf.limit(), null, 0);
        result.setBody(buf);
        return result;
    }
168782
@Override
    public ModuleMetaData createModuleMetaData(ExtendedModuleInfo moduleInfo) throws MetaDataException {
        Container container = moduleInfo.getContainer();
        ConnectorModuleMetaData cmmd;
        try {
            cmmd = container.adapt(ConnectorModuleMetaData.class);
        } catch (UnableToAdaptException e) {
            throw new MetaDataException(e);
        }
        return cmmd;
    }
1119799
public void add(String name, TiffObject value, String path, String schema) {
    if (!metadata.containsKey(name)) {
      metadata.put(name, new MetadataObject());
    }
    metadata.get(name).getObjectList().add(value);
    metadata.get(name).setPath(path);
    metadata.get(name).setSchema(schema);
  }
4559
def create_metadata_file(output_path, data_dir):
    '''
    '''

    # Relative path to all (BASIS).metadata.json files
    meta_filelist, table_filelist, _, _ = get_all_filelist(data_dir)

    metadata = {}
    for meta_file_relpath in meta_filelist:

        # Read in the metadata for a single basis set
        meta_file_path = os.path.join(data_dir, meta_file_relpath)
        bs_metadata = read_json_basis(meta_file_path)

        # Base of the filename for table basis sets
        # Basename is something like '6-31G.', including the last period
        base_relpath, meta_filename = os.path.split(meta_file_relpath)
        base_filename = meta_filename.split('.')[0] + '.'

        # All the table files that correspond to this metadata file
        # (relative to data_dir)

        this_filelist = [
            x for x in table_filelist
            if os.path.dirname(x) == base_relpath and os.path.basename(x).startswith(base_filename)
        ]

        # The 'versions' dict that will go into the metadata
        version_info = {}

        # Make sure function types are the same
        function_types = None

        # For each table basis, compose it
        for table_file in this_filelist:
            # Obtain just the filename of the table basis
            table_filename = os.path.basename(table_file)

            # Obtain the base filename and version from the filename
            # The base filename is the part before the first period
            # (filebase.ver.table.json)
            table_filebase, ver, _, _ = table_filename.split('.')

            # Fully compose the basis set from components
            bs = compose_table_basis(table_file, data_dir)

            # Elements for which this basis is defined
            defined_elements = sorted(list(bs['elements'].keys()), key=lambda x: int(x))

            # Determine the types of functions contained in the basis
            # (gto, ecp, etc)
            if function_types is None:
                function_types = bs['function_types']
            elif function_types != bs['function_types']:
                raise RuntimeError("Differing function types across versions for " + base_filename)

            # Create the metadata for this specific version
            # yapf: disable
            version_info[ver] = { 'file_relpath': table_file,
                                  'revdesc': bs['revision_description'],
                                  'elements': defined_elements
                                }
            # yapf: enable

        # Sort the version dicts
        version_info = dict(sorted(version_info.items()))
        # Find the maximum version for this basis
        latest_ver = max(version_info.keys())

        # Create the common metadata for this basis set
        # display_name and other_names are placeholders to keep order
        # yapf: disable
        common_md = { 'display_name': None,
                      'other_names': None,
                      'description': bs['description'],
                      'latest_version': latest_ver,
                      'basename': base_filename[:-1], # Strip off that trailing period
                      'relpath': base_relpath,
                      'family': bs['family'],
                      'role': bs['role'],
                      'functiontypes': function_types,
                      'auxiliaries': bs['auxiliaries'],
                      'versions': version_info }
        # yapf: enable

        # Loop through all the common names, translate them, and then add the data
        for bs_name in bs_metadata['names']:
            tr_name = transform_basis_name(bs_name)

            if tr_name in metadata:
                raise RuntimeError("Duplicate basis set name: " + tr_name)

            # Create a new entry, with all the common metadata
            # Also, store the other names for this basis
            other_names = bs_metadata['names'].copy()
            other_names.remove(bs_name)
            metadata[tr_name] = common_md.copy()
            metadata[tr_name]['display_name'] = bs_name
            metadata[tr_name]['other_names'] = other_names

    # Write out the metadata
    metadata = dict(sorted(metadata.items()))
    _write_plain_json(output_path, metadata)
514406
public Metadata[] readMetadata() throws IOException {
        readStreamSync();
        ArrayList<Metadata> metadataList = new ArrayList<Metadata>();
        Metadata metadata;
        do {
            metadata = readNextMetadata();
            metadataList.add(metadata);
        } while (!metadata.isLast());
        return (Metadata[])metadataList.toArray(new Metadata[0]);
    }
519566
@VisibleForTesting
  static Map<String, String> encodeMetadata(Map<String, byte[]> metadata) {
    return Maps.transformValues(metadata, ENCODE_METADATA_VALUES);
  }