users@jsr311.java.net

Re: Publishing jsr311-api 0.6 to Maven

From: Stephan Koops <Stephan.Koops_at_web.de>
Date: Tue, 26 Feb 2008 13:15:07 +0100

Hello Paul,

some questions are already open for me; perhaps the answers don't reach me:

*extension mapping*

    * should the extension mapping ignore @ProduceMime, if available?
    * Perhaps it is useful to allow different mime types for some
      extensions (e.g. "application/xml" and "text/xml") and check, if
      the client only accept one of them.

*_at_Path*
Are matrix parameters allowed or not? I think it' should be not required.

*UriBuilder*
What about a method uriBuilder.parent() that removes the last path
segment of the actual state?

*EntityProvider for javax.xml.transform.Source*
Where should the transformer get it's XSLT Source? Are I missing something?
Otherwise the XSLT source could be defined by an defined annotation.

*_at_Provider*
For what is the annotation @Provider needed?
The ApplicationConfig contains all Providers, so it's not needed to find
the providers (in the classpath or whereever). Another possibility to
identify them is to check, if the classes implement at least one of the
interfaces.

/Some new questions:/
*MessageBodyWriter / MessageBodyReader*

    * Must the httpHeaders in MessageBodyWriter.writeTo(...) be mutable
      or is it enough if the may they be mutable?
    * I think it is also useful to define if the httpHeaders in
      MessageBodyReader.readFrom(...) are mutable or not. I think they
      should be immutable. Perhaps it is useful to define two different
      interfaces for readable MultivaluedMaps and a sub interface which
      allows changes (see attachment). I know, it's late, but there are
      a lot of points where it is useful. I think collection interfaces
      without requiring changes are missing in java.
    * If I remember right, it's not defined what should happens, if no
      MessageBodyWriter (and also MessageBodyReader) could be found.
      Should status 406 (Not Acceptable) respectivly 422 (Unprocessable
      Entity) returned?

*JAXB*
It's nowhere defined which JAXB version is required. Is it container
dependant, or should a required version be defined? JAXB v1 doesn't
support annotations, if I remember right, so this isn't useful. But
there are also JAXB v2.0 and v2.1, I think.

*ContextResolver*
I found not when to use it. Where should the environment inject it? What
type of context should be returned of method
ContextResolver.getContext(Class)?

best regards
   Stephan

Paul Sandoz schrieb:
> Hi Sergey,
>
> See my attached response to Jervis (for 0.5). A stable release of the
> RI and the API will be available on Fri March 7th and that will be
> published to the java.net maven repo.
>
> Is it causing annoying problems to the CXF development process to wait
> until March 7th or is that too long to wait?
>
> Stephan, Bill, is the current release process causing issues for you
> as well?
>
> Paul.
>
> Sergey Beryozkin wrote:
>> Hi
>>
>> Is it possible to publish a 0.6 version of api to one of the public
>> Maven repositories ?
>> 0.6 replaces @UriParam with @PathParam which affects the users' code,
>> thus in CXF we'd like to switch to 0.6 as early as possible.
>>
>> Thanks, Sergey Beryozkin



/*
 * The contents of this file are subject to the terms of the Common Development
 * and Distribution License (the "License"). You may not use this file except in
 * compliance with the License.
 *
 * You can obtain a copy of the license at
 * http://www.opensource.org/licenses/cddl1.php See the License for the specific
 * language governing permissions and limitations under the License.
 */

/*
 * ReadableMultivaluedMap.java
 *
 * Created on February 26, 2008
 */

package javax.ws.rs.core;

import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * A readable map of key-values pairs. Each key can have zero or more values.
 *
 */
public interface ReadableMultivaluedMap<K, V> extends Map<K, List<V>> {

    /**
     * Returns the number of key-value mappings in this map. If the map contains
     * more than <tt>Integer.MAX_VALUE</tt> elements, returns
     * <tt>Integer.MAX_VALUE</tt>.
     *
     * @return the number of key-value mappings in this map.
     */
    int size();

    /**
     * Returns <tt>true</tt> if this map contains no key-value mappings.
     *
     * @return <tt>true</tt> if this map contains no key-value mappings.
     */
    boolean isEmpty();

    /**
     * Returns <tt>true</tt> if this map contains a mapping for the specified
     * key. More formally, returns <tt>true</tt> if and only if this map
     * contains a mapping for a key <tt>k</tt> such that
     * <tt>(key==null ? k==null : key.equals(k))</tt>. (There can be at most
     * one such mapping.)
     *
     * @param key
     * key whose presence in this map is to be tested.
     * @return <tt>true</tt> if this map contains a mapping for the specified
     * key.
     *
     * @throws ClassCastException
     * if the key is of an inappropriate type for this map
     * (optional).
     * @throws NullPointerException
     * if the key is <tt>null</tt> and this map does not
     * permit <tt>null</tt> keys (optional).
     */
    boolean containsKey(Object key);

    /**
     * Returns <tt>true</tt> if this map maps one or more keys to the
     * specified value. More formally, returns <tt>true</tt> if and only if
     * this map contains at least one mapping to a value <tt>v</tt> such that
     * <tt>(value==null ? v==null : value.equals(v))</tt>. This operation
     * will probably require time linear in the map size for most
     * implementations of the <tt>Map</tt> interface.
     *
     * @param value
     * value whose presence in this map is to be tested.
     * @return <tt>true</tt> if this map maps one or more keys to the
     * specified value.
     * @throws ClassCastException
     * if the value is of an inappropriate type for this map
     * (optional).
     * @throws NullPointerException
     * if the value is <tt>null</tt> and this map does not
     * permit <tt>null</tt> values (optional).
     */
    boolean containsValue(Object value);

    /**
     * Returns an (unmodifiable) list of the values to which this map maps the
     * specified key. Returns <tt>null</tt> if the map contains no mapping for
     * this key. A return value of <tt>null</tt> does not <i>necessarily</i>
     * indicate that the map contains no mapping for the key; it's also possible
     * that the map explicitly maps the key to <tt>null</tt>. The
     * <tt>containsKey</tt> operation may be used to distinguish these two
     * cases.
     *
     * @param key
     * key whose associated value is to be returned.
     * @return the values to which this map maps the specified key, or
     * <tt>null</tt> if the map contains no mapping for this key.
     *
     * @throws ClassCastException
     * if the key is of an inappropriate type for this map
     * (optional).
     * @throws NullPointerException
     * if the key is <tt>null</tt> and this map does not
     * permit <tt>null</tt> keys (optional).
     *
     * @see #containsKey(Object)
     */
    List<V> get(Object key);

    /**
     * A shortcut to get the first value of the supplied key.
     *
     * @param key
     * the key
     * @return the first value for the specified key or null if the key is not
     * in the map.
     */
    V getFirst(K key);

    /**
     * Returns an (unmodifiable) set of the keys contained in this map. If the
     * map is modified while an iteration over the set is in progress (except
     * through the iterator's own <tt>remove</tt> operation), the results of
     * the iteration are undefined.
     *
     * @return a set view of the keys contained in this map.
     */
    Set<K> keySet();

    /**
     * Returns an (unmodifiable) set of the mappings contained in this map. Each
     * element in the returned set is a {_at_link Map.Entry}. If the map is
     * modified while an iteration over the set is in progress the results of
     * the iteration are undefined.
     *
     * @return a set view of the mappings contained in this map.
     */
    Set<Map.Entry<K, List<V>>> entrySet();

    /**
     * Compares the specified object with this map for equality. Returns
     * <tt>true</tt> if the given object is also a map and the two Maps
     * represent the same mappings. More formally, two maps <tt>t1</tt> and
     * <tt>t2</tt> represent the same mappings if
     * <tt>t1.entrySet().equals(t2.entrySet())</tt>. This ensures that the
     * <tt>equals</tt> method works properly across different implementations
     * of the <tt>Map</tt> interface.
     *
     * @param o
     * object to be compared for equality with this map.
     * @return <tt>true</tt> if the specified object is equal to this map.
     */
    boolean equals(Object o);

    /**
     * Returns the hash code value for this map. The hash code of a map is
     * defined to be the sum of the hashCodes of each entry in the map's
     * entrySet view. This ensures that <tt>t1.equals(t2)</tt> implies that
     * <tt>t1.hashCode()==t2.hashCode()</tt> for any two maps <tt>t1</tt>
     * and <tt>t2</tt>, as required by the general contract of
     * Object.hashCode.
     *
     * @return the hash code value for this map.
     * @see Map.Entry#hashCode()
     * @see Object#hashCode()
     * @see Object#equals(Object)
     * @see #equals(Object)
     */
    int hashCode();

    /**
     * Returns an (unmodifiable) collection view of the values contained in this
     * map.
     *
     * @return a collection view of the values contained in this map.
     */
    Collection<List<V>> values();

    /**
     * This method is deprecated, but available for {_at_link Map} compatibility.
     *
     * @param key
     * @param value
     * @return
     * @throws UnsupportedOperationException
     * clear is not supported by this map.
     */
    @Deprecated
    V put(K key, V value);

    /**
     * This method is deprecated, but available for {_at_link Map} compatibility.
     *
     * @param t
     *
     * @throws UnsupportedOperationException
     * changing is not supported by this map.
     */
    @Deprecated
    void putAll(Map<? extends K, ? extends V> t);

    /**
     * This method is deprecated, but available for {_at_link Map} compatibility.
     *
     * @throws UnsupportedOperationException
     * changing is not supported by this map.
     */
    @Deprecated
    void clear();
}