[ 
https://issues.apache.org/jira/browse/TIKA-4762?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18095712#comment-18095712
 ] 

Carl Eric Codere edited comment on TIKA-4762 at 7/12/26 2:58 PM:
-----------------------------------------------------------------

[~tallison] : Actually i have created, quite a while back, a generic plugin 
system for metadata modification and extraction, and i was looking at the Tika 
infrastructure, and wanted to see if i could use your Property class and extend 
it as a base class for a Metadata attribute definition, as some of the items 
are quite similar (internal/external read-only, Bag,Seq), see my code below. 
But after looking more closely at Property class it would require several 
changes on your side and would probably not be worth for TIKA. Because in 
LDAP/JNDI and other type system the type system is open, hence ValueType could 
not be closed which yours is based on XMP which is ok for your intended main 
needs i guess. For your information the current interface for a 
PropertyDefinition / AttributeDefinition... 
{noformat}
  /** Returns the type name or syntax identifier for values of this
   *  item.
   *
   *  <p>Typically an OBJECT IDENTIFIER that identifies a data-type
   *  definition in the same schema (e.g.
   *  {@code "1.3.6.1.4.1.1466.115.121.1.15"} for the LDAP Directory
   *  String syntax). Equivalent to the SYNTAX field in RFC 4512.</p>
   */
  String getTypeName();  
  /** Returns the value-type identifier, indicating the multiplicity
   *  and ordering of values for this item.
   *
   *  <p>The returned value is always one of:</p>
   *  <ul>
   *    <li>{@link #VALUE_TYPE_SINGLE} — exactly one value</li>
   *    <li>{@link #VALUE_TYPE_BAG}    — zero or more unordered
   *        values</li>
   *    <li>{@link #VALUE_TYPE_SEQ}    — zero or more ordered
   *        values</li>
   *    <li>{@link #VALUE_TYPE_ALT}    — zero or more alternative
   *        values keyed by context</li>
   *  </ul>
   */
  String getValueType();  
   /** Returns the context type identifier for alternative values, or
   *  {@code null} if this item does not use alternative values.
   *
   *  <p>This value is only meaningful when {@link #getValueType()}
   *  returns {@link #VALUE_TYPE_ALT}. It specifies how alternative
   *  values are distinguished, typically one of
   *  {@link #CONTEXT_LANGUAGE} or {@link #CONTEXT_LOCATION}, though
   *  custom identifiers are also permitted.</p>
   *
   * @return The context type identifier, or {@code null} if this
   *         item does not have alternative values.
   */
  String getContextType();
  /** Returns {@code true} if values of this item are read-only with
   *  respect to user applications.
   *
   *  <p>Equivalent to the NO-USER-MODIFICATION flag in RFC 4512.
   *  When {@code true}, only the underlying system or directory
   *  service may modify the item; user applications must treat
   *  it as read-only. Equivalent also to Internal attribute
   *  in XMP.</p>
   *
   * @return {@code true} if read-only, {@code false} if user
   *         applications may modify values (the default).
   */
  boolean isReadOnly();  
  /** Returns the maximum permitted length for values of this item,
   *  or {@code -1} if no length restriction is defined.*/
  long getMaxValueLength();  
   /** Returns the set of choice values that this item restricts its
   *  values to, or {@code null} if no choice constraint is declared.
   */
  java.util.Set<String> getChoices();    
  /** Returns the choice type, indicating whether the values returned by
   *  {@link #getChoices()} are an enforced constraint or an advisory
   *  set of suggestions.
   */
  String getChoiceType();
  
  /** Returns the local name (descriptor) of this definition, e.g. 
   *  "cn", "title", "yearMonthDuration". The local name is a 
   *  bare identifier without any namespace prefix; namespace 
   *  context is carried separately by {@link #getNamespaceURI()}. 
   *  Subject to the {@link #NAME_MAX_LENGTH} limit.
   * 
   */
  String getLocalName();  
  /** Returns the namespace URI associated with this definition's name,
   *  or {@code null} if the definition has no namespace.
   *
   *  <p>When present, the namespace URI must end with {@code '/'} or
   *  {@code '#'} to allow unambiguous expanded-name construction by
   *  concatenation.</p>
   *
   */
  String getNamespaceURI();  
  /** Returns the expanded name of this definition in RDF IRI format.
   */
  String getExpandedName();  
  /** Returns the unique identifier (OID) of this definition.
   *
   * @return The object identifier, or null if absent
   */
  String getOID();  
  /** Returns the human-readable description of this definition, or
   *  {@code null} if no description has been set.
   */
  String getDescription();  
  /** Returns {@code true} if this definition is obsolete and should no
   *  longer be used in new schema designs.
   *
   *  <p>Equivalent to the OBSOLETE keyword in RFC 4512.</p>
   *
   * @return {@code true} if this definition is obsolete,
   *         {@code false} otherwise (including when not explicitly
   *         set, in which case the default is {@code false}).
   */
  boolean isObsolete();  
  /** Returns the origin (standard or specification) of this definition,
   *  or {@code null} if no origin has been recorded.
   *
   *  <p>Typical values: {@code "RFC 4519"},
   *  {@code "ITU-T X.520"}, {@code "MS Active Directory"}.</p>
   *
   * @return The origin string, or {@code null} if not specified.
   */
  String getOrigin();
{noformat}


was (Author: cecodere):
[~tallison] : Actually i have created, quite a while back, a generic plugin 
system for metadata modification and extraction, and i was looking at the Tika 
infrastructure, and wanted to see if i could use your Property class and extend 
it as a base class for a Metadata attribute definition, as some of the items 
are similar, see my fields below. But after looking more closely at Property 
class it would require several changes on your side and would probably not be 
worth for TIKA. Because in LDAP/JNDI and other type system the type system is 
open, hence ValueType could not be closed which yours is based on XMP which is 
ok for your intended main needs i guess. 
{noformat}
/** Type name or OID (bare, without any {@code {n}} suffix) - Equivalent to 
your valueType */
String typeName
/** One of the {@code VALUE_TYPE_*} constants. Never {@code null} - equivalent 
to your PropertyType. */
String valueType;
/**
 * Context type identifier. Non-null only when {@link #valueType} is
 * {@link #VALUE_TYPE_ALT}.
*/
String contextType;
/** {@code true} if values are system-only (NO-USER-MODIFICATION). Similar to 
internal in XMP and TIKA */
boolean readOnly;
long maxValueLength;
Set<String> choices;
/** OID or other standardised identifier. May be {@code null}. */
String oid;
  /** Namespace URI. {@code null} means no namespace. */
String namespaceURI;
/** Local name. Never {@code null} or empty. */
String localName;
/** Human-readable description. May be {@code null}. */
String description;
/**
   * Origin of this definition (e.g. {@code "RFC 4519"}). May be {@code null}.
*/
String origin;
 /** Whether this definition is obsolete. Defaults to {@code false}. */
boolean obsolete;
  
{noformat}
{code:java}
 {code}

> Make Property class non-final
> -----------------------------
>
>                 Key: TIKA-4762
>                 URL: https://issues.apache.org/jira/browse/TIKA-4762
>             Project: Tika
>          Issue Type: Improvement
>          Components: core
>    Affects Versions: 3.3.0
>            Reporter: Carl Eric Codere
>            Priority: Minor
>
> h2. Problem description
> The Property class is {{final}} in {{tika-core}} and constructors are 
> private, which makes subclassing or inheriting from this class impossible.
> h2. How to resolve
> Make the property class non-final and optionally, make the constructors 
> protected



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to