/** Sets the URL string. This will be called from * DataEntryURLBox. */ protected void setURL(String url) { _urlProp = new Property ("URL", PropertyType.STRING, url); }
/** * Extract the content value associated with a given httpEquiv. * @param prop List containing the description of the meta tag * @param httpEquivValue the httpEquiv to consider * @return the content value */ public String extractHttpEquivValue(Property prop, String httpEquivValue) { if (httpEquivValue == null) return null; String value = null; Property httpEquiv = prop.getByName("Httpequiv"); if (httpEquiv != null && PropertyArity.SCALAR.equals(httpEquiv.getArity()) && PropertyType.STRING.equals(httpEquiv.getType()) ) { String val = (String)httpEquiv.getValue(); if (httpEquivValue.equalsIgnoreCase(val)) { // Look for charset in the Content property Property content = prop.getByName("Content"); if (content != null && PropertyArity.SCALAR.equals(content.getArity()) && PropertyType.STRING.equals(content.getType()) ) { value = (String)content.getValue(); } } } return value; }
String name = _propUnderConstruction.getName (); Object val = _propUnderConstruction.getValue (); if ("abbr".equals (name)) { List propList = (List) _propUnderConstruction.getValue(); Property abProp = new Property ("abbr", PropertyType.STRING, argStr); _propUnderConstruction = new Property (name, PropertyType.STRING, (String) val + argStr);
/** Set a property indexed by component. * If a property for that component doesn't already * exist, it is created. <code>prop</code> is then * added to the property list of that property. */ public void setCompProperty (int idx, Property prop) { if (_components != null && _components.length > idx) { if (_components[idx] == null) { // Have to create the component property _components[idx] = new Property ("Component", PropertyType.PROPERTY, PropertyArity.LIST, new LinkedList ()); } List pList = (List) _components[idx].getValue (); pList.add (prop); } }
/** Finishes any property under construction. This is called * when an end element is encountered. */ public void finishPropUnderConstruction () { if (_propUnderConstruction != null) { String name = _propUnderConstruction.getName (); if ("abbr".equals(name)) { addAbbr (_propUnderConstruction); } else if ("title".equals (name)) { _title = (String) _propUnderConstruction.getValue (); } _propUnderConstruction = null; } } }
private void showScalarProperty (Property property, String margin) { PropertyType type = property.getType (); if (PropertyType.PROPERTY.equals (type)) { _writer.println (); Property prop = (Property) property.getValue (); showProperty (prop, prop.getName (), margin + " "); //_writer.println (); // Does this improve things? } else if (PropertyType.NISOIMAGEMETADATA.equals (type)) { showNisoImageMetadata ((NisoImageMetadata) property.getValue (), margin + " ", _je.getShowRawFlag ()); } else if (PropertyType.AESAUDIOMETADATA.equals (type)) { showAESAudioMetadata ((AESAudioMetadata) property.getValue (), margin + " ", _je.getShowRawFlag ()); } else if (PropertyType.TEXTMDMETADATA.equals(type)) { showTextMDMetadata((TextMDMetadata) property.getValue(), margin + " ", _je.getShowRawFlag ()); } else { _writer.println (property.getValue ().toString ()); } }
PropertyArity arity = pProp.getArity (); PropertyType typ = pProp.getType (); Object pValue = pProp.getValue (); if (arity == PropertyArity.SCALAR) { if (typ == PropertyType.NISOIMAGEMETADATA) { if ("TextMDMetadata".equals(pProp.getName())) { TextMDMetadata tData = (TextMDMetadata) pValue; return textMDToNode (tData); new DefaultMutableTreeNode (pProp.getName ()); val.add (propToNode ((Property) pValue)); return val; (pProp.getName () + ": " + pValue.toString ()); return val; new DefaultMutableTreeNode (pProp.getName ()); if (arity == PropertyArity.ARRAY) { addArrayMembers (val, pProp);
{ List<Object> l = (List<Object>) p.getValue (); PropertyType ptyp = p.getType (); for (Object item : l) { if (ptyp == PropertyType.PROPERTY) { node.add (propToNode ((Property) item)); } else if (ptyp == PropertyType.NISOIMAGEMETADATA) { node.add (nisoToNode ((NisoImageMetadata) item)); } else { // Simple objects just need a leaf. node.add (new DefaultMutableTreeNode (item, false)); } } }
PropertyArity arity = pProp.getArity (); arity == PropertyArity.MAP) { if (arity == PropertyArity.SET) { Set<?> set = (Set<?>) pProp.getValue (); iter = set.iterator (); Map<?, ?> map = (Map<?, ?>) pProp.getValue (); iter = map.values().iterator (); List<?> list = (List<?>) pProp.getValue (); iter = list.iterator (); PropertyType propType = pProp.getType (); java.util.Date[] dateArray = null; Property[] propArray = null; dateArray = (java.util.Date []) pProp.getValue (); n = dateArray.length; objArray = (Object []) pProp.getValue (); n = objArray.length; rationalArray = (Rational []) pProp.getValue (); n = rationalArray.length; propArray = (Property []) pProp.getValue (); n = propArray.length;
/** Extracts and returns the Exif property list from a standard * IFD property header. */ public List exifProps (Property pHeader) { try { Property[] pArr = (Property []) pHeader.getValue (); Property entries = pArr[2]; return (List) entries.getValue (); } catch (Exception e) { // We could get caught here if we somehow tried to get // the Exif properties from something that wasn't a // standard property header. return null; } }
/** * Add a Property to the property map. The name of the Property * becomes its key in the map. */ public void setProperty (Property property) { _property.put (property.getName (), property); }
private void showProperty (Property property, String key, String margin) { PropertyArity arity = property.getArity (); if (key == null) { _writer.print (margin + " "); } else { _writer.print (margin + " " + key + ": "); } if (arity.equals (PropertyArity.SCALAR)) { showScalarProperty (property, margin); } else if (arity.equals (PropertyArity.LIST)) { showListProperty (property, margin); } else if (arity.equals (PropertyArity.MAP)) { showMapProperty (property, margin); } else if (arity.equals (PropertyArity.SET)) { showSetProperty (property, margin); } else if (arity.equals (PropertyArity.ARRAY)) { showArrayProperty (property, margin); } else { _writer.println (); } }
/** * Return property by name, regardless of its position in the * property hierarchy. * @param name Property name * @return Named property (or null) */ public Property getByName (String name) { Property prop = null; Collection<Property> coll = _property.values (); Iterator<Property> iter = coll.iterator (); while (iter.hasNext ()) { prop = iter.next (); if ((prop = prop.getByName (name)) != null) { break; } } return prop; }
/** * Creates a Property with arity SCALAR. * * @param name The displayable name of the property * @param type The type of property * @param value The value of the property. The type of the * parameter must agree with <code>type</code>. */ public Property (String name, PropertyType type, Object value) { init (name, type, PropertyArity.SCALAR, value); }
private void init (String name, PropertyType type, PropertyArity arity, Object value) { /* Some limited type checking. Checking for mismatched types here may help avoid difficult chasing down of the bugs such mismatches cause. */ if (value == null) { throw new NullPointerException (CoreMessageConstants.EXC_PROP_VAL_NULL); } if ((arity == PropertyArity.SCALAR) && !isObjScalarProp(value)) { throw new IncompatibleClassChangeError (CoreMessageConstants.EXC_SCL_PROP_CLSS_INCMPT); } else if ((arity == PropertyArity.MAP) && (!(value instanceof Map))) { throw new IncompatibleClassChangeError (CoreMessageConstants.EXC_MAP_PROP_CLSS_INCMPT); } else if ((arity == PropertyArity.SET) && (!(value instanceof Set))) { throw new IncompatibleClassChangeError (CoreMessageConstants.EXC_SET_PROP_CLSS_INCMPT); } else if ((arity == PropertyArity.LIST) && (!(value instanceof List))) { throw new IncompatibleClassChangeError (CoreMessageConstants.EXC_LIST_PROP_CLSS_INCMPT); } _name = name; _type = type; _arity = arity; _value = value; }
PropertyType type = property.getType (); boolean valueIsProperty = PropertyType.PROPERTY.equals (type); boolean valueIsNiso = PropertyType.NISOIMAGEMETADATA.equals (type); boolean valueIsTextMD = PropertyType.TEXTMDMETADATA.equals(type); Map propmap = (Map) property.getValue (); Set keys = propmap.keySet(); Iterator propiter = keys.iterator(); if (valueIsProperty) { Property pval = (Property) val; showProperty (pval, pval.getName (), margin + " "); String propkeyStr = propkey.toString (); if (!(pval.getName ().equals(propkeyStr ))) { _writer.println (" Key: " + propkeyStr);
PropertyArity arity = property.getArity (); PropertyType type = property.getType (); _writer.println (margn2 + elementStart ("property")); _writer.println (margn3 + element ("name", property.getName ())); _writer.println (margn3 + elementStart ("values", propAttrs)); if (arity.equals (PropertyArity.SCALAR)) { showProperty ((Property) property.getValue ()); showNisoImageMetadata ((NisoImageMetadata)property.getValue()); _writer.println (margn4 + elementEnd ("value")); showAESAudioMetadata ((AESAudioMetadata)property.getValue()); _writer.println (margn4 + elementEnd ("value")); showTextMDMetadata ((TextMDMetadata)property.getValue()); _writer.println (margn4 + elementEnd ("value")); property.getValue ().toString ())); List propList = (List) property.getValue (); ListIterator iter = propList.listIterator(); while (iter.hasNext ()) { showNisoImageMetadata ((NisoImageMetadata)property.getValue()); _writer.println (margn4 + elementEnd ("value"));
{ Set<?> s = (Set<?>) p.getValue (); PropertyType ptyp = p.getType (); Iterator<?> iter = s.iterator (); while (iter.hasNext ()) { Object item = iter.next (); if (ptyp == PropertyType.PROPERTY) { node.add (propToNode ((Property) item)); } else if (ptyp == PropertyType.NISOIMAGEMETADATA) { node.add (nisoToNode ((NisoImageMetadata) item)); } else { // Simple objects just need a leaf. node.add (new DefaultMutableTreeNode (item, false)); } } }
extractExifNisoData((NisoImageMetadata) nisoProp.getValue());