Extracts required attributes and their values from a {@link Manifest}
object.

@param mf
A Manifest file.
@return HashMap of the type {atribute name : attribute value}.
778449
public static Metadata fromManifest(Manifest mf) {
        Metadata metadata = new Metadata();
        final Attributes.Name[] attribs = { Attributes.Name.MANIFEST_VERSION,
                Attributes.Name.IMPLEMENTATION_TITLE,
                Attributes.Name.IMPLEMENTATION_URL,
                Attributes.Name.IMPLEMENTATION_VENDOR,
                Attributes.Name.IMPLEMENTATION_VENDOR_ID,
                Attributes.Name.IMPLEMENTATION_VERSION,
                Attributes.Name.MAIN_CLASS };
        for (Attributes.Name attrib : attribs) {
            Object o = mf.getMainAttributes().get(attrib);
            if (o != null) {
                metadata.put(attrib.toString(), o.toString());
            }
        }
        return metadata;
    }
335820
public DBObject getMetadataFromGFSEntity(GridFS gfs, EntityMetadata m, Object entity,
            KunderaMetadata kunderaMetadata)
    {
        MetamodelImpl metaModel = (MetamodelImpl) kunderaMetadata.getApplicationMetadata()
                .getMetamodel(m.getPersistenceUnit());

        EntityType entityType = metaModel.entity(m.getEntityClazz());

        DBObject gfsMetadata = new BasicDBObject();
        Set<Attribute> columns = entityType.getAttributes();
        for (Attribute column : columns)
        {
            boolean isLob = ((Field) column.getJavaMember()).getAnnotation(Lob.class) != null;
            if (!isLob)
            {
                DocumentObjectMapper.extractFieldValue(entity, gfsMetadata, column);
            }
        }
        return gfsMetadata;
    }
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;
    }
84166
public static Map<String, String> getAttributesFromXmlFile(File xmlFile) {
        if (xmlFile == null || !xmlFile.exists())
            return Collections.emptyMap();

        try (Reader reader = createReader(xmlFile)) {
            return getAttributesFromXmlReader(reader);
        }
        catch (IOException | RuntimeException e) {
            return Collections.emptyMap();
        }
    }
251649
static Map<String, String> getVersionAttributes(URL url) throws IOException {
        Map<String, String> ret = new LinkedHashMap<>();
        try (InputStream inputStream = url.openStream()) {
            Manifest manifest = new Manifest(inputStream);
            Attributes attributes = manifest.getMainAttributes();
            for (String key : VERSION_ATTRIBUTES) {
                final String value = attributes.getValue(key);
                ret.put(key, value == null ? UNKNOWN_VALUE : value);
            }
        }
        return ret;
    }
1266379
@GET
    @Path("/version")
    @Produces(MediaType.APPLICATION_JSON)
    public Response manifestDetails(@Context HttpServletRequest request) {

        final ServletContext context = request.getSession().getServletContext();

        try (final InputStream manifestStream = context.getResourceAsStream("/META-INF/MANIFEST.MF")) {
            return Response.ok(new Manifest(manifestStream).getMainAttributes()).build();
        } catch (Exception e) {
            return Response.status(Response.Status.NOT_FOUND).entity("Could not find version information").build();
        }
    }
775490
public Object getAttribute(File file, String attribute) {
    String view = getViewName(attribute);
    String attr = getSingleAttribute(attribute);
    return getAttribute(file, view, attr);
  }
951349
public Map<String, String> values(Object context) {

		if (this.attributes.isEmpty()) {
			return Collections.emptyMap();
		}
		Map<String, String> map = new HashMap<String, String>();
		for (KAttribute attribute : this.attributes) {
			String value = attribute.value(context);
			if (value != null) {
				map.put(attribute.getName(), value);
			}
		}
		return map;
	}
599161
public Map<String, Object> getMBeanResult(final String mbeanName) {
    final Map<String, Object> ret = new HashMap<>();
    try {
      final ObjectName name = new ObjectName(mbeanName);
      final MBeanInfo info = getMBeanInfo(name);

      final MBeanAttributeInfo[] mbeanAttrs = info.getAttributes();
      final Map<String, Object> attributes = new TreeMap<>();

      for (final MBeanAttributeInfo attrInfo : mbeanAttrs) {
        final Object obj = getMBeanAttribute(name, attrInfo.getName());
        attributes.put(attrInfo.getName(), obj);
      }

      ret.put("attributes", attributes);
    } catch (final Exception e) {
      logger.error("Invalid MBean Name. name = " + mbeanName, e);
      ret.put("error", "'" + mbeanName + "' is not a valid mBean name");
    }

    return ret;
  }
1000413
public Map<String, Object> getAttributes() {

        Map<String, Object> attrs = CmsRequestUtil.getAtrributeMap(m_request);

        if (attrs.size() == 0) {
            return null;
        }
        return attrs;
    }
246361
protected Map<String, Object> getAttributeMap() {
		if(this.sipSessionAttributeMap == null) {
			this.sipSessionAttributeMap = new ConcurrentHashMap<String, Object>();
		}
		return this.sipSessionAttributeMap;
	}
762598
public Attributes getMainAttributes() throws IOException {
        Manifest man = getManifest();
        return man != null ? man.getMainAttributes() : null;
    }
1261990
public static AttrResultInfo getMBeanAttributeResultInfo(String name, MBeanAttributeInfo attrInfo)
      throws JMException
   {
      ClassLoader loader = SecurityActions.getThreadContextClassLoader();
      MBeanServer server = getMBeanServer();
      ObjectName objName = new ObjectName(name);
      String attrName = attrInfo.getName();
      String attrType = attrInfo.getType();
      Object value = null;
      Throwable throwable = null;

      if (attrInfo.isReadable())
      {
         try
         {
            value = server.getAttribute(objName, attrName);
         }
         catch (Throwable t)
         {
            throwable = t;
         }
      }

      Class typeClass = null;
      try
      {
         typeClass = Classes.getPrimitiveTypeForName(attrType);
         if (typeClass == null)
            typeClass = loader.loadClass(attrType);
      }
      catch (ClassNotFoundException cnfe)
      {
         // Ignore
      }

      PropertyEditor editor = null;
      if (typeClass != null)
         editor = PropertyEditorManager.findEditor(typeClass);

      return new AttrResultInfo(attrName, editor, value, throwable);
   }
591531
public Map<Object, Object> getManifestAttributes() {
		Map<Object, Object> manifestAttributes = null;
		
		manifestAttributes = getExplodedWarManifestAttributes();
		if (manifestAttributes == null) {
		    manifestAttributes = getPackagedWarManifestAttributes();
		}
		if (manifestAttributes == null) {
		    manifestAttributes = getClassPathManifestAttributes();
		}
		
		if (manifestAttributes == null) {
		    manifestAttributes = new HashMap<>();
		}
		return manifestAttributes;
	}
607160
public static Document getDocument(File file) {
        InputStream inputStream = null;

        try {
            inputStream = new FileInputStream(file);
        } catch (FileNotFoundException ex) {
            throw new MjdbcRuntimeException(ex);
        }

        return XmlRepositoryFactory.getDocument(inputStream);
    }
398918
protected Map<String, List<Object>> buildMutableAttributeMap(final Map<String, List<Object>> attributes) {
        final Map<String, List<Object>> mutableValuesBuilder = this.createMutableAttributeMap(attributes.size());

        for (final Map.Entry<String, List<Object>> attrEntry : attributes.entrySet()) {
            final String key = attrEntry.getKey();
            List<Object> value = attrEntry.getValue();

            if (value != null) {
                value = new ArrayList<>(value);
            }

            mutableValuesBuilder.put(key, value);
        }

        return mutableValuesBuilder;
    }
813962
private Map<Object, Object> getExplodedWarManifestAttributes() {
	    Map<Object, Object> manifestAttributes = null;
	    
	    FileInputStream fis = null;
	    try {
            if (servletContext != null) {
                final String appServerHome = servletContext.getRealPath("");
                final File manifestFile = new File(appServerHome, MANIFEST);
                
                LOGGER.debug("Using Manifest file:{}", manifestFile.getPath());
                
                fis = new FileInputStream(manifestFile);
                Manifest mf = new Manifest(fis);
                manifestAttributes = mf.getMainAttributes();
            }
        } catch (Exception e) {
            LOGGER.warn("Unable to read the manifest file from the servlet context.");
            LOGGER.debug("Unable to read the manifest file", e);            
        } finally {
            IOUtils.closeQuietly(fis);
        }
        return manifestAttributes;
	}