[llvm-commits] [llvm-gcc-4.2] r43913 [46/80] - in /llvm-gcc-4.2/trunk: boehm-gc/ boehm-gc/Mac_files/ boehm-gc/cord/ boehm-gc/doc/ boehm-gc/include/ boehm-gc/include/private/ boehm-gc/tests/ libffi/ libffi/include/ libffi/src/ libffi/src/alpha/ libffi/src/arm/ libffi/src/cris/ libffi/src/frv/ libffi/src/ia64/ libffi/src/m32r/ libffi/src/m68k/ libffi/src/mips/ libffi/src/pa/ libffi/src/powerpc/ libffi/src/s390/ libffi/src/sh/ libffi/src/sh64/ libffi/src/sparc/ libffi/src/x86/ libffi/testsuite/ libffi/testsuite/config/ li...
Bill Wendling
isanbard at gmail.com
Thu Nov 8 14:57:11 PST 2007
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/management/StandardMBean.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/management/StandardMBean.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/management/StandardMBean.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/management/StandardMBean.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,925 @@
+/* StandardMBean.java -- A standard reflection-based management bean.
+ Copyright (C) 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.management;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Provides a dynamic management bean by using reflection on an
+ * interface and an implementing class. By default, a bean instance
+ * is paired up with its interface based on specific naming
+ * conventions (if the implementation is called X, the interface must
+ * be XMBean). Using this class removes the need to use a specific
+ * naming system to match up the two. Instead, an instance of this
+ * bean is created either via explicit construction or subclassing,
+ * and this provides access to the attributes, constructors and
+ * operations of the implementation via reflection. Various hooks are
+ * provided in order to allow customization of this process.
+ *
+ * @author Andrew John Hughes (gnu_andrew at member.fsf.org)
+ * @since 1.5
+ */
+public class StandardMBean
+ implements DynamicMBean
+{
+
+ /**
+ * The interface for this bean.
+ */
+ private Class iface;
+
+ /**
+ * The implementation of the interface.
+ */
+ private Object impl;
+
+ /**
+ * Cached bean information.
+ */
+ private MBeanInfo info;
+
+ /**
+ * Constructs a new {@link StandardMBean} using the specified
+ * interface and <code>this</code> as the instance. This should
+ * be used to create an instance via subclassing.
+ *
+ * @param iface the interface this bean implements, or <code>null</code>
+ * if the interface should be determined using the naming
+ * convention (class X has interface XMBean).
+ * @throws NotCompliantMBeanException if this class doesn't implement
+ * the interface or a method appears
+ * in the interface that doesn't comply
+ * with the naming conventions.
+ */
+ protected StandardMBean(Class iface)
+ throws NotCompliantMBeanException
+ {
+ if (iface == null)
+ {
+ String className = getClass().getName();
+ try
+ {
+ iface = Class.forName(className + "MBean");
+ }
+ catch (ClassNotFoundException e)
+ {
+ throw (NotCompliantMBeanException)
+ (new NotCompliantMBeanException("An interface for the class " +
+ className + " was not found.").initCause(e));
+ }
+ }
+ if (!(iface.isInstance(this)))
+ throw new NotCompliantMBeanException("The instance, " + impl +
+ ", is not an instance of " + iface);
+ impl = this;
+ this.iface = iface;
+ }
+
+ /**
+ * Constructs a new {@link StandardMBean} using the specified
+ * interface and the supplied instance as the implementation.
+ *
+ * @param impl the implementation.
+ * @param iface the interface the bean implements, or <code>null</code>
+ * if the interface should be determined using the naming
+ * convention (class X has interface XMBean).
+ * @throws IllegalArgumentException if <code>impl</code> is <code>null</code>.
+ * @throws NotCompliantMBeanException if <code>impl</code> doesn't implement
+ * the interface or a method appears
+ * in the interface that doesn't comply
+ * with the naming conventions.
+ */
+ public StandardMBean(Object impl, Class iface)
+ throws NotCompliantMBeanException
+ {
+ if (impl == null)
+ throw new IllegalArgumentException("The specified implementation is null.");
+ if (iface == null)
+ {
+ String className = impl.getClass().getName();
+ try
+ {
+ iface = Class.forName(className + "MBean");
+ }
+ catch (ClassNotFoundException e)
+ {
+ throw (NotCompliantMBeanException)
+ (new NotCompliantMBeanException("An interface for the class " +
+ className + " was not found.").initCause(e));
+ }
+ }
+ if (!(iface.isInstance(impl)))
+ throw new NotCompliantMBeanException("The instance, " + impl +
+ ", is not an instance of " + iface);
+ this.impl = impl;
+ this.iface = iface;
+ }
+
+ /**
+ * Caches the {@link MBeanInfo} instance for this object. This is a
+ * customization hook, so that subclasses can choose the caching policy
+ * used. The default implementation caches the value in the instance
+ * itself. Subclasses may override this so as to not cache the data
+ * at all, or so as to use a cache shared between multiple beans.
+ *
+ * @param info the {@link MBeanInfo} instance to cache, or <code>null</code>
+ * if there is no new value to cache. When the value is not
+ * <code>null</code>, the cache should replace the current value
+ * with the value supplied here.
+ * @see #getCachedMBeanInfo()
+ */
+ protected void cacheMBeanInfo(MBeanInfo info)
+ {
+ if (info != null)
+ this.info = info;
+ }
+
+ /**
+ * Obtains the value of the specified attribute of the
+ * management bean. The management bean should perform
+ * a lookup for the named attribute, and return its value
+ * by calling the appropriate getter method, if possible.
+ *
+ * @param name the name of the attribute to retrieve.
+ * @return the value of the specified attribute.
+ * @throws AttributeNotFoundException if the name does not
+ * correspond to an attribute
+ * of the bean.
+ * @throws MBeanException if retrieving the attribute causes
+ * the bean to throw an exception (which
+ * becomes the cause of this exception).
+ * @throws ReflectionException if an exception occurred in trying
+ * to use the reflection interface
+ * to lookup the attribute. The
+ * thrown exception is the cause of
+ * this exception.
+ * @see #setAttribute(String)
+ */
+ public Object getAttribute(String name)
+ throws AttributeNotFoundException, MBeanException,
+ ReflectionException
+ {
+ Method getter;
+ try
+ {
+ getter = iface.getMethod("get" +
+ name.substring(0, 1).toUpperCase() +
+ name.substring(1), null);
+ }
+ catch (NoSuchMethodException e)
+ {
+ try
+ {
+ getter = iface.getMethod("is" +
+ name.substring(0, 1).toUpperCase() +
+ name.substring(1), null);
+ }
+ catch (NoSuchMethodException ex)
+ {
+ throw ((AttributeNotFoundException)
+ new AttributeNotFoundException("The attribute, " + name +
+ ", was not found.").initCause(ex));
+ }
+ }
+ Object result;
+ try
+ {
+ result = getter.invoke(impl, null);
+ }
+ catch (IllegalAccessException e)
+ {
+ throw new ReflectionException(e, "Failed to retrieve " + name);
+ }
+ catch (IllegalArgumentException e)
+ {
+ throw new ReflectionException(e, "Failed to retrieve " + name);
+ }
+ catch (InvocationTargetException e)
+ {
+ throw new MBeanException((Exception) e.getCause(),
+ "The getter of " + name +
+ " threw an exception");
+ }
+ return result;
+ }
+
+ /**
+ * Obtains the values of each of the specified attributes
+ * of the management bean. The returned list includes
+ * those attributes that were retrieved and their
+ * corresponding values.
+ *
+ * @param names the names of the attributes to retrieve.
+ * @return a list of the retrieved attributes.
+ * @see #setAttributes(AttributeList)
+ */
+ public AttributeList getAttributes(String[] names)
+ {
+ AttributeList list = new AttributeList(names.length);
+ for (int a = 0; a < names.length; ++a)
+ {
+ try
+ {
+ Object value = getAttribute(names[a]);
+ list.add(new Attribute(names[a], value));
+ }
+ catch (AttributeNotFoundException e)
+ {
+ /* Ignored */
+ }
+ catch (ReflectionException e)
+ {
+ /* Ignored */
+ }
+ catch (MBeanException e)
+ {
+ /* Ignored */
+ }
+ }
+ return list;
+ }
+
+ /**
+ * Returns the cached {@link MBeanInfo} instance for this object. This is a
+ * customization hook, so that subclasses can choose the caching policy
+ * used. The default implementation caches the value in the instance
+ * itself, and returns this value on calls to this method.
+ *
+ * @return the cached {@link MBeanInfo} instance, or <code>null</code>
+ * if no value is cached.
+ * @see #cacheMBeanInfo(javax.management.MBeanInfo)
+ */
+ protected MBeanInfo getCachedMBeanInfo()
+ {
+ return info;
+ }
+
+ /**
+ * Returns the class name that will be used in the {@link MBeanInfo}
+ * instance. This is a customization hook, so that subclasses can
+ * provide a custom class name. By default, this returns the class
+ * name from the supplied {@link MBeanInfo} instance.
+ *
+ * @param info the {@link MBeanInfo} instance constructed via
+ * reflection.
+ * @return the class name to use in the instance.
+ */
+ protected String getClassName(MBeanInfo info)
+ {
+ return info.getClassName();
+ }
+
+ /**
+ * Returns information on the constructors that will be used in
+ * the {@link MBeanInfo} instance. This is a customization hook,
+ * so that subclasses can provide their own information on the
+ * bean's constructors, if necessary. By default, this method
+ * returns <code>null</code> unless the implementation supplied
+ * is either <code>null</code> or <code>this</code>. This default
+ * implementation prevents the use of
+ * {@link MBeanServer#createMBean} in cases where the bean is
+ * not created as a subclass of {@link StandardMBean}.
+ *
+ * @param constructors the constructor information created via
+ * reflection.
+ * @param impl the implementation, or <code>null</code> if this
+ * should be ignored.
+ * @return the constructor information to use.
+ */
+ protected MBeanConstructorInfo[] getConstructors(MBeanConstructorInfo[]
+ constructors, Object impl)
+ {
+ if (impl == null || impl == this)
+ return constructors;
+ return null;
+ }
+
+ /**
+ * Returns the description of the attribute that will be used in
+ * the supplied {@link MBeanAttributeInfo} instance. This is a
+ * customization hook, so that subclasses can provide a custom
+ * description. By default, this calls
+ * {@link #getDescription(MBeanFeatureInfo)} with the supplied
+ * {@link MBeanAttributeInfo} instance.
+ *
+ * @param info the {@link MBeanAttributeInfo} instance constructed
+ * via reflection.
+ * @return the description to use in the instance.
+ */
+ protected String getDescription(MBeanAttributeInfo info)
+ {
+ return getDescription((MBeanFeatureInfo) info);
+ }
+
+ /**
+ * Returns the description of the constructor that will be used in
+ * the supplied {@link MBeanConstructorInfo} instance. This is a
+ * customization hook, so that subclasses can provide a custom
+ * description. By default, this calls
+ * {@link #getDescription(MBeanFeatureInfo)} with the supplied
+ * {@link MBeanConstructorInfo} instance.
+ *
+ * @param info the {@link MBeanConstructorInfo} instance constructed
+ * via reflection.
+ * @return the description to use in the instance.
+ */
+ protected String getDescription(MBeanConstructorInfo info)
+ {
+ return getDescription((MBeanFeatureInfo) info);
+ }
+
+ /**
+ * Returns the description of the nth parameter of the constructor
+ * that will be used in the supplied {@link MBeanParameterInfo}
+ * instance. This is a customization hook, so that subclasses
+ * can provide a custom description. By default, this calls
+ * <code>param.getDescription()</code>.
+ *
+ * @param info the {@link MBeanConstructorInfo} instance constructed
+ * via reflection.
+ * @param param the {@link MBeanParameterInfo} instance constructed
+ * via reflection.
+ * @param n the number of the parameter, in order to link it to the
+ * information on the constructor.
+ * @return the description to use in the instance.
+ */
+ protected String getDescription(MBeanConstructorInfo info,
+ MBeanParameterInfo param, int n)
+ {
+ return param.getDescription();
+ }
+
+ /**
+ * Returns the description of the supplied feature that
+ * will be used in the supplied {@link MBeanFeatureInfo}
+ * instance. This is a customization hook, so that subclasses
+ * can provide a custom description. By default, this calls
+ * <code>info.getDescription()</code>. This method is also called
+ * by default for the more specific description methods for attributes,
+ * constructors and operations.
+ *
+ * @param info the {@link MBeanFeatureInfo} instance constructed
+ * via reflection.
+ * @return the description to use in the instance.
+ */
+ protected String getDescription(MBeanFeatureInfo info)
+ {
+ return info.getDescription();
+ }
+
+ /**
+ * Returns the description of the bean that will be used in the
+ * supplied {@link MBeanInfo} instance. This is a customization
+ * hook, so that subclasses can provide a custom description. By
+ * default, this calls <code>info.getDescription()</code>.
+ *
+ * @param info the {@link MBeanInfo} instance constructed
+ * via reflection.
+ * @return the description to use in the instance.
+ */
+ protected String getDescription(MBeanInfo info)
+ {
+ return info.getDescription();
+ }
+
+ /**
+ * Returns the description of the operation that will be used in
+ * the supplied {@link MBeanOperationInfo} instance. This is a
+ * customization hook, so that subclasses can provide a custom
+ * description. By default, this calls
+ * {@link #getDescription(MBeanFeatureInfo)} with the supplied
+ * {@link MBeanOperationInfo} instance.
+ *
+ * @param info the {@link MBeanOperationInfo} instance constructed
+ * via reflection.
+ * @return the description to use in the instance.
+ */
+ protected String getDescription(MBeanOperationInfo info)
+ {
+ return getDescription((MBeanFeatureInfo) info);
+ }
+
+ /**
+ * Returns the description of the nth parameter of the operation
+ * that will be used in the supplied {@link MBeanParameterInfo}
+ * instance. This is a customization hook, so that subclasses
+ * can provide a custom description. By default, this calls
+ * <code>param.getDescription()</code>.
+ *
+ * @param info the {@link MBeanOperationInfo} instance constructed
+ * via reflection.
+ * @param param the {@link MBeanParameterInfo} instance constructed
+ * via reflection.
+ * @param n the number of the parameter, in order to link it to the
+ * information on the operation.
+ * @return the description to use in the instance.
+ */
+ protected String getDescription(MBeanOperationInfo info,
+ MBeanParameterInfo param, int n)
+ {
+ return param.getDescription();
+ }
+
+ /**
+ * Returns the impact of the operation that will be used in the
+ * supplied {@link MBeanOperationInfo} instance. This is a
+ * customization hook, so that subclasses can provide a custom
+ * impact flag. By default, this returns
+ * <code>info.getImpact()</code>.
+ *
+ * @param info the {@link MBeanOperationInfo} instance constructed
+ * via reflection.
+ * @return the impact flag to use in the instance.
+ */
+ protected int getImpact(MBeanOperationInfo info)
+ {
+ return info.getImpact();
+ }
+
+ /**
+ * Returns the instance that implements this bean.
+ *
+ * @return the implementation.
+ */
+ public Object getImplementation()
+ {
+ return impl;
+ }
+
+ /**
+ * Returns the class of the instance that implements this bean.
+ *
+ * @return the implementation class.
+ */
+ public Class getImplementationClass()
+ {
+ return impl.getClass();
+ }
+
+ /**
+ * <p>
+ * Returns an information object which lists the attributes
+ * and actions associated with the management bean. This
+ * implementation proceeds as follows:
+ * </p>
+ * <ol>
+ * <li>{@link #getCachedMBeanInfo()} is called to obtain
+ * the cached instance. If this returns a non-null value,
+ * this value is returned.</li>
+ * <li>If there is no cached value, then the method proceeds
+ * to create one. During this process, the customization hooks
+ * detailed in this class are called to allow the values used
+ * to be overrided:
+ * <ul>
+ * <li>For each attribute,
+ * {@link #getDescription(MBeanAttributeInfo)} is called.</li>
+ * <li>For each constructor,
+ * {@link #getDescription(MBeanConstructorInfo)} is called,
+ * along with {@link #getDescription(MBeanConstructorInfo,
+ * MBeanParameterInfo, int)} and
+ * {@link #getParameterName(MBeanConstructorInfo,
+ * MBeanParameterInfo, int)} for each parameter.</li>
+ * <li>The constructors may be replaced as a whole by
+ * a call to
+ * {@link #getConstructors(MBeanConstructorInfo[], Object)}.</li>
+ * <li>For each operation,
+ * {@link #getDescription(MBeanOperationInfo)} and
+ * {@link #getImpact(MBeanOperationInfo)} are called,
+ * along with {@link #getDescription(MBeanOperationInfo,
+ * MBeanParameterInfo, int)} and
+ * {@link #getParameterName(MBeanOperationInfo,
+ * MBeanParameterInfo, int)} for each parameter.</li>
+ * <li>{@link #getClassName(MBeanInfo)} and
+ * {@link #getDescription(MBeanInfo)} are called to customise
+ * the basic information about the class.</li>
+ * </ul>
+ * </li>
+ * <li>Finally, {@link #cacheMBeanInfo(MBeanInfo)} is called
+ * with the created instance before it is returned.</li>
+ * </ol>
+ *
+ * @return a description of the management bean, including
+ * all exposed attributes and actions.
+ */
+ public MBeanInfo getMBeanInfo()
+ {
+ MBeanInfo info = getCachedMBeanInfo();
+ if (info != null)
+ return info;
+ Method[] methods = iface.getMethods();
+ Map attributes = new HashMap();
+ List operations = new ArrayList();
+ for (int a = 0; a < methods.length; ++a)
+ {
+ String name = methods[a].getName();
+ if (((name.startsWith("get") &&
+ methods[a].getReturnType() != Void.TYPE) ||
+ (name.startsWith("is") &&
+ methods[a].getReturnType() == Boolean.TYPE)) &&
+ methods[a].getParameterTypes().length == 0)
+ {
+ Method[] amethods;
+ String attrib;
+ if (name.startsWith("is"))
+ attrib = name.substring(2,3).toLowerCase()
+ + name.substring(3);
+ else
+ attrib = name.substring(3,4).toLowerCase()
+ + name.substring(4);
+ if (attributes.containsKey(attrib))
+ amethods = (Method[]) attributes.get(attrib);
+ else
+ {
+ amethods = new Method[2];
+ attributes.put(attrib, amethods);
+ }
+ amethods[0] = methods[a];
+ }
+ else if (name.startsWith("set") &&
+ methods[a].getReturnType() == Void.TYPE &&
+ methods[a].getParameterTypes().length == 1)
+ {
+ Method[] amethods;
+ String attrib = name.substring(3,4).toLowerCase()
+ + name.substring(4);
+ if (attributes.containsKey(attrib))
+ amethods = (Method[]) attributes.get(attrib);
+ else
+ {
+ amethods = new Method[2];
+ attributes.put(attrib, amethods);
+ }
+ amethods[1] = methods[a];
+ }
+ else
+ operations.add(new MBeanOperationInfo("", methods[a]));
+ }
+ List attribs = new ArrayList(attributes.size());
+ Iterator it = attributes.entrySet().iterator();
+ while (it.hasNext())
+ {
+ Map.Entry entry = (Map.Entry) it.next();
+ Method[] amethods = (Method[]) entry.getValue();
+ try
+ {
+ attribs.add(new MBeanAttributeInfo((String) entry.getKey(), "",
+ amethods[0], amethods[1]));
+ }
+ catch (IntrospectionException e)
+ {
+ /* Shouldn't happen; both shouldn't be null */
+ throw new IllegalStateException("The two methods passed to " +
+ "the MBeanAttributeInfo " +
+ "constructor for " + entry +
+ "were null.", e);
+ }
+ }
+ MBeanAttributeInfo[] ainfo = new MBeanAttributeInfo[attribs.size()];
+ for (int a = 0; a < ainfo.length; ++a)
+ {
+ MBeanAttributeInfo oldInfo = (MBeanAttributeInfo) attribs.get(a);
+ String desc = getDescription(oldInfo);
+ ainfo[a] = new MBeanAttributeInfo(oldInfo.getName(),
+ oldInfo.getType(), desc,
+ oldInfo.isReadable(),
+ oldInfo.isWritable(),
+ oldInfo.isIs());
+ }
+ Constructor[] cons = impl.getClass().getConstructors();
+ MBeanConstructorInfo[] cinfo = new MBeanConstructorInfo[cons.length];
+ for (int a = 0; a < cinfo.length; ++a)
+ {
+ MBeanConstructorInfo oldInfo = new MBeanConstructorInfo("", cons[a]);
+ String desc = getDescription(oldInfo);
+ MBeanParameterInfo[] params = oldInfo.getSignature();
+ MBeanParameterInfo[] pinfo = new MBeanParameterInfo[params.length];
+ for (int b = 0; b < pinfo.length; ++b)
+ {
+ String pdesc = getDescription(oldInfo, params[b], b);
+ String pname = getParameterName(oldInfo, params[b], b);
+ pinfo[b] = new MBeanParameterInfo(pname, params[b].getType(),
+ pdesc);
+ }
+ cinfo[a] = new MBeanConstructorInfo(oldInfo.getName(), desc,
+ pinfo);
+ }
+ cinfo = getConstructors(cinfo, impl);
+ MBeanOperationInfo[] oinfo = new MBeanOperationInfo[operations.size()];
+ for (int a = 0; a < oinfo.length; ++a)
+ {
+ MBeanOperationInfo oldInfo = (MBeanOperationInfo) operations.get(a);
+ String desc = getDescription(oldInfo);
+ int impact = getImpact(oldInfo);
+ MBeanParameterInfo[] params = oldInfo.getSignature();
+ MBeanParameterInfo[] pinfo = new MBeanParameterInfo[params.length];
+ for (int b = 0; b < pinfo.length; ++b)
+ {
+ String pdesc = getDescription(oldInfo, params[b], b);
+ String pname = getParameterName(oldInfo, params[b], b);
+ pinfo[b] = new MBeanParameterInfo(pname, params[b].getType(),
+ pdesc);
+ }
+ oinfo[a] = new MBeanOperationInfo(oldInfo.getName(), desc, pinfo,
+ oldInfo.getReturnType(), impact);
+ }
+ info = new MBeanInfo(impl.getClass().getName(), "", ainfo, cinfo,
+ oinfo, null);
+ String cname = getClassName(info);
+ String desc = getDescription(info);
+ info = new MBeanInfo(cname, desc, ainfo, cinfo, oinfo, null);
+ cacheMBeanInfo(info);
+ return info;
+ }
+
+ /**
+ * Returns the interface for this management bean.
+ *
+ * @return the management interface.
+ */
+ public Class getMBeanInterface()
+ {
+ return iface;
+ }
+
+ /**
+ * Returns the name of the nth parameter of the constructor
+ * that will be used in the supplied {@link MBeanParameterInfo}
+ * instance. This is a customization hook, so that subclasses
+ * can provide a custom name. By default, this calls
+ * <code>param.getName()</code>.
+ *
+ * @param info the {@link MBeanConstructorInfo} instance constructed
+ * via reflection.
+ * @param param the {@link MBeanParameterInfo} instance constructed
+ * via reflection.
+ * @param n the number of the parameter, in order to link it to the
+ * information on the constructor.
+ * @return the name to use in the instance.
+ */
+ protected String getParameterName(MBeanConstructorInfo info,
+ MBeanParameterInfo param, int n)
+ {
+ return param.getName();
+ }
+
+ /**
+ * Returns the name of the nth parameter of the operation
+ * that will be used in the supplied {@link MBeanParameterInfo}
+ * instance. This is a customization hook, so that subclasses
+ * can provide a custom name. By default, this calls
+ * <code>param.getName()</code>.
+ *
+ * @param info the {@link MBeanOperationInfo} instance constructed
+ * via reflection.
+ * @param param the {@link MBeanParameterInfo} instance constructed
+ * via reflection.
+ * @param n the number of the parameter, in order to link it to the
+ * information on the operation.
+ * @return the name to use in the instance.
+ */
+ protected String getParameterName(MBeanOperationInfo info,
+ MBeanParameterInfo param, int n)
+ {
+ return param.getName();
+ }
+
+ /**
+ * Invokes the specified action on the management bean using
+ * the supplied parameters. The signature of the action is
+ * specified by a {@link String} array, which lists the classes
+ * corresponding to each parameter. The class loader used to
+ * load these classes is the same as that used for loading the
+ * management bean itself.
+ *
+ * @param name the name of the action to invoke.
+ * @param params the parameters used to call the action.
+ * @param signature the signature of the action.
+ * @return the return value of the action.
+ * @throws MBeanException if the action throws an exception. The
+ * thrown exception is the cause of this
+ * exception.
+ * @throws ReflectionException if an exception occurred in trying
+ * to use the reflection interface
+ * to invoke the action. The
+ * thrown exception is the cause of
+ * this exception.
+ */
+ public Object invoke(String name, Object[] params, String[] signature)
+ throws MBeanException, ReflectionException
+ {
+ Class[] sigTypes = new Class[signature.length];
+ ClassLoader loader = getClass().getClassLoader();
+ for (int a = 0; a < signature.length; ++a)
+ try
+ {
+ sigTypes[a] = Class.forName(signature[a], true, loader);
+ }
+ catch (ClassNotFoundException e)
+ {
+ throw new ReflectionException(e, "The class, " + signature[a] +
+ ", in the method signature " +
+ "could not be loaded.");
+ }
+ Method method;
+ try
+ {
+ method = iface.getMethod(name, sigTypes);
+ }
+ catch (NoSuchMethodException e)
+ {
+ throw new ReflectionException(e, "The method, " + name +
+ ", could not be found.");
+ }
+ Object result;
+ try
+ {
+ result = method.invoke(impl, params);
+ }
+ catch (IllegalAccessException e)
+ {
+ throw new ReflectionException(e, "Failed to call " + name);
+ }
+ catch (IllegalArgumentException e)
+ {
+ throw new ReflectionException(e, "Failed to call " + name);
+ }
+ catch (InvocationTargetException e)
+ {
+ throw new MBeanException((Exception) e.getCause(), "The method "
+ + name + " threw an exception");
+ }
+ return result;
+ }
+
+ /**
+ * Sets the value of the specified attribute of the
+ * management bean. The management bean should perform
+ * a lookup for the named attribute, and sets its value
+ * using the associated setter method, if possible.
+ *
+ * @param attribute the attribute to set.
+ * @throws AttributeNotFoundException if the attribute does not
+ * correspond to an attribute
+ * of the bean.
+ * @throws InvalidAttributeValueException if the value is invalid
+ * for this particular
+ * attribute of the bean.
+ * @throws MBeanException if setting the attribute causes
+ * the bean to throw an exception (which
+ * becomes the cause of this exception).
+ * @throws ReflectionException if an exception occurred in trying
+ * to use the reflection interface
+ * to lookup the attribute. The
+ * thrown exception is the cause of
+ * this exception.
+ * @see #getAttribute(String)
+ */
+ public void setAttribute(Attribute attribute)
+ throws AttributeNotFoundException, InvalidAttributeValueException,
+ MBeanException, ReflectionException
+ {
+ Method setter;
+ String name = attribute.getName();
+ try
+ {
+ setter = iface.getMethod("set" +
+ name.substring(0, 1).toUpperCase() +
+ name.substring(1), null);
+ }
+ catch (NoSuchMethodException e)
+ {
+ throw ((AttributeNotFoundException)
+ new AttributeNotFoundException("The attribute, " + name +
+ ", was not found.").initCause(e));
+ }
+ try
+ {
+ setter.invoke(impl, new Object[] { attribute.getValue() });
+ }
+ catch (IllegalAccessException e)
+ {
+ throw new ReflectionException(e, "Failed to set " + name);
+ }
+ catch (IllegalArgumentException e)
+ {
+ throw ((InvalidAttributeValueException)
+ new InvalidAttributeValueException(attribute.getValue() +
+ " is an invalid value for " +
+ name).initCause(e));
+ }
+ catch (InvocationTargetException e)
+ {
+ throw new MBeanException((Exception) e.getCause(), "The getter of "
+ + name + " threw an exception");
+ }
+ }
+
+ /**
+ * Sets the value of each of the specified attributes
+ * to that supplied by the {@link Attribute} object.
+ * The returned list contains the attributes that were
+ * set and their new values.
+ *
+ * @param attributes the attributes to set.
+ * @return a list of the changed attributes.
+ * @see #getAttributes(AttributeList)
+ */
+ public AttributeList setAttributes(AttributeList attributes)
+ {
+ AttributeList list = new AttributeList(attributes.size());
+ Iterator it = attributes.iterator();
+ while (it.hasNext())
+ {
+ try
+ {
+ Attribute attrib = (Attribute) it.next();
+ setAttribute(attrib);
+ list.add(attrib);
+ }
+ catch (AttributeNotFoundException e)
+ {
+ /* Ignored */
+ }
+ catch (InvalidAttributeValueException e)
+ {
+ /* Ignored */
+ }
+ catch (ReflectionException e)
+ {
+ /* Ignored */
+ }
+ catch (MBeanException e)
+ {
+ /* Ignored */
+ }
+ }
+ return list;
+ }
+
+ /**
+ * Replaces the implementation of the interface used by this
+ * instance with the one specified. The new implementation
+ * must be non-null and implement the interface specified on
+ * construction of this instance.
+ *
+ * @throws IllegalArgumentException if <code>impl</code> is <code>null</code>.
+ * @throws NotCompliantMBeanException if <code>impl</code> doesn't implement
+ * the interface or a method appears
+ * in the interface that doesn't comply
+ * with the naming conventions.
+ */
+ public void setImplementation(Object impl)
+ throws NotCompliantMBeanException
+ {
+ if (impl == null)
+ throw new IllegalArgumentException("The specified implementation is null.");
+ if (!(iface.isInstance(impl)))
+ throw new NotCompliantMBeanException("The instance, " + impl +
+ ", is not an instance of " + iface);
+ this.impl = impl;
+ }
+
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/management/openmbean/ArrayType.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/management/openmbean/ArrayType.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/management/openmbean/ArrayType.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/management/openmbean/ArrayType.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,313 @@
+/* ArrayType.java -- Open type descriptor for an array.
+ Copyright (C) 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.management.openmbean;
+
+import java.lang.reflect.Array;
+
+import java.util.Arrays;
+
+/**
+ * The open type descriptor for arrays of open data values.
+ *
+ * @author Andrew John Hughes (gnu_andrew at member.fsf.org)
+ * @since 1.5
+ */
+public class ArrayType
+ extends OpenType
+{
+
+ /**
+ * Compatible with JDK 1.5
+ */
+ private static final long serialVersionUID = 720504429830309770L;
+
+ /**
+ * The number of dimensions arrays of this type has.
+ */
+ private int dimension;
+
+ /**
+ * The element type of arrays of this type.
+ */
+ private OpenType elementType;
+
+ /**
+ * The hash code of this instance.
+ */
+ private transient Integer hashCode;
+
+ /**
+ * The <code>toString()</code> result of this instance.
+ */
+ private transient String string;
+
+ /**
+ * Returns the class name of the array, given the element
+ * class name and its dimensions.
+ *
+ * @param className the name of the class used by the
+ * array's elements.
+ * @param dim the dimensions of the array.
+ * @return the array's class name.
+ */
+ private static String getArrayClassName(String className, int dim)
+ {
+ char[] brackets = new char[dim];
+ Arrays.fill(brackets, '[');
+ return String.valueOf(brackets) + "L" + className;
+ }
+
+ /**
+ * <p>
+ * Constructs a new {@link ArrayType} instance for an array of the
+ * specified type with the supplied number of dimensions. The attributes
+ * used by the superclass, {@link OpenType}, are automatically defined,
+ * based on these values. Both the class name and type name are set
+ * to the value returned by the {@link java.lang.Class#getName()} of
+ * the array's class (i.e. the element type, preceded by n instances of
+ * '[' and an 'L', where n is the number of dimensions the array has).
+ * The description is based upon the template <code>n-dimension array
+ * of e</code>, where n is the number of dimensions of the array, and
+ * e is the element type. The class name of the actual elements is
+ * obtainable by calling {@link OpenType#getClassName()} on the result
+ * of {@link #getElementOpenType()}.
+ * </p>
+ * <p>
+ * As an example, the array type returned by
+ * <code>new ArrayType(6, SimpleType.INTEGER)</code> has the following
+ * values:
+ * </p>
+ * <table>
+ * <th><td>Attribute</td><td>Value</td></th>
+ * <tr><td>Class Name</td><td><code>[[[[[[Ljava.lang.Integer;</code>
+ * </td></tr>
+ * <tr><td>Type Name</td><td><code>[[[[[[Ljava.lang.Integer;</code>
+ * </td></tr>
+ * <tr><td>Description</td><td><code>6-dimension array of
+ * java.lang.Integer</code></td></tr>
+ * <tr><td>Element Type Class Name</td><td><code>java.lang.Integer</code>
+ * </td></tr>
+ * </table>
+ * <p>
+ * The dimensions of the array must be equal to or greater than 1. The
+ * element type must be an instance of {@link SimpleType},
+ * {@link CompositeType} or {@link TabularType}.
+ * </p>
+ *
+ * @param dim the dimensions of the array.
+ * @param elementType the type of the elements of the array.
+ * @throws IllegalArgumentException if <code>dim</code> is less than 1.
+ * @throws OpenDataException if the element type is not an instance of either
+ * {@link SimpleType}, {@link CompositeType}
+ * or {@link TabularType}.
+ */
+ public ArrayType(int dim, OpenType elementType)
+ throws OpenDataException
+ {
+ super(getArrayClassName(elementType.getClassName(), dim),
+ getArrayClassName(elementType.getClassName(), dim),
+ dim + "-dimension array of " + elementType.getClassName());
+ if (dim < 1)
+ throw new IllegalArgumentException("Dimensions must be greater " +
+ "than or equal to 1.");
+ if (!(elementType instanceof SimpleType ||
+ elementType instanceof CompositeType ||
+ elementType instanceof TabularType))
+ throw new OpenDataException("The element type must be a simple " +
+ "type, a composite type or a tabular " +
+ "type.");
+ dimension = dim;
+ this.elementType = elementType;
+ }
+
+ /**
+ * <p>
+ * Compares this array type with another object
+ * for equality. The objects are judged to be equal if:
+ * </p>
+ * <ul>
+ * <li><code>obj</code> is not null.</li>
+ * <li><code>obj</code> is an instance of
+ * {@link ArrayType}.</li>
+ * <li>The dimensions are equal.</li>
+ * <li>The element types are equal.</li>
+ * </ul>
+ *
+ * @param obj the object to compare with.
+ * @return true if the conditions above hold.
+ */
+ public boolean equals(Object obj)
+ {
+ if (!(obj instanceof ArrayType))
+ return false;
+ ArrayType atype = (ArrayType) obj;
+ return (atype.getDimension() == dimension &&
+ atype.getElementOpenType().equals(elementType));
+ }
+
+ /**
+ * Returns the number of dimensions used by arrays
+ * of this type.
+ *
+ * @return the number of dimensions.
+ */
+ public int getDimension()
+ {
+ return dimension;
+ }
+
+ /**
+ * Returns the open type descriptor which describes
+ * the type of the elements of this array type.
+ *
+ * @return the type of the elements.
+ */
+ public OpenType getElementOpenType()
+ {
+ return elementType;
+ }
+
+ /**
+ * <p>
+ * Returns the hash code of the array type.
+ * This is computed as the sum of the hash code of the
+ * element type together with the number of dimensions
+ * the array has. These are the same elements
+ * of the type that are compared as part of the
+ * {@link #equals(java.lang.Object)} method, thus ensuring
+ * that the hashcode is compatible with the equality
+ * test.
+ * </p>
+ * <p>
+ * As instances of this class are immutable, the hash code
+ * is computed just once for each instance and reused
+ * throughout its life.
+ * </p>
+ *
+ * @return the hash code of this instance.
+ */
+ public int hashCode()
+ {
+ if (hashCode == null)
+ hashCode = Integer.valueOf(dimension + elementType.hashCode());
+ return hashCode.intValue();
+ }
+
+ /**
+ * <p>
+ * Returns true if the specified object is a member of this
+ * array type. The object is judged to be so if it is
+ * non-null, an array and one of the following two conditions
+ * holds:
+ * </p>
+ * <ul>
+ * <li>This {@link ArrayType} instance has a {@link SimpleType}
+ * as its element type. Thus, the object must have the same
+ * class name as that returned by {@link SimpleType#getClassName()}
+ * for this class.</li>
+ * <li>This {@link ArrayType} instance has a {@link CompositeType}
+ * or a {@link TabularType} as its element type. Thus, the object
+ * must be assignable to such an array, and have elements which
+ * are either null or valid values for the element type.</li>
+ * </ul>
+ *
+ * @param obj the object to test for membership.
+ * @return true if the object is a member of this type.
+ */
+ public boolean isValue(Object obj)
+ {
+ if (obj == null)
+ return false;
+ Class objClass = obj.getClass();
+ if (!(objClass.isArray()))
+ return false;
+ if (elementType instanceof SimpleType)
+ return getClassName().equals(objClass.getName());
+ Class elementClass = null;
+ try
+ {
+ elementClass = Class.forName(getClassName());
+ }
+ catch (ClassNotFoundException e)
+ {
+ throw new IllegalStateException("The array type's element " +
+ "class could not be found.", e);
+ }
+ if (!(elementClass.isAssignableFrom(objClass)))
+ return false;
+ for (int a = 0; a < Array.getLength(obj); ++a)
+ {
+ Object elem = Array.get(obj, a);
+ if (elem != null &&
+ (!(elementType.isValue(elem))))
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * <p>
+ * Returns a textual representation of this instance. This
+ * is constructed using the class name
+ * (<code>javax.management.openmbean.ArrayType</code>)
+ * and each element of the instance which is relevant to
+ * the definition of {@link equals(java.lang.Object)} and
+ * {@link hashCode()} (i.e. the type name, the number of
+ * dimensions and the element type).
+ * </p>
+ * <p>
+ * As instances of this class are immutable, the return value
+ * is computed just once for each instance and reused
+ * throughout its life.
+ * </p>
+ *
+ * @return a @link{java.lang.String} instance representing
+ * the instance in textual form.
+ */
+ public String toString()
+ {
+ if (string == null)
+ string = getClass().getName()
+ + "[name=" + getTypeName()
+ + ", dimension=" + dimension
+ + ", elementType=" + elementType
+ + "]";
+ return string;
+ }
+
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/management/openmbean/CompositeData.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/management/openmbean/CompositeData.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/management/openmbean/CompositeData.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/management/openmbean/CompositeData.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,154 @@
+/* CompositeData.java -- A composite data structure.
+ Copyright (C) 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.management.openmbean;
+
+import java.util.Collection;
+
+/**
+ * Provides an interface to a composite data structure,
+ * in order to aid interoperability. The composite data
+ * structure is represented by mapping field names to
+ * values.
+ *
+ * @author Andrew John Hughes (gnu_andrew at member.fsf.org)
+ * @since 1.5
+ */
+public interface CompositeData
+{
+
+ /**
+ * Returns true if this {@link CompositeData} instance contains
+ * the specified key. This method always returns false for
+ * an input key equal to <code>null</code> or the empty string.
+ *
+ * @param key the key to find in the structure.
+ * @return true if the key exists.
+ */
+ boolean containsKey(String key);
+
+ /**
+ * Returns true if this {@link CompositeData} instance has
+ * a value equal to that supplied.
+ *
+ * @param value the value to look for.
+ * @return true if the value exists.
+ */
+ boolean containsValue(Object value);
+
+ /**
+ * Compares the specified object with this object for equality.
+ * The object is judged equivalent if it is non-null, and also
+ * an instance of {@link CompositeData} with the same name-value
+ * mappings and types. The two compared instances may be
+ * equivalent even if they represent different implementations of
+ * {@link CompositeData}.
+ *
+ * @param obj the object to compare for equality.
+ * @return true if <code>obj</code> is equal to <code>this</code>.
+ */
+ boolean equals(Object obj);
+
+ /**
+ * Retrieves the value for the specified key.
+ *
+ * @param key the key whose value should be returned.
+ * @return the matching value.
+ * @throws IllegalArgumentException if the key is <code>null</code>
+ * or the empty string.
+ * @throws InvalidKeyException if the key does not exist.
+ */
+ Object get(String key);
+
+ /**
+ * Returns the appropriate value for each key in the given array,
+ * using the same ordering.
+ *
+ * @param keys the keys whose values should be returned.
+ * @return the matching values.
+ * @throws IllegalArgumentException if one of the keys is
+ * <code>null</code> or the
+ * empty string.
+ * @throws InvalidKeyException if one of the keys does not exist.
+ */
+ Object[] getAll(String[] keys);
+
+ /**
+ * Returns the composite type which corresponds to this instance
+ * of {@link CompositeData}.
+ *
+ * @return the composite type for this instance.
+ */
+ CompositeType getCompositeType();
+
+ /**
+ * Returns the hash code of this instance. The hash code is
+ * computed as the sum of the hash codes of all the values plus
+ * the hash code of the composite type. As equality comparisons
+ * take place using this same information, this ensures that
+ * the property, <code>e1.equals(e2)</code> implies
+ * <code>e1.hashCode() == e2.hashCode(), holds for any pair
+ * of instances, <code>e1</code> and <code>e2</code>.
+ *
+ * @return the hash code of this {@link CompositeData}.
+ * @see Object#equals(Object)
+ */
+ int hashCode();
+
+ /**
+ * Returns a textual representation of this instance. The
+ * exact format is left up to the implementation, but it
+ * should contain the name of the implementing class,
+ * the name of the type and a mapping of the form
+ * <code>key=value</code> for each pair of key and value.
+ *
+ * @return a {@link java.lang.String} representation of the
+ * object.
+ */
+ String toString();
+
+ /**
+ * Returns a read-only collection of the values associated with
+ * this instance. The values are sorted using the lexicographic
+ * ordering of the corresponding keys.
+ *
+ * @return the values of this instance.
+ */
+ Collection values();
+
+}
+
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/management/openmbean/CompositeDataSupport.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/management/openmbean/CompositeDataSupport.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/management/openmbean/CompositeDataSupport.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/management/openmbean/CompositeDataSupport.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,349 @@
+/* CompositeData.java -- A composite data structure implementation.
+ Copyright (C) 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.management.openmbean;
+
+import java.io.Serializable;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+import java.util.SortedMap;
+import java.util.TreeMap;
+
+/**
+ * Provides an implementation of the {@link CompositeData}
+ * interface.
+ *
+ * @author Andrew John Hughes (gnu_andrew at member.fsf.org)
+ * @since 1.5
+ */
+public class CompositeDataSupport
+ implements CompositeData, Serializable
+{
+
+ /**
+ * Compatible with JDK 1.5
+ */
+ private static final long serialVersionUID = 8003518976613702244L;
+
+ /**
+ * Mapping of field names to values.
+ *
+ * @serial the map of field names to values.
+ */
+ private SortedMap contents;
+
+ /**
+ * The composite type which represents this composite data instance.
+ *
+ * @serial the type information for this instance.
+ */
+ private CompositeType compositeType;
+
+ /**
+ * Constructs a new {@link CompositeDataSupport} instance with the
+ * specified type using field names and values from the supplied map.
+ * The keys of the map become the field names, while the values
+ * become the values of each respective field. This constructor simply
+ * calls the other constructor, with the two arrays formed using the
+ * keys and values of this map, respectively. Thus, the input parameters
+ * given should conform to the same requirements given there (i.e. no
+ * null values or empty strings).
+ *
+ * @param type the composite type of this composite data structure.
+ * @param items a mapping of field names to values. This should match
+ * the mappings given by the type (i.e. for each mapping
+ * in the type, there should be a corresponding field name
+ * with a value of the correct type).
+ * @throws IllegalArgumentException if the type, the map or any of the keys
+ * or values in the map are <code>null</code>,
+ * or if any key from the map is an empty
+ * string.
+ * @throws OpenDataException if a mismatch occurs between the map and the
+ * field name/type specification given by the
+ * {@link CompositeType} instance. This may be
+ * due to the two having a different size, a
+ * mismatch between keys or an incorrectly typed
+ * value.
+ * @throws ArrayStoreException if one of the keys is not a
+ * {@link java.lang.String} (thus calling a failure
+ * in converting the keys to an array of strings).
+ */
+ public CompositeDataSupport(CompositeType type, Map items)
+ throws OpenDataException
+ {
+ this(type,
+ (String[]) items.keySet().toArray(new String[items.size()]),
+ items.values().toArray());
+ }
+
+ /**
+ * Constructs a new {@link CompositeDataSupport} instance with the
+ * specified type using the supplied arrays of field names and
+ * values. Neither the type, the two arrays or any elements of the
+ * arrays may be <code>null</code>. The {@link java.lang.String}s
+ * within the <code>names</code> array must be non-empty. The
+ * arrays must match in size and order, as each element of the
+ * <code>names</code> array is matched against the corresponding
+ * value in the <code>values</code> array. Internally, the two are
+ * stored in a map, lexographically ordered using the field names.
+ * The data given should also conform to the description of the
+ * instance given by the {@link CompositeType} instance supplied.
+ *
+ * @param type the composite type of this composite data structure.
+ * @param names the field names.
+ * @param values the corresponding values of the fields.
+ * @throws IllegalArgumentException if the type, the arrays or any of the keys
+ * or values in the arrays are <code>null</code>,
+ * or if any key from <code>names</code> is
+ * an empty string. This also occurs if the
+ * arrays differ in length.
+ * @throws OpenDataException if a mismatch occurs between the arrays and the
+ * field name/type specification given by the
+ * {@link CompositeType} instance. This may be
+ * due to a differing number of field names, a
+ * mismatch between names or an incorrectly typed
+ * value.
+ */
+ public CompositeDataSupport(CompositeType type, String[] names, Object[] values)
+ throws OpenDataException
+ {
+ if (type == null)
+ throw new IllegalArgumentException("The given composite type is null.");
+ compositeType = type;
+ if (names == null)
+ throw new IllegalArgumentException("The names array is null.");
+ if (values == null)
+ throw new IllegalArgumentException("The values array is null.");
+ if (names.length != values.length)
+ throw new IllegalArgumentException("The sizes of the arrays differ.");
+ Set typeKeys = type.keySet();
+ if (typeKeys.size() != names.length)
+ throw new OpenDataException("The number of field names does not match " +
+ "the type description.");
+ contents = new TreeMap();
+ for (int a = 0; a < names.length; ++a)
+ {
+ if (names[a] == null)
+ throw new IllegalArgumentException("Element " + a + " of the names " +
+ "array is null.");
+ if (names[a].length() == 0)
+ throw new IllegalArgumentException("Element " + a + " of the names " +
+ "array is an empty string.");
+ if (values[a] == null)
+ throw new IllegalArgumentException("Element " + a + " of the values " +
+ "array is null.");
+ if (!(typeKeys.contains(names[a])))
+ throw new OpenDataException("The name, " + names[a] + ", is not a " +
+ "field in the given type description.");
+ if (!(type.getType(names[a]).isValue(values[a])))
+ throw new OpenDataException("The value, " + values[a] + ", is not a " +
+ "valid value for the " + names[a] + " field.");
+ contents.put(names[a], values[a]);
+ }
+ }
+
+ /**
+ * Returns true if this {@link CompositeData} instance contains
+ * the specified key. This method always returns false for
+ * an input key equal to <code>null</code> or the empty string.
+ *
+ * @param key the key to find in the structure.
+ * @return true if the key exists.
+ */
+ public boolean containsKey(String key)
+ {
+ if (key == null || key.length() == 0)
+ return false;
+ else
+ return contents.containsKey(key);
+ }
+
+ /**
+ * Returns true if this {@link CompositeData} instance has
+ * a value equal to that supplied.
+ *
+ * @param value the value to look for.
+ * @return true if the value exists.
+ */
+ public boolean containsValue(Object value)
+ {
+ return contents.containsValue(value);
+ }
+
+
+ /**
+ * Compares the specified object with this object for equality.
+ * The object is judged equivalent if it is non-null, and also
+ * an instance of {@link CompositeData} with the same name-value
+ * mappings and types. The two compared instances may be
+ * equivalent even if they represent different implementations of
+ * {@link CompositeData}.
+ *
+ * @param obj the object to compare for equality.
+ * @return true if <code>obj</code> is equal to <code>this</code>.
+ */
+ public boolean equals(Object obj)
+ {
+ if (!(obj instanceof CompositeData))
+ return false;
+ CompositeData data = (CompositeData) obj;
+ if (!(data.getCompositeType().equals(compositeType)))
+ return false;
+ Iterator it = contents.keySet().iterator();
+ while (it.hasNext())
+ {
+ String key = (String) it.next();
+ if (!(data.containsKey(key)))
+ return false;
+ if (!(data.get(key).equals(contents.get(key))))
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * Retrieves the value for the specified key.
+ *
+ * @param key the key whose value should be returned.
+ * @return the matching value.
+ * @throws IllegalArgumentException if the key is <code>null</code>
+ * or the empty string.
+ * @throws InvalidKeyException if the key does not exist.
+ */
+ public Object get(String key)
+ {
+ if (key == null)
+ throw new IllegalArgumentException("The supplied key is null.");
+ if (key.length() == 0)
+ throw new IllegalArgumentException("The supplied key is the empty string.");
+ if (!(contents.containsKey(key)))
+ throw new InvalidKeyException("The supplied key does not exist.");
+ return contents.get(key);
+ }
+
+ /**
+ * Returns the appropriate value for each key in the given array,
+ * using the same ordering.
+ *
+ * @param keys the keys whose values should be returned.
+ * @return the matching values.
+ * @throws IllegalArgumentException if one of the keys is
+ * <code>null</code> or the
+ * empty string.
+ * @throws InvalidKeyException if one of the keys does not exist.
+ */
+ public Object[] getAll(String[] keys)
+ {
+ Object[] values = new Object[keys.length];
+ for (int a = 0; a < keys.length; ++a)
+ values[a] = get(keys[a]);
+ return values;
+ }
+
+
+ /**
+ * Returns the composite type which corresponds to this instance
+ * of {@link CompositeData}.
+ *
+ * @return the composite type for this instance.
+ */
+ public CompositeType getCompositeType()
+ {
+ return compositeType;
+ }
+
+ /**
+ * Returns the hash code of this instance. The hash code is
+ * computed as the sum of the hash codes of all the values plus
+ * the hash code of the composite type. As equality comparisons
+ * take place using this same information, this should ensure that
+ * the property, <code>e1.equals(e2)</code> implies
+ * <code>e1.hashCode() == e2.hashCode(), holds for any pair
+ * of instances, <code>e1</code> and <code>e2</code>. However,
+ * this relies on the other instance implementing the
+ * <code>hashCode</code> method correctly, if it is not an
+ * instance of {@link CompositeDataSupport}.
+ *
+ * @return the hash code of this {@link CompositeData}.
+ * @see Object#equals(Object)
+ */
+ public int hashCode()
+ {
+ int code = compositeType.hashCode();
+ Iterator it = values().iterator();
+ while (it.hasNext())
+ code += it.next().hashCode();
+ return code;
+ }
+
+
+ /**
+ * Returns a textual representation of this instance. The
+ * exact format is left up to the implementation, but it
+ * should contain the name of the implementing class,
+ * the name of the type and a mapping of the form
+ * <code>key=value</code> for each pair of key and value.
+ *
+ * @return a {@link java.lang.String} representation of the
+ * object.
+ */
+ public String toString()
+ {
+ return getClass().getName() +
+ "[compositeType=" + compositeType +
+ ",contents=" + contents +
+ "]";
+ }
+
+ /**
+ * Returns a read-only collection of the values associated with
+ * this instance. The values are sorted using the lexicographic
+ * ordering of the corresponding keys.
+ *
+ * @return the values of this instance.
+ */
+ public Collection values()
+ {
+ return Collections.unmodifiableCollection(contents.values());
+ }
+
+}
+
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/management/openmbean/CompositeType.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/management/openmbean/CompositeType.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/management/openmbean/CompositeType.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/management/openmbean/CompositeType.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,324 @@
+/* CompositeType.java -- Type descriptor for CompositeData instances.
+ Copyright (C) 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.management.openmbean;
+
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeMap;
+
+/**
+ * The open type descriptor for instances of the
+ * {@link CompositeData} class.
+ *
+ * @author Andrew John Hughes (gnu_andrew at member.fsf.org)
+ * @since 1.5
+ */
+public class CompositeType
+ extends OpenType
+{
+
+ /**
+ * Compatible with JDK 1.5
+ */
+ private static final long serialVersionUID = -5366242454346948798L;
+
+ /**
+ * A map of item names to their descriptions.
+ */
+ private TreeMap nameToDescription;
+
+ /**
+ * A map of item names to their types.
+ */
+ private TreeMap nameToType;
+
+ /**
+ * The hash code of this instance.
+ */
+ private transient Integer hashCode;
+
+ /**
+ * The <code>toString()</code> result of this instance.
+ */
+ private transient String string;
+
+ /**
+ * <p>
+ * Constructs a new {@link CompositeType} instance for the given
+ * type name with the specified field names, descriptions and types.
+ * All parameters, and the elements of the array parameters, must be
+ * non-null and {@link java.lang.String} values must be something other
+ * than the empty string. The arrays must be non-empty, and be of
+ * equal size.
+ * </p>
+ * <p>
+ * The result of <code>CompositeData.class.getName()</code> is adopted
+ * as the class name (see {@link OpenType}) and changes to the array
+ * elements following construction of the {@link CompositeType} instance
+ * will <strong>not</strong> affect the values used by the instance.
+ * The field names are sorted in to ascending alphanumeric order internally,
+ * and so ordering can not be used to differentiate between two instances.
+ * </p>
+ *
+ * @param name the name of this composite type.
+ * @param desc a description of this composite type.
+ * @param names the names of each field within the composite type.
+ * @param descs the descriptions of each field within the composite type.
+ * @param types the types of each field within the composite type.
+ * @throws IllegalArgumentException if any validity constraint listed above
+ * is broken.
+ * @throws OpenDataException if duplicate item names are provided. Item names
+ * are case-sensitive, but whitespace is removed
+ * before comparison.
+ */
+ public CompositeType(String name, String desc, String[] names,
+ String[] descs, OpenType[] types)
+ throws OpenDataException
+ {
+ super(CompositeData.class.getName(), name, desc);
+ if (names.length == 0
+ || names.length != descs.length
+ || names.length != types.length)
+ throw new IllegalArgumentException("Arrays must be non-empty " +
+ "and of equal size.");
+ nameToDescription = new TreeMap();
+ for (int a = 0; a < names.length; ++a)
+ {
+ if (names[a] == null)
+ throw new IllegalArgumentException("Name " + a + " is null.");
+ if (descs[a] == null)
+ throw new IllegalArgumentException("Description " + a +
+ " is null.");
+ String fieldName = names[a].trim();
+ if (fieldName.length() == 0)
+ throw new IllegalArgumentException("Name " + a + " is " +
+ "the empty string.");
+ if (descs[a].length() == 0)
+ throw new IllegalArgumentException("Description " + a + " is " +
+ "the empty string.");
+ if (nameToDescription.containsKey(fieldName))
+ throw new OpenDataException(fieldName + " appears more " +
+ "than once.");
+ nameToDescription.put(fieldName, descs[a]);
+ }
+ nameToType = new TreeMap();
+ for (int a = 0; a < names.length; ++a)
+ nameToType.put(names[a].trim(), types[a]);
+ }
+
+ /**
+ * Returns true if this composite data type has a field
+ * with the given name.
+ *
+ * @param name the name of the field to check for.
+ * @return true if a field of that name exists.
+ */
+ public boolean containsKey(String name)
+ {
+ return nameToDescription.containsKey(name);
+ }
+
+ /**
+ * <p>
+ * Compares this composite data type with another object
+ * for equality. The objects are judged to be equal if:
+ * </p>
+ * <ul>
+ * <li><code>obj</code> is not null.</li>
+ * <li><code>obj</code> is an instance of
+ * {@link CompositeType}.</li>
+ * <li>The type names are equal.</li>
+ * <li>The fields and their types match.</li>
+ * </ul>
+ *
+ * @param obj the object to compare with.
+ * @return true if the conditions above hold.
+ */
+ public boolean equals(Object obj)
+ {
+ if (!(obj instanceof CompositeType))
+ return false;
+ CompositeType ctype = (CompositeType) obj;
+ if (!(ctype.getTypeName().equals(getTypeName())))
+ return false;
+ Set keys = keySet();
+ if (!(ctype.keySet().equals(keys)))
+ return false;
+ Iterator it = keys.iterator();
+ while (it.hasNext())
+ {
+ String key = (String) it.next();
+ if (!(ctype.getType(key).equals(getType(key))))
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * Returns the description for the given field name,
+ * or <code>null</code> if the field name does not
+ * exist within this composite data type.
+ *
+ * @param name the name of the field whose description
+ * should be returned.
+ * @return the description, or <code>null</code> if the
+ * field doesn't exist.
+ */
+ public String getDescription(String name)
+ {
+ return (String) nameToDescription.get(name);
+ }
+
+ /**
+ * Returns the type for the given field name,
+ * or <code>null</code> if the field name does not
+ * exist within this composite data type.
+ *
+ * @param name the name of the field whose type
+ * should be returned.
+ * @return the type, or <code>null</code> if the
+ * field doesn't exist.
+ */
+ public OpenType getType(String name)
+ {
+ return (OpenType) nameToType.get(name);
+ }
+
+ /**
+ * <p>
+ * Returns the hash code of the composite data type.
+ * This is computed as the sum of the hash codes of
+ * each field name and its type, together with the hash
+ * code of the type name. These are the same elements
+ * of the type that are compared as part of the
+ * {@link #equals(java.lang.Object)} method, thus ensuring
+ * that the hashcode is compatible with the equality
+ * test.
+ * </p>
+ * <p>
+ * As instances of this class are immutable, the hash code
+ * is computed just once for each instance and reused
+ * throughout its life.
+ * </p>
+ *
+ * @return the hash code of this instance.
+ */
+ public int hashCode()
+ {
+ if (hashCode == null)
+ {
+ int elementTotal = 0;
+ Iterator it = nameToType.entrySet().iterator();
+ while (it.hasNext())
+ {
+ Map.Entry entry = (Map.Entry) it.next();
+ elementTotal += (entry.getKey().hashCode() +
+ entry.getValue().hashCode());
+ }
+ hashCode = Integer.valueOf(elementTotal
+ + getTypeName().hashCode());
+ }
+ return hashCode.intValue();
+ }
+
+ /**
+ * Returns true if the specified object is a member of this
+ * composite type. The object is judged to be so if it is
+ * an instance of {@link CompositeData} with an equivalent
+ * type, according to the definition of
+ * {@link #equals(java.lang.Object)} for {@link CompositeType}.
+ *
+ * @param obj the object to test for membership.
+ * @return true if the object is a member of this type.
+ */
+ public boolean isValue(Object obj)
+ {
+ if (obj instanceof CompositeData)
+ {
+ CompositeData data = (CompositeData) obj;
+ return equals(data.getCompositeType());
+ }
+ return false;
+ }
+
+ /**
+ * Returns an unmodifiable {@link java.util.Set}-based
+ * view of the field names that form part of this
+ * {@link CompositeType} instance. The names are stored
+ * in ascending alphanumeric order.
+ *
+ * @return a unmodifiable set containing the field
+ * name {@link java.lang.String}s.
+ */
+ public Set keySet()
+ {
+ return Collections.unmodifiableSet(nameToDescription.keySet());
+ }
+
+ /**
+ * <p>
+ * Returns a textual representation of this instance. This
+ * is constructed using the class name
+ * (<code>javax.management.openmbean.CompositeType</code>)
+ * and each element of the instance which is relevant to
+ * the definition of {@link equals(java.lang.Object)} and
+ * {@link hashCode()} (i.e. the type name, and the name
+ * and type of each field).
+ * </p>
+ * <p>
+ * As instances of this class are immutable, the return value
+ * is computed just once for each instance and reused
+ * throughout its life.
+ * </p>
+ *
+ * @return a @link{java.lang.String} instance representing
+ * the instance in textual form.
+ */
+ public String toString()
+ {
+ if (string == null)
+ string = getClass().getName()
+ + "[name=" + getTypeName()
+ + ", fields=" + nameToType
+ + "]";
+ return string;
+ }
+
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/management/openmbean/InvalidKeyException.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/management/openmbean/InvalidKeyException.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/management/openmbean/InvalidKeyException.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/management/openmbean/InvalidKeyException.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,77 @@
+/* InvalidKeyException.java -- Thrown by an invalid composite/tabular key.
+ Copyright (C) 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.management.openmbean;
+
+/**
+ * Thrown when an invalid key (a field name or row index) is
+ * passed to a method of the {@link CompositeData} or
+ * {@link TabularData} classes.
+ *
+ * @author Andrew John Hughes (gnu_andrew at member.fsf.org)
+ * @since 1.5
+ */
+public class InvalidKeyException
+ extends IllegalArgumentException
+{
+
+ /**
+ * Compatible with JDK 1.5
+ */
+ private static final long serialVersionUID = 4224269443946322062L;
+
+ /**
+ * Constructs a new <code>InvalidKeyException</code>.
+ */
+ public InvalidKeyException()
+ {
+ super();
+ }
+
+ /**
+ * Constructs a new <code>InvalidKeyException</code>
+ * with the specified message.
+ *
+ * @param message the error message to give to the user.
+ */
+ public InvalidKeyException(String message)
+ {
+ super(message);
+ }
+
+}
+
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/management/openmbean/OpenDataException.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/management/openmbean/OpenDataException.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/management/openmbean/OpenDataException.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/management/openmbean/OpenDataException.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,79 @@
+/* OpenDataException.java -- Thrown by invalid open bean data.
+ Copyright (C) 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.management.openmbean;
+
+import javax.management.JMException;
+
+/**
+ * Thrown when an instance of one of the open types, open
+ * data objects or open metadata information objects could
+ * not be created due to invalid construction parameters.
+ *
+ * @author Andrew John Hughes (gnu_andrew at member.fsf.org)
+ * @since 1.5
+ */
+public class OpenDataException
+ extends JMException
+{
+
+ /**
+ * Compatible with JDK 1.5
+ */
+ private static final long serialVersionUID = 8346311255433349870L;
+
+ /**
+ * Constructs a new <code>OpenDataException</code>.
+ */
+ public OpenDataException()
+ {
+ super();
+ }
+
+ /**
+ * Constructs a new <code>OpenDataException</code>
+ * with the specified message.
+ *
+ * @param message the error message to give to the user.
+ */
+ public OpenDataException(String message)
+ {
+ super(message);
+ }
+
+}
+
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/management/openmbean/OpenType.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/management/openmbean/OpenType.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/management/openmbean/OpenType.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/management/openmbean/OpenType.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,230 @@
+/* OpenType.java -- Superclass of all open types.
+ Copyright (C) 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.management.openmbean;
+
+import java.io.Serializable;
+
+/**
+ * The superclass of all open types, which describe the
+ * applicable data values for open MBeans. An open type
+ * is defined by its name and description, and the name
+ * of the Java class it maps to.
+ *
+ * @author Andrew John Hughes (gnu_andrew at member.fsf.org)
+ * @since 1.5
+ */
+public abstract class OpenType
+ implements Serializable
+{
+
+ /**
+ * Compatible with JDK 1.5
+ */
+ private static final long serialVersionUID = -9195195325186646468L;
+
+ /**
+ * The name of the Java class this type represents.
+ */
+ private String className;
+
+ /**
+ * The name of this type.
+ */
+ private String typeName;
+
+ /**
+ * A description of this type.
+ */
+ private String description;
+
+ /**
+ * An array which defines the set of Java types which can be
+ * used as open types. Note that each type is also available
+ * in array form, possibly with multiple dimensions.
+ */
+ public static final String[] ALLOWED_CLASSNAMES = {
+ "java.lang.Void",
+ "java.lang.Boolean",
+ "java.lang.Character",
+ "java.lang.Byte",
+ "java.lang.Short",
+ "java.lang.Integer",
+ "java.lang.Long",
+ "java.lang.Float",
+ "java.lang.Double",
+ "java.lang.String",
+ "java.math.BigDecimal",
+ "java.math.BigInteger",
+ "java.util.Date",
+ "javax.management.ObjectName",
+ CompositeData.class.getName(),
+ TabularData.class.getName()
+ };
+
+ /**
+ * Constructs a new {@link OpenType} for the specified class
+ * with the given name and description. The name of the class
+ * must be taken from the list of {@link ALLOWED_CLASSNAMES}.
+ * Arrays are implictly included in this, and follow the usual
+ * syntax of {@link java.lang.Class#getName()} with the name
+ * preceded by n instances of '[' (where n is the number of
+ * dimensions) and an L. The name and description can not be
+ * <code>null</code> or the empty string.
+ *
+ * @param className the name of the Java class this type
+ * represents.
+ * @param name the name of the type.
+ * @param desc the description of the type.
+ * @throws IllegalArgumentException if either of <code>name</code>
+ * or <code>desc</code> are
+ * <code>null</code> or the empty
+ * string.
+ * @throws OpenDataException if the class name does not reference
+ * a listed class (from @{link ALLOWED_CLASSNAMES})
+ */
+ protected OpenType(String className, String name, String desc)
+ throws OpenDataException
+ {
+ if (name == null || name.equals(""))
+ throw new IllegalArgumentException("The name can not be null " +
+ "or the empty string.");
+ if (desc == null || desc.equals(""))
+ throw new IllegalArgumentException("The description can not " +
+ "be null or the empty string.");
+ String testString;
+ if (className.startsWith("["))
+ testString = className.substring(className.indexOf("L") + 1);
+ else
+ testString = className;
+ boolean openTypeFound = false;
+ for (int a = 0; a < ALLOWED_CLASSNAMES.length; ++a)
+ if (ALLOWED_CLASSNAMES[a].equals(className))
+ openTypeFound = true;
+ if (!openTypeFound)
+ throw new OpenDataException("The class name does not specify " +
+ "a valid open type.");
+ this.className = className;
+ typeName = name;
+ description = desc;
+ }
+
+ /**
+ * Performs an equality test on this object and the one specified.
+ *
+ * @param obj the object to test against this one.
+ * @return true if the two objects are equivalent.
+ * @see java.lang.Object#hashCode()
+ */
+ public abstract boolean equals(Object obj);
+
+ /**
+ * Returns the name of the Java class this type represents. This must
+ * be one of the {@link ALLOWED_CLASSNAMES} or an array of one of them.
+ * The specification of arrays follows the standard set by
+ * {@link java.lang.Class#getName()} i.e. the name is the class name
+ * preceded by n instances of '[' and an 'L', where n is number of
+ * dimensions used by the array.
+ *
+ * @return the class name.
+ */
+ public String getClassName()
+ {
+ return className;
+ }
+
+ /**
+ * Returns a description of this open type.
+ *
+ * @return the description.
+ */
+ public String getDescription()
+ {
+ return description;
+ }
+
+ /**
+ * Returns the name of this open type.
+ *
+ * @return the type name.
+ */
+ public String getTypeName()
+ {
+ return typeName;
+ }
+
+ /**
+ * Returns a hash code for this open type. The hash code
+ * should be consistent with the {@link equals()} method.
+ * Thus, it should continue to return the same value while
+ * the values used by the {@link equals()} method remain
+ * the same, and should return different hash codes for
+ * objects which are judged to be different using the
+ * {@link equals()} method.
+ *
+ * @return the hash code of this instance.
+ */
+ public abstract int hashCode();
+
+ /**
+ * Returns true if this open type represents an array type.
+ *
+ * @return true if this open type represents an array type.
+ */
+ public boolean isArray()
+ {
+ return className.startsWith("[");
+ }
+
+ /**
+ * Returns true if the specified object is a member of this
+ * type.
+ *
+ * @param obj the object to test for membership.
+ * @return true if the object is a member of this type.
+ */
+ public abstract boolean isValue(Object obj);
+
+ /**
+ * Returns a textual representation of this type.
+ *
+ * @return a {@link java.lang.String} representation of this
+ * type.
+ */
+ public abstract String toString();
+
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/management/openmbean/SimpleType.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/management/openmbean/SimpleType.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/management/openmbean/SimpleType.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/management/openmbean/SimpleType.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,342 @@
+/* SimpleType.java -- Open type descriptor for the base types.
+ Copyright (C) 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.management.openmbean;
+
+import java.io.InvalidObjectException;
+import java.io.ObjectStreamException;
+
+/**
+ * The open type descriptor for data values that are members
+ * of one of the simple types (such as an integer or a string).
+ * The other open types ({@link ArrayType}, {@link CompositeType},
+ * {@link TabularType}) are constructed from one or more of these
+ * types. The simple types are formed from a small subset of
+ * basic Java types. As a result, the valid instances of this
+ * class are predefined, and no constructor is given for creating
+ * new instances.
+ *
+ * @author Andrew John Hughes (gnu_andrew at member.fsf.org)
+ * @since 1.5
+ */
+public class SimpleType
+ extends OpenType
+{
+
+ /**
+ * The {@link SimpleType} representation of
+ * <code>java.math.BigDecimal</code>.
+ */
+ public static final SimpleType BIGDECIMAL;
+
+ /**
+ * The {@link SimpleType} representation of
+ * <code>java.math.BigInteger</code>.
+ */
+ public static final SimpleType BIGINTEGER;
+
+ /**
+ * The {@link SimpleType} representation of
+ * <code>java.lang.Boolean</code>.
+ */
+ public static final SimpleType BOOLEAN;
+
+ /**
+ * The {@link SimpleType} representation of
+ * <code>java.lang.Byte</code>.
+ */
+ public static final SimpleType BYTE;
+
+ /**
+ * The {@link SimpleType} representation of
+ * <code>java.lang.Character</code>.
+ */
+ public static final SimpleType CHARACTER;
+
+ /**
+ * The {@link SimpleType} representation of
+ * <code>java.util.Date</code>.
+ */
+ public static final SimpleType DATE;
+
+ /**
+ * The {@link SimpleType} representation of
+ * <code>java.lang.Double</code>.
+ */
+ public static final SimpleType DOUBLE;
+
+ /**
+ * The {@link SimpleType} representation of
+ * <code>java.lang.Float</code>.
+ */
+ public static final SimpleType FLOAT;
+
+ /**
+ * The {@link SimpleType} representation of
+ * <code>java.lang.Integer</code>.
+ */
+ public static final SimpleType INTEGER;
+
+ /**
+ * The {@link SimpleType} representation of
+ * <code>java.lang.Long</code>.
+ */
+ public static final SimpleType LONG;
+
+ /**
+ * The {@link SimpleType} representation of
+ * <code>javax.management.ObjectName</code>.
+ */
+ public static final SimpleType OBJECTNAME;
+
+
+ /**
+ * The {@link SimpleType} representation of
+ * <code>java.lang.Short</code>.
+ */
+ public static final SimpleType SHORT;
+
+ /**
+ * The {@link SimpleType} representation of
+ * <code>java.lang.String</code>.
+ */
+ public static final SimpleType STRING;
+
+ /**
+ * The {@link SimpleType} representation of
+ * <code>java.lang.Void</code>.
+ */
+ public static final SimpleType VOID;
+
+ /**
+ * Compatible with JDK 1.5
+ */
+ private static final long serialVersionUID = 2215577471957694503L;
+
+ /**
+ * The hash code of this instance.
+ */
+ private transient Integer hashCode;
+
+ /**
+ * The <code>toString()</code> result of this instance.
+ */
+ private transient String string;
+
+ /**
+ * Static construction of the {@link SimpleType} instances.
+ */
+ static
+ {
+ try
+ {
+ BIGDECIMAL = new SimpleType("java.math.BigDecimal");
+ BIGINTEGER = new SimpleType("java.math.BigInteger");
+ BOOLEAN = new SimpleType("java.lang.Boolean");
+ BYTE = new SimpleType("java.lang.Byte");
+ CHARACTER = new SimpleType("java.lang.Character");
+ DATE = new SimpleType("java.util.Date");
+ DOUBLE = new SimpleType("java.lang.Double");
+ FLOAT = new SimpleType("java.lang.Float");
+ INTEGER = new SimpleType("java.lang.Integer");
+ LONG = new SimpleType("java.lang.Long");
+ OBJECTNAME = new SimpleType("javax.management.ObjectName");
+ SHORT = new SimpleType("java.lang.Short");
+ STRING = new SimpleType("java.lang.String");
+ VOID = new SimpleType("java.lang.Void");
+ }
+ catch (OpenDataException e)
+ {
+ /* In normal circumstances, this shouldn't be possible. */
+ throw new IllegalStateException("A invalid class name " +
+ "was passed to the SimpleType " +
+ "constructor.");
+ }
+ }
+
+ /**
+ * Constructs a new {@link SimpleType} instance for the given
+ * class name. The class name is also used as the type name
+ * and description of the {@link OpenType} instance.
+ *
+ * @param name the name of the class this instance should
+ * represent.
+ * @throws OpenDataException if somehow the constructor of the
+ * superclass is passed an invalid
+ * class name.
+ */
+ private SimpleType(String name)
+ throws OpenDataException
+ {
+ super(name, name, name);
+ }
+
+ /**
+ * <p>
+ * Compares this simple data type with another object
+ * for equality. The objects are judged to be equal if:
+ * </p>
+ * <ul>
+ * <li><code>obj</code> is not null.</li>
+ * <li><code>obj</code> is an instance of
+ * {@link SimpleType}.</li>
+ * <li>The class names are equal.</li>
+ * </ul>
+ *
+ * @param obj the object to compare with.
+ * @return true if the conditions above hold.
+ */
+ public boolean equals(Object obj)
+ {
+ if (!(obj instanceof SimpleType))
+ return false;
+ SimpleType sType = (SimpleType) obj;
+ return sType.getClassName().equals(getClassName());
+ }
+
+ /**
+ * <p>
+ * Returns the hash code of the simple data type.
+ * This is simply the hash code of the class name,
+ * which is the same element of the type compared
+ * as part of the
+ * {@link #equals(java.lang.Object)} method, thus ensuring
+ * that the hashcode is compatible with the equality
+ * test.
+ * </p>
+ * <p>
+ * As instances of this class are immutable, the hash code
+ * is computed just once for each instance and reused
+ * throughout its life.
+ * </p>
+ *
+ * @return the hash code of this instance.
+ */
+ public int hashCode()
+ {
+ if (hashCode == null)
+ hashCode = Integer.valueOf(getClassName().hashCode());
+ return hashCode.intValue();
+ }
+
+ /**
+ * Returns true if the specified object is a member of this
+ * simple type. The object is judged to be so if it is
+ * non-null and its class name is the same as that returned
+ * by {@link SimpleType#getClassName()}.
+ *
+ * @param obj the object to test for membership.
+ * @return true if the object is a member of this type.
+ */
+ public boolean isValue(Object obj)
+ {
+ if (obj == null)
+ return false;
+ return obj.getClass().getName().equals(getClassName());
+ }
+
+ /**
+ * Replaces instances of this class read from an
+ * {@link java.io.ObjectInputStream} with one of the predefined
+ * values. This ensures that each existing instance of
+ * this class is one of these unique instances.
+ *
+ * @return the replacement object.
+ * @throws ObjectStreamException if the object can not be
+ * resolved.
+ */
+ public Object readResolve()
+ throws ObjectStreamException
+ {
+ if (equals(BIGDECIMAL))
+ return BIGDECIMAL;
+ if (equals(BIGINTEGER))
+ return BIGINTEGER;
+ if (equals(BOOLEAN))
+ return BOOLEAN;
+ if (equals(BYTE))
+ return BYTE;
+ if (equals(CHARACTER))
+ return CHARACTER;
+ if (equals(DATE))
+ return DATE;
+ if (equals(DOUBLE))
+ return DOUBLE;
+ if (equals(FLOAT))
+ return FLOAT;
+ if (equals(INTEGER))
+ return INTEGER;
+ if (equals(LONG))
+ return LONG;
+ if (equals(OBJECTNAME))
+ return OBJECTNAME;
+ if (equals(SHORT))
+ return SHORT;
+ if (equals(STRING))
+ return STRING;
+ if (equals(VOID))
+ return VOID;
+ throw new InvalidObjectException("Invalid simple type instance " +
+ "deserialized.");
+ }
+
+ /**
+ * <p>
+ * Returns a textual representation of this instance. This
+ * is constructed using the class name
+ * (<code>javax.management.openmbean.SimpleType</code>)
+ * and the name of the class the type represents.
+ * </p>
+ * <p>
+ * As instances of this class are immutable, the return value
+ * is computed just once for each instance and reused
+ * throughout its life.
+ * </p>
+ *
+ * @return a @link{java.lang.String} instance representing
+ * the instance in textual form.
+ */
+ public String toString()
+ {
+ if (string == null)
+ string = getClass().getName()
+ + "[name=" + getClassName()
+ + "]";
+ return string;
+ }
+
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/management/openmbean/TabularData.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/management/openmbean/TabularData.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/management/openmbean/TabularData.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/management/openmbean/TabularData.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,258 @@
+/* TabularData.java -- Tables of composite data structures.
+ Copyright (C) 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.management.openmbean;
+
+import java.util.Collection;
+import java.util.Set;
+
+/**
+ * Provides an interface to a specific type of composite
+ * data structure, where keys (the columns) map to the
+ * {@link CompositeData} objects that form the rows of
+ * the table.
+ *
+ * @author Andrew John Hughes (gnu_andrew at member.fsf.org)
+ * @since 1.5
+ */
+public interface TabularData
+{
+
+ /**
+ * Calculates the index the specified {@link CompositeData} value
+ * would have, if it was to be added to this {@link TabularData}
+ * instance. This method includes a check that the type of
+ * the given value is the same as the row type of this instance,
+ * but not a check for existing instances of the given value.
+ * The value must also not be <code>null</code>. Possible indices
+ * are returned by the {@link TabularType#getIndexNames()} method
+ * of this instance's tabular type.
+ *
+ * @param val the {@link CompositeData} value whose index should
+ * be calculated.
+ * @return the index the value would take on, if it were to be added.
+ * @throws NullPointerException if the value is <code>null</code>.
+ * @throws InvalidOpenTypeException if the value does not match the
+ * row type of this instance.
+ */
+ Object[] calculateIndex(CompositeData val);
+
+ /**
+ * Removes all {@link CompositeData} values from the table.
+ */
+ void clear();
+
+ /**
+ * Returns true iff this instance of the {@link TabularData} class
+ * contains a {@link CompositeData} value at the specified index.
+ * In any other circumstance, including if the given key
+ * is <code>null</code> or of the incorrect type, according to
+ * the {@link TabularType} of this instance, this method returns
+ * false.
+ *
+ * @param key the key to test for.
+ * @return true if the key maps to a {@link CompositeData} value.
+ */
+ boolean containsKey(Object[] key);
+
+ /**
+ * Returns true iff this instance of the {@link TabularData} class
+ * contains the specified {@link CompositeData} value.
+ * In any other circumstance, including if the given value
+ * is <code>null</code> or of the incorrect type, according to
+ * the {@link TabularType} of this instance, this method returns
+ * false.
+ *
+ * @param val the value to test for.
+ * @return true if the value exists.
+ */
+ boolean containsValue(CompositeData val);
+
+ /**
+ * Compares the specified object with this object for equality.
+ * The object is judged equivalent if it is non-null, and also
+ * an instance of {@link TabularData} with the same row type,
+ * and index to value mappings. The two compared instances may
+ * be equivalent even if they represent different implementations
+ * of {@link TabularData}.
+ *
+ * @param obj the object to compare for equality.
+ * @return true if <code>obj</code> is equal to <code>this</code>.
+ */
+ boolean equals(Object obj);
+
+ /**
+ * Retrieves the {@link CompositeData} value for the specified
+ * key, or <code>null</code> if no such mapping exists.
+ *
+ * @param key the key whose value should be returned.
+ * @return the matching {@link CompositeData} value, or
+ * <code>null</code> if one does not exist.
+ * @throws NullPointerException if the key is <code>null</code>.
+ * @throws InvalidOpenTypeException if the key does not match
+ * the {@link TabularType} of this
+ * instance.
+ */
+ CompositeData get(Object[] key);
+
+ /**
+ * Returns the tabular type which corresponds to this instance
+ * of {@link TabularData}.
+ *
+ * @return the tabular type for this instance.
+ */
+ TabularType getTabularType();
+
+ /**
+ * Returns the hash code of the composite data type.
+ * This is computed as the sum of the hash codes of the
+ * each index and its value, together with the hash
+ * code of the tabular type. These are the same elements
+ * of the type that are compared as part of the
+ * {@link #equals(java.lang.Object)} method, thus ensuring
+ * that the hashcode is compatible with the equality
+ * test.
+ *
+ * @return the hash code of this instance.
+ */
+ int hashCode();
+
+ /**
+ * Returns true if this {@link TabularData} instance
+ * contains no {@link CompositeData} values.
+ *
+ * @return true if the instance is devoid of rows.
+ */
+ boolean isEmpty();
+
+ /**
+ * Returns a {@link java.util.Set} view of the keys or
+ * indices of this {@link TabularData} instance.
+ *
+ * @return a set containing the keys of this instance.
+ */
+ Set keySet();
+
+ /**
+ * Adds the specified {@link CompositeData} value to the
+ * table. The value must be non-null, of the same type
+ * as the row type of this instance, and must not have
+ * the same index as an existing value. The index is
+ * calculated using the index names of the
+ * {@link TabularType} for this instance.
+ *
+ * @param val the {@link CompositeData} value to add.
+ * @throws NullPointerException if <code>val</code> is
+ * <code>null</code>.
+ * @throws InvalidOpenTypeException if the type of the
+ * given value does not
+ * match the row type.
+ * @throws KeyAlreadyExistsException if the value has the
+ * same calculated index
+ * as an existing value.
+ */
+ void put(CompositeData val);
+
+ /**
+ * Adds each of the specified {@link CompositeData} values
+ * to the table. Each element of the array must meet the
+ * conditions given for the {@link #put(CompositeData)}
+ * method. In addition, the index of each value in the
+ * array must be distinct from the index of the other
+ * values in the array, as well as from the existing values
+ * in the table. The operation should be atomic; if one
+ * value can not be added, then none of the values should
+ * be.
+ *
+ * @param vals the {@link CompositeData} values to add.
+ * @throws NullPointerException if <code>val</code> is
+ * <code>null</code>.
+ * @throws InvalidOpenTypeException if the type of the
+ * given value does not
+ * match the row type.
+ * @throws KeyAlreadyExistsException if the value has the
+ * same calculated index
+ * as an existing value or
+ * of one of the other
+ * specified values.
+ */
+ void putAll(CompositeData[] vals);
+
+ /**
+ * Removes the {@link CompositeData} value located at the
+ * specified index. <code>null</code> is returned if the
+ * value does not exist. Otherwise, the removed value is
+ * returned.
+ *
+ * @param key the key of the value to remove.
+ * @return the removed value, or <code>null</code> if
+ * there is no value for the given key.
+ * @throws NullPointerException if the key is <code>null</code>.
+ * @throws InvalidOpenTypeException if the key does not match
+ * the {@link TabularType} of this
+ * instance.
+ */
+ CompositeData remove(Object[] key);
+
+ /**
+ * Returns the number of {@link CompositeData} values or rows
+ * in the table.
+ *
+ * @return the number of rows in the table.
+ */
+ int size();
+
+ /**
+ * Returns a textual representation of this instance. The
+ * exact format is left up to the implementation, but it
+ * should contain the name of the implementing class and
+ * the tabular type.
+ *
+ * @return a {@link java.lang.String} representation of the
+ * object.
+ */
+ String toString();
+
+ /**
+ * Returns the values associated with this instance.
+ *
+ * @return the values of this instance.
+ */
+ Collection values();
+
+}
+
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/management/openmbean/TabularType.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/management/openmbean/TabularType.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/management/openmbean/TabularType.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/management/openmbean/TabularType.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,269 @@
+/* TabularType.java -- Type descriptor for TabularData instances.
+ Copyright (C) 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.management.openmbean;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * The open type descriptor for instances of the
+ * {@link TabularData} class.
+ *
+ * @author Andrew John Hughes (gnu_andrew at member.fsf.org)
+ * @since 1.5
+ */
+public class TabularType
+ extends OpenType
+{
+
+ /**
+ * Compatible with JDK 1.5
+ */
+ private static final long serialVersionUID = 6554071860220659261L;
+
+ /**
+ * The composite type used by the rows of the table.
+ */
+ private CompositeType rowType;
+
+ /**
+ * The list of index names, which form the columns of the table.
+ * They are retained in the order given by the user, and is
+ * unmodifiable.
+ */
+ private List indexNames;
+
+ /**
+ * The hash code of this instance.
+ */
+ private transient Integer hashCode;
+
+ /**
+ * The <code>toString()</code> result of this instance.
+ */
+ private transient String string;
+
+ /**
+ * <p>
+ * Constructs a new {@link TabularType} instance for the given
+ * type name, description, row type and index names. All parameters
+ * (including the individual elements of the array of index names)
+ * must be non-null and those that are of type {@link java.lang.String}
+ * must be non-empty. The array of index names must also be non-empty.
+ * </p>
+ * <p>
+ * The result of <code>TabularData.class.getName()</code> is adopted
+ * as the class name (see {@link OpenType}). The ordering of the array
+ * elements is relevant in determining the indicies of the values in the
+ * table, and thus in the use of the
+ * {@link TabularData#get(java.lang.Object[])} and
+ * {@link TabularData#remove(java.lang.Object[])} methods of the
+ * {@link TabularData} class.
+ * </p>
+ *
+ * @param name the name of this tabular type.
+ * @param desc a description of this tabular type.
+ * @param rowType the type of the rows of the table.
+ * @param indexNames the names used to index the rows within the table.
+ * @throws IllegalArgumentException if any validity constraint listed above
+ * is broken.
+ * @throws OpenDataException if an index name does not match a corresponding
+ * name in the given row type.
+ */
+ public TabularType(String name, String desc, CompositeType rowType,
+ String[] indexNames)
+ throws OpenDataException
+ {
+ super(TabularData.class.getName(), name, desc);
+ if (rowType == null)
+ throw new IllegalArgumentException("A null row type was given.");
+ for (int a = 0; a < indexNames.length; ++a)
+ {
+ if (indexNames[a] == null)
+ throw new IllegalArgumentException("Name " + a +
+ " is null.");
+ if (indexNames[a].length() == 0)
+ throw new IllegalArgumentException("Name " + a +
+ " is the empty string.");
+ if (!(rowType.containsKey(indexNames[a])))
+ throw new OpenDataException("No matching key for " +
+ indexNames[a] + " was found in " +
+ "the supplied row type.");
+ }
+ this.rowType = rowType;
+ this.indexNames = Collections.unmodifiableList(Arrays.asList(indexNames));
+ }
+
+ /**
+ * <p>
+ * Compares this tabular data type with another object
+ * for equality. The objects are judged to be equal if:
+ * </p>
+ * <ul>
+ * <li><code>obj</code> is not null.</li>
+ * <li><code>obj</code> is an instance of
+ * {@link TabularType}.</li>
+ * <li>The type names are equal.</li>
+ * <li>The row types are equal.</li>
+ * <li>The index names are equal and in the same order.</li>
+ * </ul>
+ *
+ * @param obj the object to compare with.
+ * @return true if the conditions above hold.
+ */
+ public boolean equals(Object obj)
+ {
+ if (!(obj instanceof TabularType))
+ return false;
+ TabularType ttype = (TabularType) obj;
+ return (ttype.getTypeName().equals(getTypeName())
+ && (ttype.getRowType().equals(getRowType()))
+ && (ttype.getIndexNames().equals(getIndexNames())));
+ }
+
+ /**
+ * Returns an unmodifiable list containing the index names.
+ * The ordering of these names is used to determine the indicies
+ * of the {@link CompositeData} values, and is retained from that
+ * used in the call to this object's constructor.
+ *
+ * @return an unmodifiable list of the index names used by this
+ * tabular data structure.
+ */
+ public List getIndexNames()
+ {
+ return indexNames;
+ }
+
+ /**
+ * Returns the type of the rows used by this tabular data structure.
+ *
+ * @return the row type.
+ */
+ public CompositeType getRowType()
+ {
+ return rowType;
+ }
+
+ /**
+ * <p>
+ * Returns the hash code of the tabular data type.
+ * This is computed as the sum of the hash codes of the
+ * index names together with the hash code of the type
+ * name and row type. These are the same elements
+ * of the type that are compared as part of the
+ * {@link #equals(java.lang.Object)} method, thus ensuring
+ * that the hashcode is compatible with the equality
+ * test.
+ * </p>
+ * <p>
+ * As instances of this class are immutable, the hash code
+ * is computed just once for each instance and reused
+ * throughout its life.
+ * </p>
+ *
+ * @return the hash code of this instance.
+ */
+ public int hashCode()
+ {
+ if (hashCode == null)
+ {
+ int elementTotal = 0;
+ Iterator it = indexNames.iterator();
+ while (it.hasNext())
+ elementTotal += it.next().hashCode();
+ hashCode = Integer.valueOf(elementTotal
+ + getTypeName().hashCode()
+ + rowType.hashCode());
+ }
+ return hashCode.intValue();
+ }
+
+ /**
+ * Returns true if the specified object is a member of this
+ * tabular type. The object is judged to be so if it is
+ * an instance of {@link TabularData} with an equivalent
+ * type, according to the definition of
+ * {@link #equals(java.lang.Object)} for {@link TabularType}.
+ *
+ * @param obj the object to test for membership.
+ * @return true if the object is a member of this type.
+ */
+ public boolean isValue(Object obj)
+ {
+ if (obj instanceof TabularData)
+ {
+ TabularData data = (TabularData) obj;
+ return equals(data.getTabularType());
+ }
+ return false;
+ }
+
+ /**
+ * <p>
+ * Returns a textual representation of this instance. This
+ * is constructed using the class name
+ * (<code>javax.management.openmbean.TabularType</code>)
+ * and each element of the instance which is relevant to
+ * the definition of {@link equals(java.lang.Object)} and
+ * {@link hashCode()} (i.e. the type name, the row type
+ * and the index names).
+ * </p>
+ * <p>
+ * As instances of this class are immutable, the return value
+ * is computed just once for each instance and reused
+ * throughout its life.
+ * </p>
+ *
+ * @return a @link{java.lang.String} instance representing
+ * the instance in textual form.
+ */
+ public String toString()
+ {
+ if (string == null)
+ string = getClass().getName()
+ + "[name=" + getTypeName()
+ + ", rowType=" + rowType
+ + ", indexNames=" + indexNames
+ + "]";
+ return string;
+ }
+
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/management/openmbean/package.html
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/management/openmbean/package.html?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/management/openmbean/package.html (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/management/openmbean/package.html Thu Nov 8 16:56:19 2007
@@ -0,0 +1,64 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<!-- package.html - describes classes in java.lang.management package.
+ Copyright (C) 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. -->
+
+<html>
+<head><title>GNU Classpath - javax.management.openmbean</title></head>
+
+<body>
+
+<p>
+Provides the data types and descriptor classes for the
+<emph>Open MBean</emph>s. Open MBeans are provided in
+order to aid interoperability with non-Java management
+systems. Unlike normal MBeans, which make use of any
+Java data type, Open MBeans use a restricted set of types
+which can then be mapped over remote connections, including
+to non-Java systems.
+</p>
+<p>
+Normal MBeans are described using an instance of
+{@link javax.management.MBeanInfo} with appropriate representations
+of the attributes, constructors and operators associated with
+the bean. Open MBeans are described in the same way, but by
+using subtypes of these entities, which type the bean data using
+instances of {@link javax.management.openmbean.OpenType}. Open
+types differ from Java types, and are explicitly specified in order
+to obtain interoperability with other systems.
+</p>
+</body>
+</html>
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/AuthenticationException.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/AuthenticationException.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/AuthenticationException.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/AuthenticationException.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,55 @@
+/* AuthenticationException.java --
+ Copyright (C) 2000, 2004, 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.naming;
+
+
+public class AuthenticationException extends NamingSecurityException
+{
+ private static final long serialVersionUID = 3678497619904568096L;
+
+ public AuthenticationException ()
+ {
+ super ();
+ }
+
+ public AuthenticationException (String msg)
+ {
+ super (msg);
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/AuthenticationNotSupportedException.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/AuthenticationNotSupportedException.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/AuthenticationNotSupportedException.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/AuthenticationNotSupportedException.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,56 @@
+/* AuthenticationNotSupportedException.java --
+ Copyright (C) 2000, 2004, 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.naming;
+
+
+public class AuthenticationNotSupportedException
+ extends NamingSecurityException
+{
+ private static final long serialVersionUID = - 7149033933259492300L;
+
+ public AuthenticationNotSupportedException ()
+ {
+ super ();
+ }
+
+ public AuthenticationNotSupportedException (String msg)
+ {
+ super (msg);
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/BinaryRefAddr.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/BinaryRefAddr.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/BinaryRefAddr.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/BinaryRefAddr.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,156 @@
+/* BinaryRefAddr.java -- RefAddr that uses a byte array as content.
+ Copyright (C) 2001 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.naming;
+
+import java.util.Arrays;
+
+/**
+ * RefAddr that uses a byte array as content.
+ * This can be used to reference objects that can only be represented as
+ * byte arrays.
+ *
+ * @see Reference
+ * @since 1.3
+ * @author Mark Wielaard (mark at klomp.org)
+ */
+public class BinaryRefAddr extends RefAddr
+{
+ static final long serialVersionUID = -3415254970957330361L;
+
+ /**
+ * The possibly null content of this RefAddr.
+ * Set by the constructor and returned by getContent.
+ */
+ private final byte[] buf;
+
+ /**
+ * Contructs a new BinaryRefAddr with the given type and content.
+ * The complete content of the byte array is copied to a new array.
+ */
+ public BinaryRefAddr (String addrType, byte[] buf)
+ {
+ this(addrType, buf, 0, buf.length);
+ }
+
+ /**
+ * Contructs a new BinaryRefAddr with the given type and the content
+ * taken from the given byte array.
+ * The content of the byte array is copied to a new array.
+ */
+ public BinaryRefAddr (String addrType, byte[] buf, int off, int length)
+ {
+ super(addrType);
+ this.buf = new byte[length];
+ System.arraycopy(buf, off, this.buf, 0, length);
+ }
+
+ /**
+ * Returns the byte array contents as given to the constructor.
+ * The returned byte array is shared with this object and other callers.
+ * Changing the content of the buffer is discouraged and should only be
+ * done when the byte array is locked.
+ */
+ public Object getContent ()
+ {
+ return buf;
+ }
+
+ /**
+ * Checks if the object is a BinaryRefAddr with the same type and with the
+ * same bytes in the content.
+ *
+ * @return true if the given object is an instance of BinaryRefAddr,
+ * the addrType is the same as this addrType and the bytes of the
+ * content are the same.
+ */
+ public boolean equals(Object o)
+ {
+ if (o instanceof BinaryRefAddr)
+ {
+ BinaryRefAddr refAddr = (BinaryRefAddr) o;
+ if (this.getType().equals(refAddr.getType()))
+ {
+ byte[] c1 = (byte[]) this.getContent();
+ byte[] c2 = (byte[]) refAddr.getContent();
+ return Arrays.equals(c1, c2);
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Returns the hashCode which is the hasCode of the String returned by
+ * <code>getType()</code> plus the hashCode of the byte array returned by
+ * <code>getContent</code>. The hashCode of the byte array is calculated
+ * by taking the xor of all the bytes in the array, or zero when there are
+ * no bytes in the array.
+ */
+ public int hashCode()
+ {
+ int result = 0;
+ byte[] b = (byte[]) getContent();
+ for (int i=0; i < b.length; i++)
+ result = result^b[i];
+
+ return getType().hashCode() + result;
+ }
+
+ private static char[] hex = {'0', '1', '2', '3', '4', '5', '6', '7',
+ '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
+ /**
+ * Returns a String representation of the RefAddr. Only the first 32 bytes
+ * of the content are added as hex encoded characters.
+ * Should only be used for debugging purposes.
+ */
+ public String toString()
+ {
+ StringBuffer sb = new StringBuffer("[RefAddr type: ");
+ sb.append(getType());
+ sb.append(" content: 0x");
+ byte[] b = (byte[]) getContent();
+ for (int i=0; i < b.length && i < 32; i++)
+ {
+ sb.append(hex[(b[i]&0xf0)>>4]);
+ sb.append(hex[b[i]&0x0f]);
+ }
+ if (b.length > 32)
+ sb.append("...");
+ sb.append("]");
+ return sb.toString();
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/Binding.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/Binding.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/Binding.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/Binding.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,164 @@
+/* Binding.java --
+ Copyright (C) 2001, 2005, 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.naming;
+
+/**
+ * <code>Binding</code> represents the name-object mapping of a
+ * binding in a context.
+ * <p>
+ * Bindings are mappings of a name to an object and this class is used to
+ * specify such mappings. The bindings of a context are retrieved by the
+ * <code>Context#listBindings()</code> methods.
+ * </p>
+ *
+ * @author Tom Tromey (tromey at redhat.com)
+ * @since 1.3
+ */
+public class Binding extends NameClassPair
+{
+ private static final long serialVersionUID = 8839217842691845890L;
+
+ /**
+ * Constructs an instance with the given name and object.
+ *
+ * @param name the name of the binding relative to the target context
+ * (may not be <code>null</code>)
+ * @param obj the bound object
+ */
+ public Binding (String name, Object obj)
+ {
+ super (name, null);
+ boundObj = obj;
+ }
+
+ /**
+ * Constructs an instance with the given name and object and a
+ * flag indicating if the name is relative to the target context.
+ *
+ * @param name the name of the binding relative to the target context
+ * (may not be <code>null</code>)
+ * @param obj the bound object
+ * @param isRelative flag indicating if the name is relative or not
+ */
+ public Binding (String name, Object obj, boolean isRelative)
+ {
+ super (name, null, isRelative);
+ boundObj = obj;
+ }
+
+ /**
+ * Constructs an instance with the given name, classname and object.
+ *
+ * @param name the name of the binding relative to the target context
+ * (may not be <code>null</code>)
+ * @param className the classname to set (maybe <code>null</code>)
+ * @param obj the bound object
+ */
+ public Binding (String name, String className, Object obj)
+ {
+ super (name, className);
+ boundObj = obj;
+ }
+
+ /**
+ * Constructs an instance with the given name, classname, object and a
+ * flag indicating if the name is relative to the target context.
+ *
+ * @param name the name of the binding relative to the target context
+ * (may not be <code>null</code>)
+ * @param className the classname to set (maybe <code>null</code>)
+ * @param isRelative flag indicating if the name is relative or not
+ * @param obj the bound object
+ */
+ public Binding (String name, String className, Object obj,
+ boolean isRelative)
+ {
+ super (name, className, isRelative);
+ boundObj = obj;
+ }
+
+ /**
+ * Returns the classname of the bound object.
+ * <p>
+ * Returns the classname if set explicitly. If not and the bound object is
+ * not <code>null</code> the classname of the bound object is used.
+ * </p>
+ *
+ * @return The fully qualified classname (may be <code>null</code>).
+ */
+ public String getClassName ()
+ {
+ String r = super.getClassName ();
+ if (r != null)
+ return r;
+ return boundObj == null ? null : boundObj.getClass ().getName ();
+ }
+
+ /**
+ * Returns the bound object of this binding.
+ * @return The bound object (maybe <code>null</code>).
+ */
+ public Object getObject ()
+ {
+ return boundObj;
+ }
+
+ /**
+ * Sets the bound object of this binding.
+ * @param obj the bound object.
+ */
+ public void setObject (Object obj)
+ {
+ boundObj = obj;
+ }
+
+ /**
+ * Returns the string representation.
+ * @return The string as given by the NameClassPair superclass plus
+ * the bound objects string representation seperated by a colon.
+ */
+ public String toString ()
+ {
+ // Format specified by the documentation.
+ return super.toString () + ":" + boundObj.toString ();
+ }
+
+ // This name is fixed by the serialization spec.
+ private Object boundObj;
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/CannotProceedException.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/CannotProceedException.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/CannotProceedException.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/CannotProceedException.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,107 @@
+/* CannotProceedException.java --
+ Copyright (C) 2001, 2004, 2005, 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.naming;
+
+import java.util.Hashtable;
+
+/**
+ * @author Warren Levy (warrenl at redhat.com)
+ * @date June 14, 2001
+ */
+
+public class CannotProceedException extends NamingException
+{
+ private static final long serialVersionUID = 1219724816191576813L;
+
+ // Serialized fields.
+ protected Name remainingNewName;
+ protected Hashtable environment;
+ protected Name altName;
+ protected Context altNameCtx;
+
+ public CannotProceedException ()
+ {
+ super ();
+ }
+
+ public CannotProceedException (String msg)
+ {
+ super (msg);
+ }
+
+ public Hashtable getEnvironment()
+ {
+ return environment;
+ }
+
+ public void setEnvironment(Hashtable environment)
+ {
+ this.environment = environment;
+ }
+
+ public Name getRemainingNewName()
+ {
+ return remainingNewName;
+ }
+
+ public void setRemainingNewName(Name newName)
+ {
+ remainingNewName = (Name) newName.clone();
+ }
+
+ public Name getAltName()
+ {
+ return altName;
+ }
+
+ public void setAltName(Name altName)
+ {
+ this.altName = altName;
+ }
+
+ public Context getAltNameCtx()
+ {
+ return altNameCtx;
+ }
+
+ public void setAltNameCtx(Context altNameCtx)
+ {
+ this.altNameCtx = altNameCtx;
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/CommunicationException.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/CommunicationException.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/CommunicationException.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/CommunicationException.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,55 @@
+/* CommunicationException.java --
+ Copyright (C) 2000, 2004, 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.naming;
+
+
+public class CommunicationException extends NamingException
+{
+ private static final long serialVersionUID = 3618507780299986611L;
+
+ public CommunicationException ()
+ {
+ super ();
+ }
+
+ public CommunicationException (String msg)
+ {
+ super (msg);
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/CompositeName.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/CompositeName.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/CompositeName.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/CompositeName.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,341 @@
+/* CompositeName.java --
+ Copyright (C) 2001, 2005, 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.naming;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.util.Enumeration;
+import java.util.NoSuchElementException;
+import java.util.Vector;
+
+/**
+ * Represents names that may span over several namespaces. For instance,
+ * the composite name http://www.gnu.org/software/classpath/index.html spans
+ * over three namespaces (the protocol http, the web server location
+ * (www.gnu.org) and the index.html location on the server).
+ *
+ * @author Tom Tromey (tromey at redhat.com)
+ */
+public class CompositeName implements Name, Cloneable, Serializable
+{
+ private static final long serialVersionUID = 1667768148915813118L;
+
+ private transient Vector elts;
+
+ public CompositeName ()
+ {
+ elts = new Vector ();
+ }
+
+ protected CompositeName (Enumeration comps)
+ {
+ elts = new Vector ();
+ try
+ {
+ while (comps.hasMoreElements ())
+ elts.add (comps.nextElement ());
+ }
+ catch (NoSuchElementException ignore)
+ {
+ }
+ }
+
+ public CompositeName (String n) throws InvalidNameException
+ {
+ elts = new Vector ();
+ // Parse the string into its components.
+ final char no_quote = 'x'; // Use 'x' to mean no quoting.
+ char quote = no_quote;
+ boolean escaped = false;
+ StringBuffer new_element = new StringBuffer ();
+ for (int i = 0; i < n.length (); ++i)
+ {
+ char c = n.charAt (i);
+ if (escaped)
+ escaped = false;
+ else if (c == '\\')
+ {
+ escaped = true;
+ continue;
+ }
+ else if (quote != no_quote)
+ {
+ if (quote == c)
+ {
+ // The quotes must surround a complete component.
+ if (i + 1 < n.length () && n.charAt (i + 1) != '/')
+ throw new InvalidNameException ("close quote before end of component");
+ elts.add (new_element.toString ());
+ new_element.setLength (0);
+ quote = no_quote;
+ continue;
+ }
+ // Otherwise, fall through.
+ }
+ // Quotes are only special at the start of a component.
+ else if (new_element.length () == 0
+ && (c == '\'' || c == '"'))
+ {
+ quote = c;
+ continue;
+ }
+ else if (c == '/')
+ {
+ elts.add (new_element.toString ());
+ new_element.setLength (0);
+ continue;
+ }
+
+ new_element.append (c);
+ }
+
+ if (new_element.length () != 0)
+ elts.add (new_element.toString ());
+
+ // Error checking.
+ if (quote != no_quote)
+ throw new InvalidNameException ("unterminated quote");
+ if (escaped)
+ throw new InvalidNameException ("trailing escape character");
+ }
+
+ public Name add (int posn, String comp) throws InvalidNameException
+ {
+ elts.add (posn, comp);
+ return this;
+ }
+
+ public Name add (String comp) throws InvalidNameException
+ {
+ elts.add (comp);
+ return this;
+ }
+
+ public Name addAll (int posn, Name n) throws InvalidNameException
+ {
+ Enumeration e = n.getAll ();
+ try
+ {
+ while (e.hasMoreElements ())
+ {
+ elts.add (posn, e.nextElement ());
+ ++posn;
+ }
+ }
+ catch (NoSuchElementException ignore)
+ {
+ }
+ return this;
+ }
+
+ public Name addAll (Name suffix) throws InvalidNameException
+ {
+ Enumeration e = suffix.getAll ();
+ try
+ {
+ while (e.hasMoreElements ())
+ elts.add (e.nextElement ());
+ }
+ catch (NoSuchElementException ignore)
+ {
+ }
+ return this;
+ }
+
+ public Object clone ()
+ {
+ return new CompositeName (elts.elements ());
+ }
+
+ public int compareTo (Object obj)
+ {
+ if (obj == null || ! (obj instanceof CompositeName))
+ throw new ClassCastException ("CompositeName.compareTo() expected CompositeName");
+ CompositeName cn = (CompositeName) obj;
+ int last = Math.min (cn.elts.size (), elts.size ());
+ for (int i = 0; i < last; ++i)
+ {
+ String f = (String) elts.get (i);
+ int comp = f.compareTo ((String) cn.elts.get (i));
+ if (comp != 0)
+ return comp;
+ }
+ return elts.size () - cn.elts.size ();
+ }
+
+ public boolean endsWith (Name n)
+ {
+ if (! (n instanceof CompositeName))
+ return false;
+ CompositeName cn = (CompositeName) n;
+ if (cn.elts.size () > elts.size ())
+ return false;
+ int delta = elts.size () - cn.elts.size ();
+ for (int i = 0; i < cn.elts.size (); ++i)
+ {
+ if (! cn.elts.get (i).equals (elts.get (delta + i)))
+ return false;
+ }
+ return true;
+ }
+
+ public boolean equals (Object obj)
+ {
+ if (! (obj instanceof CompositeName))
+ return false;
+ CompositeName cn = (CompositeName) obj;
+ return elts.equals (cn.elts);
+ }
+
+ public String get (int posn)
+ {
+ return (String) elts.get (posn);
+ }
+
+ public Enumeration getAll ()
+ {
+ return elts.elements ();
+ }
+
+ public Name getPrefix (int posn)
+ {
+ CompositeName cn = new CompositeName ();
+ for (int i = 0; i < posn; ++i)
+ cn.elts.add ((String) elts.get (i));
+ return cn;
+ }
+
+ public Name getSuffix (int posn)
+ {
+ if (posn > elts.size ())
+ throw new ArrayIndexOutOfBoundsException (posn);
+ CompositeName cn = new CompositeName ();
+ for (int i = posn; i < elts.size (); ++i)
+ cn.elts.add ((String) elts.get (i));
+ return cn;
+ }
+
+ public int hashCode ()
+ {
+ // Specified in documentation.
+ int h = 0;
+ for (int i = 0; i < elts.size (); ++i)
+ h += elts.get (i).hashCode ();
+ return h;
+ }
+
+ public boolean isEmpty ()
+ {
+ return elts.isEmpty ();
+ }
+
+ public Object remove (int posn) throws InvalidNameException
+ {
+ return elts.remove (posn);
+ }
+
+ public int size ()
+ {
+ return elts.size ();
+ }
+
+ public boolean startsWith (Name n)
+ {
+ if (! (n instanceof CompositeName))
+ return false;
+ CompositeName cn = (CompositeName) n;
+ if (cn.elts.size () > elts.size ())
+ return false;
+ for (int i = 0; i < cn.elts.size (); ++i)
+ {
+ if (! cn.elts.get (i).equals (elts.get (i)))
+ return false;
+ }
+ return true;
+ }
+
+ public String toString ()
+ {
+ StringBuffer result = new StringBuffer ();
+ for (int i = 0; i < elts.size (); ++i)
+ {
+ // For simplicity we choose to always quote using escapes and
+ // never quotes.
+ String elt = (String) elts.get (i);
+ if (i > 0
+ || (i == elts.size () - 1 && elt.equals ("")))
+ result.append ('/');
+ for (int k = 0; k < elt.length (); ++k)
+ {
+ char c = elt.charAt (k);
+ // We must quote
+ // ... a leading quote,
+ if ((k == 0 && (c == '"' || c == '\''))
+ // ... an escape preceding a meta character,
+ // or at the end of a component,
+ || (c == '\\'
+ && (k == elt.length () - 1
+ || "\\'\"/".indexOf (elt.charAt (k + 1)) != -1))
+ // ... or a component separator.
+ || c == '/')
+ result.append ('\\');
+ result.append (c);
+ }
+ }
+ return result.toString ();
+ }
+
+ private void readObject(ObjectInputStream s)
+ throws IOException, ClassNotFoundException
+ {
+ int size = s.readInt();
+ elts = new Vector(size);
+ for (int i = 0; i < size; i++)
+ elts.add(s.readObject());
+ }
+
+ private void writeObject(ObjectOutputStream s) throws IOException
+ {
+ s.writeInt(elts.size());
+ for (int i = 0; i < elts.size(); i++)
+ s.writeObject(elts.get(i));
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/CompoundName.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/CompoundName.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/CompoundName.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/CompoundName.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,521 @@
+/* CompoundName.java --
+ Copyright (C) 2001, 2004, 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.naming;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.util.Enumeration;
+import java.util.NoSuchElementException;
+import java.util.Properties;
+import java.util.Vector;
+
+/**
+ * Represents hierarchical names from the single namespace. For instance,
+ * the path /home/audriusa/classpath/file.txt is the compound name, using
+ * the filesystem namespace.
+ *
+ * @author Tom Tromey (tromey at redhat.com)
+ * @date May 16, 2001
+ *
+ * FIXME: this class is underspecified. For instance, the `flat'
+ * direction is never described. If it means that the CompoundName
+ * can only have a single element, then the Enumeration-based
+ * constructor ought to throw InvalidNameException.
+ *
+ * @since 1.3
+ */
+public class CompoundName implements Name, Cloneable, Serializable
+{
+ private static final long serialVersionUID = 3513100557083972036L;
+
+ private CompoundName (Properties syntax)
+ {
+ elts = new Vector ();
+ mySyntax = syntax;
+ initializeSyntax ();
+ }
+
+ protected CompoundName (Enumeration comps, Properties syntax)
+ {
+ elts = new Vector ();
+ mySyntax = syntax;
+ initializeSyntax ();
+ try
+ {
+ while (comps.hasMoreElements ())
+ elts.add (comps.nextElement ());
+ }
+ catch (NoSuchElementException ignore)
+ {
+ }
+ }
+
+ public CompoundName (String n, Properties syntax)
+ throws InvalidNameException
+ {
+ elts = new Vector ();
+ mySyntax = syntax;
+ initializeSyntax ();
+
+ StringBuffer new_element = new StringBuffer ();
+ int i = 0;
+ // QUOTE==null means no quoting right now. When it is set it is
+ // the value of the closing quote.
+ String quote = null;
+ while (i < n.length ())
+ {
+ String special = isSpecial (n, i);
+
+ if (special == escape && escape != null)
+ {
+ if (n.length () == i + special.length ())
+ {
+ // A trailing escape is treated as itself.
+ new_element.append (special);
+ i += special.length ();
+ }
+ else
+ {
+ String eSpecial = isSpecial (n, i + special.length ());
+ if (eSpecial != null)
+ {
+ // Treat the escape as an escape.
+ new_element.append (eSpecial);
+ i += special.length () + eSpecial.length ();
+ }
+ else
+ {
+ // Treat the escape as itself.
+ new_element.append (special);
+ i += special.length ();
+ }
+ continue;
+ }
+ }
+ else if (quote != null)
+ {
+ // It is safe to use == here.
+ if (quote == special)
+ {
+ // Quotes must surround a complete component.
+ if (i + quote.length () < n.length ()
+ && ! n.startsWith (separator, i + quote.length ()))
+ throw new InvalidNameException ("close quote before end of component");
+ elts.add (new_element.toString ());
+ new_element.setLength (0);
+ i += quote.length ();
+ quote = null;
+ continue;
+ }
+ // Otherwise, fall through.
+ }
+ // Quotes are only special at the start of a component.
+ else if (new_element.length () == 0
+ && special == beginQuote
+ && beginQuote != null)
+ {
+ quote = endQuote;
+ i += special.length ();
+ continue;
+ }
+ else if (new_element.length () == 0
+ && special == beginQuote2
+ && beginQuote2 != null)
+ {
+ quote = endQuote2;
+ i += special.length ();
+ continue;
+ }
+ else if (direction != FLAT && special == separator)
+ {
+ elts.add (new_element.toString ());
+ new_element.setLength (0);
+ i += special.length ();
+ continue;
+ }
+
+ // Nothing in particular, so try the next character.
+ new_element.append (n.charAt (i));
+ ++i;
+ }
+
+ if (new_element.length () != 0)
+ elts.add (new_element.toString ());
+
+ if (direction == RIGHT_TO_LEFT)
+ {
+ // Reverse the order of the elements.
+ int len = elts.size ();
+ for (i = 0; i < len / 2; ++i)
+ {
+ Object t = elts.set (i, elts.get (len - i - 1));
+ elts.set (len - i - 1, t);
+ }
+ }
+
+ // Error checking.
+ if (quote != null)
+ throw new InvalidNameException ("unterminated quote");
+ }
+
+ public Name add (int posn, String comp) throws InvalidNameException
+ {
+ elts.add (posn, comp);
+ return this;
+ }
+
+ public Name add (String comp) throws InvalidNameException
+ {
+ elts.add (comp);
+ return this;
+ }
+
+ public Name addAll (int posn, Name n) throws InvalidNameException
+ {
+ Enumeration e = n.getAll ();
+ try
+ {
+ while (e.hasMoreElements ())
+ {
+ elts.add (posn, e.nextElement ());
+ ++posn;
+ }
+ }
+ catch (NoSuchElementException ignore)
+ {
+ }
+ return this;
+ }
+
+ public Name addAll (Name suffix) throws InvalidNameException
+ {
+ Enumeration e = suffix.getAll ();
+ try
+ {
+ while (e.hasMoreElements ())
+ elts.add (e.nextElement ());
+ }
+ catch (NoSuchElementException ignore)
+ {
+ }
+ return this;
+ }
+
+ public Object clone ()
+ {
+ return new CompoundName (elts.elements (), mySyntax);
+ }
+
+ public int compareTo (Object obj)
+ {
+ if (! (obj instanceof CompoundName))
+ throw new ClassCastException ("CompoundName.compareTo() expected CompoundName");
+ CompoundName cn = (CompoundName) obj;
+ int last = Math.min (cn.elts.size (), elts.size ());
+ for (int i = 0; i < last; ++i)
+ {
+ String f = canonicalize ((String) elts.get (i));
+ int comp = f.compareTo (canonicalize ((String) cn.elts.get (i)));
+ if (comp != 0)
+ return comp;
+ }
+ return elts.size () - cn.elts.size ();
+ }
+
+ public boolean endsWith (Name n)
+ {
+ if (! (n instanceof CompoundName))
+ return false;
+ CompoundName cn = (CompoundName) n;
+ if (cn.elts.size () > elts.size ())
+ return false;
+ int delta = elts.size () - cn.elts.size ();
+ for (int i = 0; i < cn.elts.size (); ++i)
+ {
+ String f = canonicalize ((String) elts.get (delta + i));
+ if (! f.equals (canonicalize ((String) cn.elts.get (i))))
+ return false;
+ }
+ return true;
+ }
+
+ public boolean equals (Object obj)
+ {
+ if (! (obj instanceof CompoundName))
+ return false;
+ return compareTo (obj) == 0;
+ }
+
+ public String get (int posn)
+ {
+ return (String) elts.get (posn);
+ }
+
+ public Enumeration getAll ()
+ {
+ return elts.elements ();
+ }
+
+ public Name getPrefix (int posn)
+ {
+ CompoundName cn = new CompoundName (mySyntax);
+ for (int i = 0; i < posn; ++i)
+ cn.elts.add (elts.get (i));
+ return cn;
+ }
+
+ public Name getSuffix (int posn)
+ {
+ if (posn > elts.size ())
+ throw new ArrayIndexOutOfBoundsException (posn);
+ CompoundName cn = new CompoundName (mySyntax);
+ for (int i = posn; i < elts.size (); ++i)
+ cn.elts.add (elts.get (i));
+ return cn;
+ }
+
+ public int hashCode ()
+ {
+ int h = 0;
+ for (int i = 0; i < elts.size (); ++i)
+ h += canonicalize ((String) elts.get (i)).hashCode ();
+ return h;
+ }
+
+ public boolean isEmpty ()
+ {
+ return elts.isEmpty ();
+ }
+
+ public Object remove (int posn) throws InvalidNameException
+ {
+ return elts.remove (posn);
+ }
+
+ public int size ()
+ {
+ return elts.size ();
+ }
+
+ public boolean startsWith (Name n)
+ {
+ if (! (n instanceof CompoundName))
+ return false;
+ CompoundName cn = (CompoundName) n;
+ if (cn.elts.size () > elts.size ())
+ return false;
+ for (int i = 0; i < cn.elts.size (); ++i)
+ {
+ String f = canonicalize ((String) elts.get (i));
+ if (! f.equals (canonicalize ((String) cn.elts.get (i))))
+ return false;
+ }
+ return true;
+ }
+
+ // If ELEMENT starts with some meta-sequence at OFFSET, then return
+ // the string representing the meta-sequence. Otherwise return
+ // null.
+ private String isSpecial (String element, int offset)
+ {
+ String special = null;
+ if (separator != null && element.startsWith (separator, offset))
+ special = separator;
+ else if (escape != null && element.startsWith (escape, offset))
+ special = escape;
+ else if (beginQuote != null && element.startsWith (beginQuote, offset))
+ special = beginQuote;
+ else if (endQuote != null && element.startsWith (endQuote, offset))
+ special = endQuote;
+ else if (beginQuote2 != null
+ && element.startsWith (beginQuote2, offset))
+ special = beginQuote2;
+ else if (endQuote2 != null && element.startsWith (endQuote2, offset))
+ special = endQuote2;
+
+ return special;
+ }
+
+ public String toString ()
+ {
+ StringBuffer result = new StringBuffer ();
+ int size = elts.size ();
+ for (int i = 0; i < size; ++i)
+ {
+ // Find the appropriate element. FIXME: not clear what FLAT
+ // means.
+ int offset = (direction == RIGHT_TO_LEFT) ? (size - i - 1) : i;
+ String element = (String) elts.get (offset);
+ if (i > 0
+ || (i == size - 1 && element.equals ("")))
+ result.append (separator);
+
+ int k = 0;
+ while (k < element.length ())
+ {
+ String special = isSpecial (element, k);
+ if (special != null)
+ {
+ result.append (escape);
+ result.append (special);
+ k += special.length ();
+ }
+ else
+ {
+ result.append (element.charAt (k));
+ ++k;
+ }
+ }
+ }
+
+ return result.toString ();
+ }
+
+ // This canonicalizes a String, based on the syntax, for comparison
+ // or other similar purposes.
+ private String canonicalize (String element)
+ {
+ String ret = element;
+
+ if (ignoreCase)
+ ret = ret.toLowerCase ();
+
+ if (trimBlanks)
+ {
+ int first = 0;
+ while (first < ret.length ()
+ && Character.isWhitespace (ret.charAt (first)))
+ ++first;
+
+ int last = ret.length () - 1;
+ while (last >= first
+ && Character.isWhitespace (ret.charAt (last)))
+ --last;
+
+ ret = ret.substring (first, last);
+ }
+
+ return ret;
+ }
+
+ // This initializes all the syntax variables. This seems easier
+ // than re-querying the properties every time. We're allowed to do
+ // this because the spec says that subclasses should consider the
+ // syntax as being read-only.
+ private void initializeSyntax ()
+ {
+ String t = mySyntax.getProperty ("jndi.syntax.direction", "flat");
+ if (t.equals ("right_to_left"))
+ this.direction = RIGHT_TO_LEFT;
+ else if (t.equals ("left_to_right"))
+ this.direction = LEFT_TO_RIGHT;
+ else
+ {
+ // If we don't recognize it, default to flat.
+ this.direction = FLAT;
+ }
+
+ // This is required unless the direction is FLAT. Unfortunately
+ // there is no way to report this error.
+ this.separator = mySyntax.getProperty ("jndi.syntax.separator", "");
+
+ this.ignoreCase
+ = Boolean.valueOf (mySyntax.getProperty ("jndi.syntax.ignorecase",
+ "false")).booleanValue ();
+ this.escape = mySyntax.getProperty ("jndi.syntax.escape", null);
+ this.beginQuote = mySyntax.getProperty ("jndi.syntax.beginquote", null);
+ this.endQuote = mySyntax.getProperty ("jndi.syntax.endquote",
+ this.beginQuote);
+ this.beginQuote2 = mySyntax.getProperty ("jndi.syntax.beginquote2",
+ null);
+ this.endQuote2 = mySyntax.getProperty ("jndi.syntax.endquote2",
+ this.beginQuote2);
+ this.trimBlanks
+ = Boolean.valueOf (mySyntax.getProperty ("jndi.syntax.trimblanks",
+ "false")).booleanValue ();
+ }
+
+ private void readObject(ObjectInputStream s)
+ throws IOException, ClassNotFoundException
+ {
+ mySyntax = (Properties) s.readObject();
+ int count = s.readInt();
+ elts = new Vector(count);
+ for (int i = 0; i < count; i++)
+ elts.addElement((String) s.readObject());
+ }
+
+ private void writeObject(ObjectOutputStream s)
+ throws IOException
+ {
+ s.writeObject(mySyntax);
+ s.writeInt(elts.size());
+ for (int i = 0; i < elts.size(); i++)
+ s.writeObject(elts.elementAt(i));
+ }
+
+ // The spec specifies this but does not document it in any way (it
+ // is a package-private class). It is useless as far as I can tell.
+ // So we ignore it.
+ // protected transient NameImpl impl;
+ protected transient Properties mySyntax;
+
+ // The actual elements.
+ private transient Vector elts;
+
+ // The following are all used for syntax.
+ private transient int direction;
+ private transient String separator;
+ private transient boolean ignoreCase;
+ private transient String escape;
+ private transient String beginQuote;
+ private transient String endQuote;
+ private transient String beginQuote2;
+ private transient String endQuote2;
+ private transient boolean trimBlanks;
+ // We didn't need these for parsing, so they are gone.
+ // private transient String avaSeparator;
+ // private transient String typevalSeparator;
+
+ private static final int RIGHT_TO_LEFT = -1;
+ private static final int LEFT_TO_RIGHT = 1;
+ private static final int FLAT = 0;
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/ConfigurationException.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/ConfigurationException.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/ConfigurationException.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/ConfigurationException.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,55 @@
+/* ConfigurationException.java --
+ Copyright (C) 2000, 2004, 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.naming;
+
+
+public class ConfigurationException extends NamingException
+{
+ private static final long serialVersionUID = - 2535156726228855704L;
+
+ public ConfigurationException ()
+ {
+ super ();
+ }
+
+ public ConfigurationException (String msg)
+ {
+ super (msg);
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/Context.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/Context.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/Context.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/Context.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,492 @@
+/* Context.java -- A naming context
+ Copyright (C) 2000, 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.naming;
+
+import java.util.Hashtable;
+
+import javax.naming.directory.InvalidAttributesException;
+
+public interface Context
+{
+ /**
+ * Property with name of the inital context factory to use
+ */
+ String INITIAL_CONTEXT_FACTORY = "java.naming.factory.initial";
+
+ /**
+ * Property with colon-separated list of object factories to use.
+ */
+ String OBJECT_FACTORIES = "java.naming.factory.object";
+
+ /**
+ * Property with colon-separated list of state factories to use.
+ */
+ String STATE_FACTORIES = "java.naming.factory.state";
+
+ /**
+ * Property with colon-separated list of package prefixes to use.
+ */
+ String URL_PKG_PREFIXES = "java.naming.factory.url.pkgs";
+
+ /**
+ * Property with URL specifying configuration for the service provider to use.
+ */
+ String PROVIDER_URL = "java.naming.provider.url";
+
+ /**
+ * Property with the DNS host and domain names to use.
+ */
+ String DNS_URL = "java.naming.dns.url";
+
+ /**
+ * Property with the authoritativeness of the service requested.
+ */
+ String AUTHORITATIVE = "java.naming.authoritative";
+
+ /**
+ * Property with the batch size to use when returning data via the service's
+ * protocol.
+ */
+ String BATCHSIZE = "java.naming.batchsize";
+
+ /**
+ * Property defining how referrals encountered by the service provider are to
+ * be processed.
+ */
+ String REFERRAL = "java.naming.referral";
+
+ /**
+ * Property specifying the security protocol to use.
+ */
+ String SECURITY_PROTOCOL = "java.naming.security.protocol";
+
+ /**
+ * Property specifying the security level to use.
+ */
+ String SECURITY_AUTHENTICATION = "java.naming.security.authentication";
+
+ /**
+ * Property for the identity of the principal for authenticating the caller to
+ * the service.
+ */
+ String SECURITY_PRINCIPAL = "java.naming.security.principal";
+
+ /**
+ * Property specifying the credentials of the principal for authenticating the
+ * caller to the service.
+ */
+ String SECURITY_CREDENTIALS = "java.naming.security.credentials";
+
+ /**
+ * Property for specifying the preferred language to use with the service.
+ */
+ String LANGUAGE = "java.naming.language";
+
+ /**
+ * Property for the initial context constructor to use when searching for
+ * other properties.
+ */
+ String APPLET = "java.naming.applet";
+
+ /**
+ * Give the specified name for the specified object. The passed name must not
+ * be already bound to some other object.
+ *
+ * @param name the name that will be given to the object (in the scope of this
+ * context).
+ * @param obj the object being named.
+ * @throws NameAlreadyBoundException if this name is already used to name some
+ * object.
+ * @throws InvalidAttributesException if the object does not supply all
+ * required attributes.
+ * @throws NamingException if the naming operation has failed due other
+ * reasons.
+ */
+ void bind(Name name, Object obj) throws NamingException;
+
+ /**
+ * Give the specified name for the specified object. The passed name must not
+ * be already bound to some other object.
+ *
+ * @param name the name that will be given to the object (in the scope of this
+ * context).
+ * @param obj the object being named.
+ * @throws NameAlreadyBoundException if this name is already used to name some
+ * object.
+ * @throws InvalidAttributesException if the object does not supply all
+ * required attributes.
+ * @throws NamingException if the naming operation has failed due other
+ * reasons.
+ */
+ void bind(String name, Object obj) throws NamingException;
+
+ /**
+ * Gets the previously named object by name. If the passed name is empty, the
+ * method should return a cloned instance of this naming context.
+ *
+ * @param name the name of the object being searched in this context
+ * @return the named object
+ * @throws NamingException if the naming fails.
+ */
+ Object lookup(Name name) throws NamingException;
+
+ /**
+ * Gets the previously named object by name. If the passed name is empty, the
+ * method should return a cloned instance of this naming context.
+ *
+ * @param name the name of the object being searched in this context
+ * @return the named object
+ * @throws NamingException if the naming fails.
+ */
+ Object lookup(String name) throws NamingException;
+
+ /**
+ * Give the specified name for the specified object. Unlike bind, this method
+ * silently replaces the existing binding for this name, if one exists.
+ *
+ * @param name the name that will be given to the object (in the scope of this
+ * context).
+ * @param obj the object being named.
+ * @throws InvalidAttributesException if the object does not supply all
+ * required attributes.
+ * @throws NamingException if the naming operation has failed due other
+ * reasons.
+ */
+ void rebind(Name name, Object obj) throws NamingException;
+
+ /**
+ * Give the specified name for the specified object. Unlike bind, this method
+ * silently replaces the existing binding for this name, if one exists.
+ *
+ * @param name the name that will be given to the object (in the scope of this
+ * context).
+ * @param obj the object being named.
+ * @throws InvalidAttributesException if the object does not supply all
+ * required attributes.
+ * @throws NamingException if the naming operation has failed due other
+ * reasons.
+ */
+ void rebind(String name, Object obj) throws NamingException;
+
+ /**
+ * Removes the name - object mapping from the current context. This method
+ * returns without action if the name is not bound to an object in the
+ * terminal context, but throws {@link NameNotFoundException} if one of the
+ * intermadiate contexts does not exist.
+ *
+ * @param name the name to be removed
+ * @throws NameNotFoundException if one of the intermediate naming contexts
+ * does not exist. Will not be thrown if just the terminal binding
+ * is missing.
+ * @throws NamingException if the naming operation has failed due other
+ * reasons.
+ */
+ void unbind(Name name) throws NamingException;
+
+ /**
+ * Removes the name - object mapping from the current context. This method
+ * returns without action if the name is not bound to an object in the
+ * terminal context, but throws {@link NameNotFoundException} if one of the
+ * intermadiate contexts does not exist.
+ *
+ * @param name the name to be removed
+ * @throws NameNotFoundException if one of the intermediate naming contexts
+ * does not exist. Will not be thrown if just the terminal binding
+ * is missing.
+ * @throws NamingException if the naming operation has failed due other
+ * reasons.
+ */
+ void unbind(String name) throws NamingException;
+
+ /**
+ * Renames the existing binding, removing the existing and giving the new name
+ * for the same object.
+ *
+ * @param oldName the existing name of the known object
+ * @param newName the new name of the same object
+ * @throws NameNotFoundException if the oldName is unknown for this context
+ * @throws NamingException if the naming operation has failed due other
+ * reasons.
+ */
+ void rename(Name oldName, Name newName) throws NamingException;
+
+ /**
+ * Renames the existing binding, removing the existing and giving the new name
+ * for the same object.
+ *
+ * @param oldName the existing name of the known object
+ * @param newName the new name of the same object
+ * @throws NameNotFoundException if the oldName is unknown for this context
+ * @throws NamingException if the naming operation has failed due other
+ * reasons.
+ */
+ void rename(String oldName, String newName) throws NamingException;
+
+ /**
+ * Creates and returns the enumeration over the name bindings that are present
+ * the given subcontext. The enumeration elements have the type of
+ * {@link NameClassPair}, providing also information about the class of the
+ * bound object. The behaviour in the case if the bindings are added or
+ * removed later is not defined. The contents of the subcontexts are not
+ * included.
+ *
+ * @param name the name of the subcontext
+ * @return the enumeration over the names, known for the given subcontext.
+ * @throws NamingException
+ */
+ NamingEnumeration list(Name name) throws NamingException;
+
+ /**
+ * Creates and returns the enumeration over the name bindings that are present
+ * the given subcontext. The enumeration elements have the type of
+ * {@link NameClassPair}, providing also information about the class of the
+ * bound object. The behaviour in the case if the bindings are added or
+ * removed later is not defined. The contents of the subcontexts are not
+ * included.
+ *
+ * @param name the name of the subcontext
+ * @return the enumeration over the names, known for the given subcontext.
+ * @throws NamingException
+ */
+ NamingEnumeration list(String name) throws NamingException;
+
+ /**
+ * Creates and returns the enumeration over the name - object bindings that
+ * are present the given subcontext. The enumeration elements have the type of
+ * {@link Binding}, providing also information about the class of the bound
+ * object. The behaviour in the case if the bindings are added or removed
+ * later is not defined. The contents of the subcontexts are not included.
+ *
+ * @param name the name of the subcontext
+ * @return the enumeration over the names, known for the given subcontext.
+ * @throws NamingException
+ */
+ NamingEnumeration listBindings(Name name) throws NamingException;
+
+ /**
+ * Creates and returns the enumeration over the name - object bindings that
+ * are present the given subcontext. The enumeration elements have the type of
+ * {@link Binding}, providing also information about the class of the bound
+ * object. The behaviour in the case if the bindings are added or removed
+ * later is not defined. The contents of the subcontexts are not included.
+ *
+ * @param name the name of the subcontext
+ * @return the enumeration over the names, known for the given subcontext.
+ * @throws NamingException
+ */
+ NamingEnumeration listBindings(String name) throws NamingException;
+
+ /**
+ * Creates the new naming subcontext and binds it to the current (this)
+ * context.
+ *
+ * @param name the name of the new context being created
+ * @return the newly created context, bound to the instance of the context on
+ * that the method has been called
+ * @throws NameAlreadyBoundException if this name is already bound
+ * @throws InvalidAttributesException if the creation of the new context
+ * requires the missing mandatory attributes
+ * @throws NamingException
+ */
+ Context createSubcontext(Name name) throws NamingException;
+
+ /**
+ * Creates the new naming subcontext and binds it to the current (this)
+ * context.
+ *
+ * @param name the name of the new context being created
+ * @return the newly created context, bound to the instance of the context on
+ * that the method has been called
+ * @throws NameAlreadyBoundException if this name is already bound
+ * @throws InvalidAttributesException if the creation of the new context
+ * requires the missing mandatory attributes
+ * @throws NamingException
+ */
+ Context createSubcontext(String name) throws NamingException;
+
+ /**
+ * Removes the naming subcontext from this naming context. Returns without
+ * action if such subcontext does not exist. The context being destroyed must
+ * be empty.
+ *
+ * @param name the name of the subcontext beig removed.
+ * @throws ContextNotEmptyException if the named context is not empty.
+ * @throws NamingException
+ */
+ void destroySubcontext(Name name) throws NamingException;
+
+ /**
+ * Removes the naming subcontext from this naming context. Returns without
+ * action if such subcontext does not exist. The context being destroyed must
+ * be empty.
+ *
+ * @param name the name of the subcontext beig removed.
+ * @throws ContextNotEmptyException if the named context is not empty.
+ * @throws NamingException
+ */
+ void destroySubcontext(String name) throws NamingException;
+
+ /**
+ * Retrieves the named object, not following the link of the terminal atomic
+ * component of the name. If the object, named by the passed name, is not a
+ * link, returns that object itself. The intermediate links, if present, are
+ * followed.
+ *
+ * @param name the name of the object that may be a link, leading to another
+ * object.
+ * @return the named object, not following the terminal link (if present).
+ * @throws NamingException
+ */
+ Object lookupLink(Name name) throws NamingException;
+
+ /**
+ * Retrieves the named object, not following the link of the terminal atomic
+ * component of the name. If the object, named by the passed name, is not a
+ * link, returns that object itself. The intermediate links, if present, are
+ * followed.
+ *
+ * @param name the name of the object that may be a link, leading to another
+ * object.
+ * @return the named object, not following the terminal link (if present).
+ * @throws NamingException
+ */
+ Object lookupLink(String name) throws NamingException;
+
+ /**
+ * Obtains the name parser for parsing the names of the given naming
+ * subcontext.
+ *
+ * @param name the name of the subcontext for that the parser must be obtained
+ * @return the parser to parse the names of that context
+ * @throws NamingException
+ */
+ NameParser getNameParser(Name name) throws NamingException;
+
+ /**
+ * Obtains the name parser for parsing the names of the given naming
+ * subcontext.
+ *
+ * @param name the name of the subcontext for that the parser must be obtained
+ * @return the parser to parse the names of that context
+ * @throws NamingException
+ */
+ NameParser getNameParser(String name) throws NamingException;
+
+ /**
+ * Composes the name of this context together with another name, related to
+ * this context.
+ *
+ * @param name a name, defined in the scope of this context
+ * @param prefix a name of this context itself, defined in the scope of some
+ * ancestor
+ * @return the name of the same object as named by the first parameter, but
+ * related to the context of the specified ancestor.
+ * @throws NamingException
+ */
+ Name composeName(Name name, Name prefix) throws NamingException;
+
+ /**
+ * Composes the name of this context together with another name, related to
+ * this context.
+ *
+ * @param name a name, defined in the scope of this context
+ * @param prefix a name of this context itself, defined in the scope of some
+ * ancestor
+ * @return the name of the same object as named by the first parameter, but
+ * related to the context of the specified ancestor.
+ * @throws NamingException
+ */
+ String composeName(String name, String prefix) throws NamingException;
+
+ /**
+ * Add new environment property to the environment of this context. Both name
+ * and value of the new property must not be null. If the property is already
+ * defined, is current value is replaced by the propVal.
+ *
+ * @param propName the name of the new property
+ * @param propVal the value of the new property
+ * @return the previous value of this property or null if the property has not
+ * been previously defined
+ * @throws NamingException
+ */
+ Object addToEnvironment(String propName, Object propVal)
+ throws NamingException;
+
+ /**
+ * Removes the property with the given name from the environment. Returns
+ * without action if this property is not defined.
+ *
+ * @param propName the name of the property being removed.
+ * @return the value of the property that has been removed or null if the
+ * property was not defined.
+ * @throws NamingException
+ */
+ Object removeFromEnvironment(String propName) throws NamingException;
+
+ /**
+ * Returns the environment, associated with this naming context. The returned
+ * table should never be modified by the caller. Use {@link #addToEnvironment}
+ * and {@link #removeFromEnvironment} to modify the environement, if needed.
+ *
+ * @return the table, representing the environment of this context
+ * @throws NamingException
+ */
+ Hashtable getEnvironment() throws NamingException;
+
+ /**
+ * Releases all resources, associated with this context. The close() method
+ * can be called several times, but after it has been once invoked, it is not
+ * allowed to call any other method of this context,
+ *
+ * @throws NamingException
+ */
+ void close() throws NamingException;
+
+ /**
+ * Returs the full name of this naming context. The returned string is not a
+ * JNDI composite name and should not be passed directly to the methods of the
+ * naming context.
+ *
+ * @return the full name of this naming context, in its own namespace.
+ * @throws OperationNotSupportedException if the naming system, represented by
+ * this context, does not support the notation of the full name.
+ * @throws NamingException
+ */
+ String getNameInNamespace() throws NamingException;
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/ContextNotEmptyException.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/ContextNotEmptyException.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/ContextNotEmptyException.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/ContextNotEmptyException.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,60 @@
+/* ContextNotEmptyException.java --
+ Copyright (C) 2000, 2004, 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.naming;
+
+/**
+ * This exception is thrown in response to the attempt to destroy the non
+ * empty context. Only empty contexts (without bindings) can be destroyed.
+ *
+ * @see Context#destroySubcontext
+ */
+public class ContextNotEmptyException extends NamingException
+{
+ private static final long serialVersionUID = 1090963683348219877L;
+
+ public ContextNotEmptyException ()
+ {
+ super ();
+ }
+
+ public ContextNotEmptyException (String msg)
+ {
+ super (msg);
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/InitialContext.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/InitialContext.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/InitialContext.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/InitialContext.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,547 @@
+/* InitialContext.java -- Initial naming context.
+ Copyright (C) 2000, 2002, 2003, 2004, 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.naming;
+
+import java.applet.Applet;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.Enumeration;
+import java.util.HashSet;
+import java.util.Hashtable;
+import java.util.Properties;
+
+import javax.naming.spi.NamingManager;
+
+/**
+ * The starting context for performing naming operations. All naming operations
+ * are performed in the scope of some context. The initial context is the
+ * starting point for the name resolution.
+ */
+public class InitialContext implements Context
+{
+ /**
+ * Contains the default initial context. This value is returned by
+ * {@link NamingManager#getInitialContext}. It is set by this method
+ * when calling it first time. The subsequent calls return the value of
+ * this field.
+ */
+ protected Context defaultInitCtx;
+
+ /**
+ * Indicates if the initial context was obtained by calling
+ * {@link NamingManager#getInitialContext}.
+ */
+ protected boolean gotDefault = false;
+
+ /**
+ * The environment, associated with this initial context.
+ */
+ protected Hashtable myProps;
+
+ /**
+ * The list of the properties, to that the second alternative value must
+ * be appended after the colon to the first possible value. Used in
+ * {@link #merge(Hashtable, Hashtable)}
+ */
+ static final HashSet colon_list;
+ static
+ {
+ colon_list = new HashSet();
+ colon_list.add(Context.OBJECT_FACTORIES);
+ colon_list.add(Context.URL_PKG_PREFIXES);
+ colon_list.add(Context.STATE_FACTORIES);
+ };
+
+ /**
+ * The properties that are searched in the agreed places in the
+ * {@link #init(Hashtable)} method.
+ */
+ static final String[] use_properties =
+ {
+ Context.DNS_URL,
+ Context.INITIAL_CONTEXT_FACTORY,
+ Context.OBJECT_FACTORIES,
+ Context.PROVIDER_URL,
+ Context.STATE_FACTORIES,
+ Context.URL_PKG_PREFIXES,
+ };
+
+
+ /**
+ * Creates the new initial context with the given properties.
+ *
+ * @param environment the properties, used by the initial context being
+ * created.
+ * @throws NamingException
+ */
+ public InitialContext(Hashtable environment) throws NamingException
+ {
+ init(environment);
+ }
+
+ /**
+ * Creates the initial context with the possibility to delay its
+ * initialisation.
+ *
+ * @param lazy specified if the initialization should not be performed by this
+ * constructor (true). If the valueis false, it works the same way as
+ * the parameterless constructor.
+ * @throws NamingException
+ */
+ protected InitialContext(boolean lazy) throws NamingException
+ {
+ if (! lazy)
+ init(null);
+ }
+
+ /**
+ * Creates teh new initial context with no properties. Same as
+ * InitialContext(null).
+ *
+ * @throws NamingException
+ */
+ public InitialContext() throws NamingException
+ {
+ init(null);
+ }
+
+ /**
+ * <p>
+ * Initialises the context, using the properties, specified in the passed
+ * table.
+ * </p>
+ * The missing properties are additionally obtained (in order) from the
+ * following locations:
+ * <ul>
+ * <li>If the passed parameter contains the key Context.APPLET, its value
+ * must be the instance of the {@link Applet}. Then the properties are
+ * requested via {@link Applet#getParameter(String)}.</li>
+ * <li>The value of the system property is used.</li>
+ * <li>The resource "jndi.properties" is requested from the context class
+ * loader of the current thread</li>
+ * <li>The property file "jndi.properties" is read from the location,
+ * specified by the system property "gnu.classpath.home.url".
+ * </ul>
+ * </p>
+ *
+ * @param environment the table of the properties, may be null. The method
+ * modifies the table and stores the reference to it. The caller must
+ * not later reuse this structure for other purposes.
+ * @since 1.3
+ */
+ protected void init(Hashtable environment) throws NamingException
+ {
+ // If is documented that the caller should not modify the environment.
+ if (environment != null)
+ myProps = environment;
+ else
+ myProps = new Hashtable();
+
+ Applet napplet = (Applet) myProps.get(Context.APPLET);
+
+ Properties pApplet = null;
+ if (napplet != null)
+ pApplet = new Properties();
+ Properties pSystem = new Properties();
+ Object value;
+
+ for (int i = use_properties.length - 1; i >= 0; i--)
+ {
+ String key = use_properties[i];
+ if (napplet != null)
+ {
+ value = napplet.getParameter(key);
+ if (value != null)
+ pApplet.put(key, value);
+ }
+
+ value = System.getProperty(key);
+ if (value != null)
+ pSystem.put(key, value);
+ }
+
+ merge(myProps, pSystem);
+ if (pApplet != null)
+ merge(myProps, pApplet);
+
+ try
+ {
+ Enumeration ep = Thread.currentThread().
+ getContextClassLoader().getResources("jndi.properties");
+ while (ep.hasMoreElements())
+ {
+ URL url = (URL) ep.nextElement();
+ Properties p = new Properties();
+
+ try
+ {
+ InputStream is = url.openStream();
+ p.load(is);
+ is.close();
+ }
+ catch (IOException e)
+ {
+ // Ignore.
+ }
+
+ merge(myProps, p);
+ }
+ }
+ catch (IOException e)
+ {
+ // Ignore.
+ }
+
+ String home = System.getProperty("gnu.classpath.home.url");
+ if (home != null)
+ {
+ String url = home + "/jndi.properties";
+ Properties p = new Properties();
+
+ try
+ {
+ InputStream is = new URL(url).openStream();
+ p.load(is);
+ is.close();
+ }
+ catch (IOException e)
+ {
+ // Ignore.
+ }
+
+ merge(myProps, p);
+ }
+ }
+
+ /**
+ * Merge the content of the two tables. If the second table contains the key
+ * that is missing in the first table, this key - value pair is copied to the
+ * first table. If both first and second tables contain the same key AND the
+ * {@link #colon_list} set also contains this key, the value from the second
+ * table is appended to the value from the first table after semicolon, and
+ * the resulted value replaces the value in the first table.
+ *
+ * @param primary the first table to merge. The merged result is also stored
+ * in this table.
+ * @param additional the second table, from where additional values are taken
+ */
+ static void merge (Hashtable primary, Hashtable additional)
+ {
+ Enumeration en = additional.keys();
+
+ while (en.hasMoreElements())
+ {
+ String key2 = (String) en.nextElement();
+ Object value1 = primary.get(key2);
+ if (value1 == null)
+ primary.put(key2, additional.get(key2));
+ else if (colon_list.contains(key2))
+ {
+ String value2 = (String) additional.get(key2);
+ primary.put(key2, (String) value1 + ":" + value2);
+ }
+ }
+ }
+
+ /**
+ * Get the default initial context. If {@link #gotDefault} == false, this
+ * method obtains the initial context from the naming manager and sets
+ * gotDefault to true. Otherwise the cached value ({@link #defaultInitCtx} is
+ * returned.
+ *
+ * @return the default initial context
+ * @throws NamingException
+ */
+ protected Context getDefaultInitCtx() throws NamingException
+ {
+ if (! gotDefault)
+ {
+ defaultInitCtx = NamingManager.getInitialContext(myProps);
+ gotDefault = true;
+ }
+ return defaultInitCtx;
+ }
+
+ /**
+ * Obtains the context for resolving the given name. If the first component of
+ * the name is the URL string, this method tries to find the corressponding
+ * URL naming context. If it is not an URL string, or the URL context is not
+ * found, the default initial context is returned.
+ *
+ * @param name the name, for that it is required to obtain the context.
+ * @return the context for resolving the name.
+ * @throws NamingException
+ */
+ protected Context getURLOrDefaultInitCtx(Name name) throws NamingException
+ {
+ if (name.size() > 0)
+ return getURLOrDefaultInitCtx(name.get(0));
+ else
+ return getDefaultInitCtx();
+ }
+
+ /**
+ * Obtains the context for resolving the given name. If the first component of
+ * the name is the URL string, this method tries to find the corressponding
+ * URL naming context. If it is not an URL string, or the URL context is not
+ * found, the default initial context is returned.
+ *
+ * @param name the name, for that it is required to obtain the context.
+ * @return the context for resolving the name.
+ * @throws NamingException
+ */
+ protected Context getURLOrDefaultInitCtx(String name) throws NamingException
+ {
+ String scheme = null;
+
+ if (NamingManager.hasInitialContextFactoryBuilder())
+ return getDefaultInitCtx();
+ int colon = name.indexOf(':');
+ int slash = name.indexOf('/');
+ if (colon > 0 && (slash == - 1 || colon < slash))
+ scheme = name.substring(0, colon);
+ if (scheme != null)
+ {
+ Context context = NamingManager.getURLContext(scheme, myProps);
+ if (context != null)
+ return context;
+ }
+
+ return getDefaultInitCtx();
+ }
+
+ /** @inheritDoc */
+ public void bind (Name name, Object obj) throws NamingException
+ {
+ getURLOrDefaultInitCtx (name).bind (name, obj);
+ }
+
+ /** @inheritDoc */
+ public void bind (String name, Object obj) throws NamingException
+ {
+ getURLOrDefaultInitCtx (name).bind (name, obj);
+ }
+
+ /** @inheritDoc */
+ public Object lookup (Name name) throws NamingException
+ {
+ try
+ {
+ return getURLOrDefaultInitCtx (name).lookup (name);
+ }
+ catch (CannotProceedException cpe)
+ {
+ Context ctx = NamingManager.getContinuationContext (cpe);
+ return ctx.lookup (cpe.getRemainingName());
+ }
+ }
+
+ /** @inheritDoc */
+ public Object lookup (String name) throws NamingException
+ {
+ try
+ {
+ return getURLOrDefaultInitCtx (name).lookup (name);
+ }
+ catch (CannotProceedException cpe)
+ {
+ Context ctx = NamingManager.getContinuationContext (cpe);
+ return ctx.lookup (cpe.getRemainingName());
+ }
+ }
+
+ /** @inheritDoc */
+ public void rebind (Name name, Object obj) throws NamingException
+ {
+ getURLOrDefaultInitCtx (name).rebind (name, obj);
+ }
+
+ /** @inheritDoc */
+ public void rebind (String name, Object obj) throws NamingException
+ {
+ getURLOrDefaultInitCtx (name).rebind (name, obj);
+ }
+
+ /** @inheritDoc */
+ public void unbind (Name name) throws NamingException
+ {
+ getURLOrDefaultInitCtx (name).unbind (name);
+ }
+
+ /** @inheritDoc */
+ public void unbind (String name) throws NamingException
+ {
+ getURLOrDefaultInitCtx (name).unbind (name);
+ }
+
+ /** @inheritDoc */
+ public void rename (Name oldName, Name newName) throws NamingException
+ {
+ getURLOrDefaultInitCtx (oldName).rename (oldName, newName);
+ }
+
+ /** @inheritDoc */
+ public void rename (String oldName, String newName) throws NamingException
+ {
+ getURLOrDefaultInitCtx (oldName).rename (oldName, newName);
+ }
+
+ /** @inheritDoc */
+ public NamingEnumeration list (Name name) throws NamingException
+ {
+ return getURLOrDefaultInitCtx (name).list (name);
+ }
+
+ /** @inheritDoc */
+ public NamingEnumeration list (String name) throws NamingException
+ {
+ return getURLOrDefaultInitCtx (name).list (name);
+ }
+
+ /** @inheritDoc */
+ public NamingEnumeration listBindings (Name name) throws NamingException
+ {
+ return getURLOrDefaultInitCtx (name).listBindings (name);
+ }
+
+ /** @inheritDoc */
+ public NamingEnumeration listBindings (String name) throws NamingException
+ {
+ return getURLOrDefaultInitCtx (name).listBindings (name);
+ }
+
+ /** @inheritDoc */
+ public void destroySubcontext (Name name) throws NamingException
+ {
+ getURLOrDefaultInitCtx (name).destroySubcontext (name);
+ }
+
+ /** @inheritDoc */
+ public void destroySubcontext (String name) throws NamingException
+ {
+ getURLOrDefaultInitCtx (name).destroySubcontext (name);
+ }
+
+ /** @inheritDoc */
+ public Context createSubcontext (Name name) throws NamingException
+ {
+ return getURLOrDefaultInitCtx (name).createSubcontext (name);
+ }
+
+ /** @inheritDoc */
+ public Context createSubcontext (String name) throws NamingException
+ {
+ return getURLOrDefaultInitCtx (name).createSubcontext (name);
+ }
+
+ /** @inheritDoc */
+ public Object lookupLink (Name name) throws NamingException
+ {
+ return getURLOrDefaultInitCtx (name).lookupLink (name);
+ }
+
+ /** @inheritDoc */
+ public Object lookupLink (String name) throws NamingException
+ {
+ return getURLOrDefaultInitCtx (name).lookupLink (name);
+ }
+
+ /** @inheritDoc */
+ public NameParser getNameParser (Name name) throws NamingException
+ {
+ return getURLOrDefaultInitCtx (name).getNameParser (name);
+ }
+
+ /** @inheritDoc */
+ public NameParser getNameParser (String name) throws NamingException
+ {
+ return getURLOrDefaultInitCtx (name).getNameParser (name);
+ }
+
+ /** @inheritDoc */
+ public Name composeName (Name name, Name prefix) throws NamingException
+ {
+ return getURLOrDefaultInitCtx (name).composeName (name, prefix);
+ }
+
+ /** @inheritDoc */
+ public String composeName (String name,
+ String prefix) throws NamingException
+ {
+ return getURLOrDefaultInitCtx (name).composeName (name, prefix);
+ }
+
+ /** @inheritDoc */
+ public Object addToEnvironment (String propName,
+ Object propVal) throws NamingException
+ {
+ return myProps.put (propName, propVal);
+ }
+
+ /** @inheritDoc */
+ public Object removeFromEnvironment (String propName) throws NamingException
+ {
+ return myProps.remove (propName);
+ }
+
+ /** @inheritDoc */
+ public Hashtable getEnvironment () throws NamingException
+ {
+ return myProps;
+ }
+
+ /** @inheritDoc */
+ public void close () throws NamingException
+ {
+ myProps = null;
+ defaultInitCtx = null;
+ }
+
+ /**
+ * This operation is not supported for the initial naming context.
+ *
+ * @throws OperationNotSupportedException always, unless the method is
+ * overridden in the derived class.
+ */
+ public String getNameInNamespace () throws NamingException
+ {
+ throw new OperationNotSupportedException ();
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/InsufficientResourcesException.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/InsufficientResourcesException.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/InsufficientResourcesException.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/InsufficientResourcesException.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,55 @@
+/* InsufficientResourcesException.java --
+ Copyright (C) 2000, 2004, 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.naming;
+
+
+public class InsufficientResourcesException extends NamingException
+{
+ private static final long serialVersionUID = 6227672693037844532L;
+
+ public InsufficientResourcesException ()
+ {
+ super ();
+ }
+
+ public InsufficientResourcesException (String msg)
+ {
+ super (msg);
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/InterruptedNamingException.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/InterruptedNamingException.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/InterruptedNamingException.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/InterruptedNamingException.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,55 @@
+/* InterruptedNamingException.java --
+ Copyright (C) 2000, 2004, 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.naming;
+
+
+public class InterruptedNamingException extends NamingException
+{
+ private static final long serialVersionUID = 6404516648893194728L;
+
+ public InterruptedNamingException ()
+ {
+ super ();
+ }
+
+ public InterruptedNamingException (String msg)
+ {
+ super (msg);
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/InvalidNameException.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/InvalidNameException.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/InvalidNameException.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/InvalidNameException.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,68 @@
+/* InvalidNameException.java -- Exception indicating an invalid component/name
+ Copyright (C) 2000, 2001, 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.naming;
+
+/**
+ * Exception indicating an invalid component or <code>Name</code>.
+ * Thrown when a <code>Name</code> or component of a name is encountered that
+ * does not follow the syntactic rules of a particular <code>Name</code> class.
+ *
+ * @author Anthony Green (green at redhat.com)
+ * @author Mark Wielaard (mark at klomp.org)
+ */
+public class InvalidNameException extends NamingException
+{
+ private static final long serialVersionUID = - 8370672380823801105L;
+
+ /**
+ * Creates a new exception without setting any of its fields.
+ */
+ public InvalidNameException ()
+ {
+ super ();
+ }
+
+ /**
+ * Creates a new exception and sets the detailed message field.
+ * All other fields are not set.
+ */
+ public InvalidNameException (String msg)
+ {
+ super (msg);
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/LimitExceededException.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/LimitExceededException.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/LimitExceededException.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/LimitExceededException.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,55 @@
+/* LimitExceededException.java --
+ Copyright (C) 2000, 2004, 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.naming;
+
+
+public class LimitExceededException extends NamingException
+{
+ private static final long serialVersionUID = - 776898738660207856L;
+
+ public LimitExceededException ()
+ {
+ super ();
+ }
+
+ public LimitExceededException (String msg)
+ {
+ super (msg);
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/LinkException.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/LinkException.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/LinkException.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/LinkException.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,119 @@
+/* LinkException.java --
+ Copyright (C) 2001, 2004, 2005, 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.naming;
+
+
+/**
+ * @author Warren Levy (warrenl at redhat.com)
+ * @date June 14, 2001
+ */
+
+public class LinkException extends NamingException
+{
+ private static final long serialVersionUID = - 7967662604076777712L;
+
+ // Serialized fields.
+ protected Name linkResolvedName;
+ protected Object linkResolvedObj;
+ protected Name linkRemainingName;
+ protected String linkExplanation;
+
+ public LinkException ()
+ {
+ super ();
+ }
+
+ public LinkException (String msg)
+ {
+ super (msg);
+ }
+
+ public Name getLinkResolvedName()
+ {
+ return linkResolvedName;
+ }
+
+ public Name getLinkRemainingName()
+ {
+ return linkRemainingName;
+ }
+
+ public Object getLinkResolvedObj()
+ {
+ return linkResolvedObj;
+ }
+
+ public String getLinkExplanation()
+ {
+ return linkExplanation;
+ }
+
+ public void setLinkExplanation(String msg)
+ {
+ linkExplanation = msg;
+ }
+
+ public void setLinkResolvedName(Name name)
+ {
+ linkResolvedName = (Name) name.clone();
+ }
+
+ public void setLinkRemainingName(Name name)
+ {
+ linkRemainingName = (Name) name.clone();
+ }
+
+ public void setLinkResolvedObj(Object obj)
+ {
+ linkResolvedObj = obj;
+ }
+
+ public String toString ()
+ {
+ return super.toString () + "; " + linkRemainingName.toString ();
+ }
+
+ public String toString (boolean detail)
+ {
+ String r = super.toString (detail) + "; " + linkRemainingName.toString ();
+ if (detail)
+ r += "; " + linkResolvedObj.toString ();
+ return r;
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/LinkLoopException.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/LinkLoopException.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/LinkLoopException.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/LinkLoopException.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,55 @@
+/* LinkLoopException.java --
+ Copyright (C) 2000, 2004, 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.naming;
+
+
+public class LinkLoopException extends LinkException
+{
+ private static final long serialVersionUID = - 3119189944325198009L;
+
+ public LinkLoopException ()
+ {
+ super ();
+ }
+
+ public LinkLoopException (String msg)
+ {
+ super (msg);
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/LinkRef.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/LinkRef.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/LinkRef.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/LinkRef.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,67 @@
+/* LinkRef.java --
+ Copyright (C) 2001, 2004, 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.naming;
+
+
+/**
+ * @author Tom Tromey (tromey at redhat.com)
+ * @date May 16, 2001
+ */
+public class LinkRef extends Reference
+{
+ private static final long serialVersionUID = -5386290613498931298L;
+
+ public LinkRef (Name name)
+ {
+ this (name.toString ());
+ }
+
+ public LinkRef (String name)
+ {
+ // FIXME: javax.naming.LinkRef?
+ super ("LinkRef", new StringRefAddr ("LinkAddress", name));
+ }
+
+ public String getLinkName ()
+ throws NamingException
+ {
+ StringRefAddr sra = (StringRefAddr) get (0);
+ return (String) sra.getContent ();
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/MalformedLinkException.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/MalformedLinkException.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/MalformedLinkException.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/MalformedLinkException.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,55 @@
+/* MalformedLinkException.java --
+ Copyright (C) 2000, 2004, 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.naming;
+
+
+public class MalformedLinkException extends LinkException
+{
+ private static final long serialVersionUID = - 3066740437737830242L;
+
+ public MalformedLinkException ()
+ {
+ super ();
+ }
+
+ public MalformedLinkException (String msg)
+ {
+ super (msg);
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/Name.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/Name.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/Name.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/Name.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,198 @@
+/* Name.java -- Name build up from different components
+ Copyright (C) 2000, 2001, 2004, 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.naming;
+
+import java.io.Serializable;
+import java.util.Enumeration;
+
+/**
+ * Interface descriping a name build up from different components.
+ * The components are represented as <code>String</code>s which are
+ * ordered from most significant to least significant. There are methods to
+ * get the number of components. Methods to get a particular component or group
+ * of components. Components can be added as <code>String</code>s or
+ * <code>Name</code>s and a component can be removed from any position in the
+ * <code>Name</code>.
+ * A <code>Name</code> can be compared to another <code>Name</code> and it can
+ * be checked if a particular <code>Name</code> starts or ends with the same
+ * components as another <code>Name</code>. Finally <code>Name</code>s can be
+ * serialized and cloned.
+ * <p>
+ * Since <code>Name</code>s can be empty (have no components) methods that
+ * return a <code>Name</code> will never return <code>null</code>.
+ *
+ * @since 1.3
+ * @author Anthony Green (green at redhat.com)
+ * @author Mark Wielaard (mark at klomp.org)
+ */
+public interface Name extends Cloneable, Serializable, Comparable
+{
+ long serialVersionUID = -3617482732056931635L;
+
+ /**
+ * Returns the number of components of this <code>Name</code>.
+ * The returned number can be zero.
+ */
+ int size();
+
+ /**
+ * Returns <code>true</code> if the number of components of this
+ * <code>Name</code> is zero, <code>false</code> otherwise.
+ */
+ boolean isEmpty();
+
+ /**
+ * Returns a non-null (but possibly empty) <code>Enumeration</code> of the
+ * components of the <code>Name</code> as <code>String</code>s.
+ */
+ Enumeration getAll();
+
+ /**
+ * Gets the component at the given index.
+ *
+ * @exception ArrayIndexOutOfBoundsException if the given index is smaller
+ * then zero or greater then or equal to <code>size()</code>.
+ */
+ String get(int i);
+
+ /**
+ * Returns the components till the given index as a <code>Name</code>.
+ * The returned <code>Name</code> can be modified without changing the
+ * original.
+ *
+ * @exception ArrayIndexOutOfBoundsException if the given index is smaller
+ * then zero or greater then or equal to <code>size()</code>.
+ */
+ Name getPrefix(int i);
+
+ /**
+ * Returns the components from the given index till the end as a
+ * <code>Name</code>.
+ * The returned <code>Name</code> can be modified without changing the
+ * original.
+ *
+ * @exception ArrayIndexOutOfBoundsException if the given index is smaller
+ * then zero or greater then or equal to <code>size()</code>.
+ */
+ Name getSuffix(int i);
+
+ /**
+ * Adds the given <code>String</code> component to the end of this
+ * <code>Name</code>. The method modifies the current <code>Name</code> and
+ * then returns it.
+ *
+ * @exception InvalidNameException if the given <code>String</code> is not a
+ * valid component for this <code>Name</code>.
+ */
+ Name add(String comp) throws InvalidNameException;
+
+ /**
+ * Inserts the given <code>String</code> component to this <code>Name</code>
+ * at the given index. The method modifies the current <code>Name</code> and
+ * then returns it.
+ *
+ * @exception ArrayIndexOutOfBoundsException if the given index is smaller
+ * then zero or greater then or equal to <code>size()</code>.
+ * @exception InvalidNameException if the given <code>String</code> is not a
+ * valid component for this <code>Name</code>.
+ */
+ Name add(int posn, String comp) throws InvalidNameException;
+
+ /**
+ * Adds all the components of the given <code>Name</code> to the end of this
+ * <code>Name</code>. The method modifies the current <code>Name</code> and
+ * then returns it.
+ *
+ * @exception InvalidNameException if any of the given components is not a
+ * valid component for this <code>Name</code>.
+ */
+ Name addAll(Name suffix) throws InvalidNameException;
+
+ /**
+ * Inserts all the components of the given <code>Name</code> to this
+ * <code>Name</code> at the given index. The method modifies the current
+ * <code>Name</code> and then returns it.
+ *
+ * @exception ArrayIndexOutOfBoundsException if the given index is smaller
+ * then zero or greater then or equal to <code>size()</code>.
+ * @exception InvalidNameException if any of the given components is not a
+ * valid component for this <code>Name</code>.
+ */
+ Name addAll(int posn, Name n) throws InvalidNameException;
+
+ /**
+ * Removes the component at the given index from this <code>Name</code>.
+ * The method modifies the current <code>Name</code> and then returns it.
+ *
+ * @exception InvalidNameException if the given <code>String</code> is not a
+ * valid component for this <code>Name</code>.
+ */
+ Object remove(int posn) throws InvalidNameException;
+
+ /**
+ * Returns <code>true</code> if this <code>Name</code> starts with the
+ * components of the given <code>Name</code>, <code>false</code> otherwise.
+ */
+ boolean startsWith(Name name);
+
+ /**
+ * Returns <code>true</code> if this <code>Name</code> ends with the
+ * components of the given <code>Name</code>, <code>false</code> otherwise.
+ */
+ boolean endsWith(Name name);
+
+ /**
+ * Compares the given object to this <code>Name</code>.
+ * Returns a negative value if the given <code>Object</code> is smaller then
+ * this <code>Name</code>, a positive value if the <code>Object</code> is
+ * bigger, and zero if the are equal. If the <code>Object</code> is not of
+ * a class that can be compared to the class of this <code>Name</code> then
+ * a <code>ClassCastException</code> is thrown. Note that it is not
+ * guaranteed that <code>Name</code>s implemented in different classes can
+ * be compared. The definition of smaller, bigger and equal is up to the
+ * actual implementing class.
+ */
+ int compareTo(Object obj);
+
+ /**
+ * Returns a clone of this <code>Name</code>. It will be a deep copy of
+ * all the components of the <code>Name</code> so that changes to components
+ * of the components does not change the component in this <code>Name</code>.
+ */
+ Object clone();
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/NameAlreadyBoundException.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/NameAlreadyBoundException.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/NameAlreadyBoundException.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/NameAlreadyBoundException.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,55 @@
+/* NameAlreadyBoundException.java --
+ Copyright (C) 2000, 2004, 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.naming;
+
+
+public class NameAlreadyBoundException extends NamingException
+{
+ private static final long serialVersionUID = - 8491441000356780586L;
+
+ public NameAlreadyBoundException ()
+ {
+ super ();
+ }
+
+ public NameAlreadyBoundException (String msg)
+ {
+ super (msg);
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/NameClassPair.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/NameClassPair.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/NameClassPair.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/NameClassPair.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,198 @@
+/* NameClassPair.java --
+ Copyright (C) 2001, 2005, 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.naming;
+
+import java.io.Serializable;
+
+/**
+ * <code>NameClassPair</code> represents the name-classname mapping pair
+ * of a binding in a context.
+ * <p>
+ * Bindings are mappings of a name to an object and this class is used to
+ * specify the mapping of the name to the class type of the bound object.
+ * As classname the fully qualified classname is used.
+ * </p>
+ *
+ * @author Tom Tromey (tromey at redhat.com)
+ * @since 1.3
+ */
+public class NameClassPair implements Serializable
+{
+ private static final long serialVersionUID = 5620776610160863339L;
+
+ /**
+ * Constructs an instance with the given name and classname.
+ *
+ * @param name the name of the binding relative to the target context
+ * (may not be <code>null</code>)
+ * @param className the name of the class. If <code>null</code> the bound
+ * object is also <code>null</code>
+ */
+ public NameClassPair (String name, String className)
+ {
+ this (name, className, true);
+ }
+
+ /**
+ * Constructs an instance with the given name and classname and a
+ * flag indicating if the name is relative to the target context.
+ *
+ * @param name the name of the binding (may not be <code>null</code>)
+ * @param className the name of the class. If <code>null</code> the bound
+ * object is also <code>null</code>
+ * @param isRelative flag indicating if the name is relative or not
+ */
+ public NameClassPair (String name, String className, boolean isRelative)
+ {
+ this.name = name;
+ this.className = className;
+ this.isRel = isRelative;
+ }
+
+ /**
+ * Returns the classname of the binding.
+ * @return The fully qualified classname or <code>null</code> if the
+ * bound object is null.
+ */
+ public String getClassName ()
+ {
+ return className;
+ }
+
+ /**
+ * Returns the name of the binding.
+ * @return The name.
+ */
+ public String getName ()
+ {
+ return name;
+ }
+
+ /**
+ * Checks whether the name is relative to the target context or not.
+ * @return <code>true</code> if the name is relative,
+ * <code>false</code> otherwise.
+ */
+ public boolean isRelative ()
+ {
+ return isRel;
+ }
+
+ /**
+ * Sets the classname of the bound object.
+ * @param name the classname to set (maybe <code>null</code>)
+ */
+ public void setClassName (String name)
+ {
+ this.className = name;
+ }
+
+ /**
+ * Sets the name of the binding.
+ * @param name the name to set
+ */
+ public void setName (String name)
+ {
+ this.name = name;
+ }
+
+ /**
+ * Sets if the name is relative to the target context.
+ * @param r <code>true</code> to mark as relative
+ */
+ public void setRelative (boolean r)
+ {
+ this.isRel = r;
+ }
+
+ /**
+ * Sets the full name for this binding. Setting the full name by this
+ * method is the only way to initialize full names of bindings if
+ * supported by a specific naming system.
+ *
+ * @param fullName the full name of this binding. If not set or set to
+ * <code>null</code> the <code>getNameInNamespace()</code> method will
+ * throw an exception
+ *
+ * @see #getNameInNamespace()
+ *
+ * @since 1.5
+ */
+ public void setNameInNamespace(String fullName)
+ {
+ this.fullName = fullName;
+ }
+
+ /**
+ * Returns the full name for this binding. The full name of a binding is
+ * defined as the absolute name in its own namespace and is not valid
+ * outside.
+ *
+ * @return The full name in the bindings namespace.
+ * @throws UnsupportedOperationException if no full name is applicable in
+ * the specific naming system.
+ *
+ * @see Context#getNameInNamespace()
+ *
+ * @since 1.5
+ */
+ public String getNameInNamespace()
+ {
+ if (this.fullName == null)
+ throw new UnsupportedOperationException();
+
+ return this.fullName;
+ }
+
+ /**
+ * Returns the string representation.
+ * @return The string <code>getName() + ":" + getClassName()</code>.
+ */
+ public String toString ()
+ {
+ // Specified by class documentation.
+ return name + ":" + className;
+ }
+
+ // These field names are fixed by the serialization spec.
+ private String name;
+ private String className;
+ private boolean isRel;
+ private String fullName;
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/NameNotFoundException.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/NameNotFoundException.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/NameNotFoundException.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/NameNotFoundException.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,55 @@
+/* NameNotFoundException.java --
+ Copyright (C) 2000, 2004, 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.naming;
+
+
+public class NameNotFoundException extends NamingException
+{
+ private static final long serialVersionUID = - 8007156725367842053L;
+
+ public NameNotFoundException ()
+ {
+ super ();
+ }
+
+ public NameNotFoundException (String msg)
+ {
+ super (msg);
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/NameParser.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/NameParser.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/NameParser.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/NameParser.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,62 @@
+/* NameParser.java -- JNDI name parser interface
+ Copyright (C) 2000, 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.naming;
+
+/**
+ * Parser the string representation of the given name into the {@link Name}
+ * representation.
+ *
+ * @see Context#getNameParser(String)
+ * @see Context#getNameParser(Name)
+ */
+public interface NameParser
+{
+ /**
+ * Parser the string name representation into the {@link Name} representation
+ *
+ * @param name the string representation of the name
+ * @return the {@link Name} representation of the name.
+ * @throws InvalidNameException if the name violates the syntax, expected by
+ * this parser
+ * @throws NamingException if some other naming exception occurs
+ */
+ Name parse (String name) throws NamingException;
+}
+
+
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/NamingEnumeration.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/NamingEnumeration.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/NamingEnumeration.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/NamingEnumeration.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,89 @@
+/* NamingEnumeration.java -- The JNDI enumeration
+ Copyright (C) 2000, 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.naming;
+
+import java.util.Enumeration;
+
+/**
+ * <p>The specific type of enumeration that supports throwing various exceptions by
+ * the hasMore method. The exceptions are only thrown if the enumeration is
+ * scanned using {@link #next()} and {@link #hasMore()}. If the inherited
+ * {@link java.util.Enumeration#nextElement()} and
+ * {@link Enumeration#hasMoreElements()} are used instead, the exceptions are
+ * not throwed, and the enumeration is just iterated over available elements.
+ * </p>
+ * <p>This enumeration becomes invalid after throwing the exception. If the
+ * exception has been thrown, not other method should be called of that
+ * enumeration.</p>
+ */
+public interface NamingEnumeration extends Enumeration
+{
+ /**
+ * Returns the next element in this enumeration. The naming - specific
+ * exceptions are only throws after returning all still available elements of
+ * the enumeration.
+ *
+ * @return the next element of this enumeration
+ * @throws NamingException
+ */
+ Object next() throws NamingException;
+
+ /**
+ * Checks if there are more unvisited elements in the enumeration, throwing
+ * exceptions if there are some unvisited, but not available elements.
+ *
+ * @return true if there are some unvisited elements, false otherwise.
+ * @throws PartialResultException if the enumeration, returned by the
+ * {@link Context#list(Name)} or other similar method contains only
+ * partial answer.
+ * @throws SizeLimitExceededException if remaining elements are not available
+ * because of the previously specified size limit.
+ * @throws NamingException
+ */
+ boolean hasMore() throws NamingException;
+
+ /**
+ * Immediately frees all resources, owned by this enumeration. If invoked, it
+ * must be the last method called for that enumeration.
+ *
+ * @throws NamingException
+ */
+ void close() throws NamingException;
+
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/NamingException.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/NamingException.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/NamingException.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/NamingException.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,315 @@
+/* NamingException.java -- Superclass of all naming Exceptions
+ Copyright (C) 2000, 2001 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.naming;
+
+import java.io.PrintStream;
+import java.io.PrintWriter;
+
+/**
+ * Superclass of all naming Exceptions.
+ * Can contain extra information about the root cause of this exception
+ * (for example when the original exception was not a subclass of
+ * <code>NamingException</code>), the part of the <code>Name</code> that
+ * could be resolved (including the <code>Object</code> it resolved to)
+ * and the part of the <code>Name</code> that could not be resolved when
+ * the exception occured.
+ *
+ * @since 1.3
+ * @author Anthony Green (green at redhat.com)
+ * @author Mark Wielaard (mark at klomp.org)
+ */
+public class NamingException extends Exception
+{
+ private static final long serialVersionUID = -1299181962103167177L;
+
+ /**
+ * The root cause of this exception. Might be null. Set by calling
+ * <code>setRootCause()</code>, can be accessed by calling
+ * <code>getRootCause()</code>.
+ */
+ protected Throwable rootException;
+
+ /**
+ * If the exception was caused while resolving a <code>Name</code> then
+ * this field contains that part of the name that could be resolved.
+ * Field might be null. Set by calling <code>setResolvedName()</code>.
+ * Can be accessed by calling <code>getResolvedName</code>.
+ */
+ protected Name resolvedName;
+
+ /**
+ * If the exception was caused while resolving a <code>Name</code> then
+ * this field contains the object that part of the name could be resolved to.
+ * Field might be null. Set by calling <code>setResolvedObj()</code>.
+ * Can be accessed by calling <code>getResolvedObj</code>.
+ */
+ protected Object resolvedObj;
+
+ /**
+ * If the exception was caused while resolving a <code>Name</code> then
+ * this field contains that part of the name that could not be resolved.
+ * Field might be null. Set by calling <code>setRemainingName()</code>.
+ * The field can be extended by calling <code>appendRemainingName()</code>
+ * or <code>appendRemainingComponent()</code>.
+ * Can be accessed by calling <code>getRemainingName</code>.
+ */
+ protected Name remainingName;
+
+ /**
+ * Creates a new NamingException without a message. Does not set any of the
+ * <code>rootException</code>, <code>resolvedName</code>,
+ * <code>resolvedObj</code> or <code>remainingObject</code> fields.
+ * These fields can be set later.
+ */
+ public NamingException ()
+ {
+ super();
+ }
+
+ /**
+ * Creates a new NamingException with a detailed message. Does not set
+ * the <code>rootException</code>, <code>resolvedName</code>,
+ * <code>resolvedObj</code> or <code>remainingObject,</code> fields.
+ * These fields can be set later.
+ */
+ public NamingException (String msg)
+ {
+ super(msg);
+ }
+
+ /**
+ * Gets the root cause field <code>rootException</code> of this Exception.
+ */
+ public Throwable getRootCause ()
+ {
+ return rootException;
+ }
+
+ /**
+ * Sets the root cause field <code>rootException</code> of this Exception.
+ */
+ public void setRootCause (Throwable e)
+ {
+ rootException = e;
+ }
+
+ /**
+ * Gets the part of the name that could be resolved before this exception
+ * happend. Returns the <code>resolvedName</code> field of this Exception.
+ */
+ public Name getResolvedName ()
+ {
+ return resolvedName;
+ }
+
+ /**
+ * Sets the part of the name that could be resolved before this exception
+ * happend. Sets the <code>resolvedName</code> field of this Exception.
+ */
+ public void setResolvedName (Name name)
+ {
+ resolvedName = name;
+ }
+
+ /**
+ * Gets the Object to which (part of) the name could be resolved before this
+ * exception happend. Returns the <code>resolvedObj</code> field of this
+ * Exception.
+ */
+ public Object getResolvedObj ()
+ {
+ return resolvedObj;
+ }
+
+ /**
+ * Sets the Object to which (part of) the name could be resolved before this
+ * exception happend. Sets the <code>resolvedObj</code> field of this
+ * Exception.
+ */
+ public void setResolvedObj (Object o)
+ {
+ resolvedObj = o;
+ }
+
+ /**
+ * Gets the part of the name that could not be resolved before this exception
+ * happend. Returns the <code>remainingName</code> field of this Exception.
+ */
+ public Name getRemainingName ()
+ {
+ return remainingName;
+ }
+
+ /**
+ * Sets the part of the name that could be resolved before this exception
+ * happend. Sets the <code>resolvedName</code> field of this Exception.
+ * The field can be extended by calling <code>appendRemainingName()</code>
+ * or <code>appendRemainingComponent()</code>.
+ */
+ public void setRemainingName (Name name)
+ {
+ remainingName = name;
+ }
+
+ /**
+ * Adds the given <code>Name</code> to the <code>remainingName</code> field.
+ * Does nothing when <code>name</code> is null or when a
+ * <code>InvalidNameException</code> is thrown when adding the name.
+ *
+ * @see Name#addAll(Name)
+ */
+ public void appendRemainingName (Name name)
+ {
+ if (name != null)
+ try
+ {
+ remainingName.addAll(name);
+ }
+ catch(InvalidNameException ine) { /* ignored */ }
+ }
+
+ /**
+ * Adds the given <code>String</code> to the <code>remainingName</code> field.
+ * Does nothing when <code>name</code> is null or when a
+ * <code>InvalidNameException</code> is thrown when adding the component.
+ *
+ * @see Name#add(String)
+ */
+ public void appendRemainingComponent (String name)
+ {
+ if (name != null)
+ try
+ {
+ remainingName.add(name);
+ }
+ catch(InvalidNameException ine) { /* ignored */ }
+ }
+
+ /**
+ * Gets the message given to the constructor or null if no message was given.
+ *
+ * @see Throwable#getMessage()
+ */
+ public String getExplanation()
+ {
+ return getMessage();
+ }
+
+ /**
+ * Returns a String representation of this exception and possibly including
+ * the part object that could be resolved if the given flag is set to true.
+ * Always includes the root cause and the remaining name if not null.
+ */
+ public String toString(boolean objectInfo)
+ {
+ StringBuffer sb = new StringBuffer(super.toString());
+ Throwable cause = getRootCause();
+ if (cause != null)
+ {
+ sb.append(" caused by ");
+ sb.append(cause);
+ }
+ Name remaining = getRemainingName();
+ if (remaining != null)
+ {
+ sb.append(" [remainingName: ");
+ sb.append(remaining);
+ }
+ Object resolved = getResolvedObj();
+ if (objectInfo && resolved != null)
+ {
+ if (remainingName == null)
+ sb.append(" [");
+ else
+ sb.append(", ");
+ sb.append("resolvedObj: ");
+ sb.append(resolved);
+ }
+ if ((remaining != null) || (objectInfo && resolved != null))
+ sb.append(']');
+
+ return sb.toString();
+ }
+
+ /**
+ * Returns a string representation of this exception.
+ * Calls <code>toString(false)</code>.
+ */
+ public String toString()
+ {
+ return toString(false);
+ }
+ /**
+ * Prints the stacktrace of this exception or of the root cause if not null.
+ */
+ public void printStackTrace()
+ {
+ Throwable cause = getRootCause();
+ if (cause != null)
+ cause.printStackTrace();
+ else
+ super.printStackTrace();
+ }
+
+ /**
+ * Prints the stacktrace of this exception or of the root cause if not null
+ * to the given <code>PrintStream</code>.
+ */
+ public void printStackTrace(PrintStream ps)
+ {
+ Throwable cause = getRootCause();
+ if (cause != null)
+ cause.printStackTrace(ps);
+ else
+ super.printStackTrace(ps);
+ }
+
+ /**
+ * Prints the stacktrace of this exception or of the root cause if not null
+ * to the given <code>PrintWriter</code>.
+ */
+ public void printStackTrace(PrintWriter pw)
+ {
+ Throwable cause = getRootCause();
+ if (cause != null)
+ cause.printStackTrace(pw);
+ else
+ super.printStackTrace(pw);
+ }
+}
+
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/NamingSecurityException.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/NamingSecurityException.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/NamingSecurityException.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/NamingSecurityException.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,55 @@
+/* NamingSecurityException.java --
+ Copyright (C) 2000, 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.naming;
+
+
+public abstract class NamingSecurityException extends NamingException
+{
+ private static final long serialVersionUID = 5855287647294685775L;
+
+ public NamingSecurityException ()
+ {
+ super ();
+ }
+
+ public NamingSecurityException (String msg)
+ {
+ super (msg);
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/NoInitialContextException.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/NoInitialContextException.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/NoInitialContextException.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/NoInitialContextException.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,55 @@
+/* NoInitialContextException.java --
+ Copyright (C) 2000, 2004, 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.naming;
+
+
+public class NoInitialContextException extends NamingException
+{
+ private static final long serialVersionUID = - 3413733186901258623L;
+
+ public NoInitialContextException()
+ {
+ super();
+ }
+
+ public NoInitialContextException(String msg)
+ {
+ super(msg);
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/NoPermissionException.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/NoPermissionException.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/NoPermissionException.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/NoPermissionException.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,55 @@
+/* NoPermissionException.java --
+ Copyright (C) 2000, 2004, 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.naming;
+
+
+public class NoPermissionException extends NamingSecurityException
+{
+ private static final long serialVersionUID = 8395332708699751775L;
+
+ public NoPermissionException ()
+ {
+ super ();
+ }
+
+ public NoPermissionException (String msg)
+ {
+ super (msg);
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/NotContextException.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/NotContextException.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/NotContextException.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/NotContextException.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,55 @@
+/* NotContextException.java --
+ Copyright (C) 2000, 2004, 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.naming;
+
+
+public class NotContextException extends NamingException
+{
+ private static final long serialVersionUID = 849752551644540417L;
+
+ public NotContextException ()
+ {
+ super ();
+ }
+
+ public NotContextException (String msg)
+ {
+ super (msg);
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/OperationNotSupportedException.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/OperationNotSupportedException.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/OperationNotSupportedException.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/OperationNotSupportedException.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,54 @@
+/* OperationNotSupportedException.java --
+ Copyright (C) 2000, 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.naming;
+
+public class OperationNotSupportedException extends NamingException
+{
+ private static final long serialVersionUID = 5493232822427682064L;
+
+ public OperationNotSupportedException()
+ {
+ super();
+ }
+
+ public OperationNotSupportedException(String msg)
+ {
+ super(msg);
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/PartialResultException.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/PartialResultException.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/PartialResultException.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/PartialResultException.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,59 @@
+/* PartialResultException.java --
+ Copyright (C) 2000, 2004, 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.naming;
+
+/**
+ * Thrown from the {@link javax.naming.NamingEnumeration}, this exception
+ * indicates that the enumeration represents only part of the existing
+ * elements that would be an answer to the specified request.
+ */
+public class PartialResultException extends NamingException
+{
+ private static final long serialVersionUID = 2572144970049426786L;
+
+ public PartialResultException ()
+ {
+ super ();
+ }
+
+ public PartialResultException (String msg)
+ {
+ super (msg);
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/RefAddr.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/RefAddr.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/RefAddr.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/RefAddr.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,142 @@
+/* RefAddr.java -- Abstract superclass of addresses used in References
+ Copyright (C) 2000, 2001 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.naming;
+
+import java.io.Serializable;
+
+/**
+ * Abstract superclass of addresses used in References.
+ * A <code>Reference</code> object contains a <code>Vector</code> of
+ * <code>RefAddr</code>s which are used to reference/address the object.
+ * This abstract superclass keeps track of the type of address, which will be
+ * returned by <code>getType()</code>. And defines a abstract method
+ * <code>getContent()</code> which must be implemented in concrete subclasses
+ * such as <code>BinaryRefAddr</code> and <code>StringRefAddr</code>.
+ *
+ * @see Reference
+ * @see BinaryRefAddr
+ * @see StringRefAddr
+ * @since 1.3
+ * @author Anthony Green (green at redhat.com)
+ * @author Mark Wielaard (mark at klomp.org)
+ */
+public abstract class RefAddr implements Serializable
+{
+ /**
+ * The string resprenstation of the type of address.
+ * Set by the constructor and returned by the getType() method.
+ */
+ protected String addrType;
+
+ /**
+ * Protected constructor for use by subclasses.
+ * Sets the addrType field of this object to the supplied String.
+ *
+ * @exception NullPointerException if the supplied String is null.
+ */
+ protected RefAddr(String addrType)
+ {
+ if (addrType == null)
+ throw new NullPointerException("addrType cannot be null");
+
+ this.addrType = addrType;
+ }
+
+ /**
+ * Returns the non-null address type given to the constructor.
+ */
+ public String getType()
+ {
+ return addrType;
+ }
+
+ /**
+ * Returns the possibly null content of this RefAddr.
+ * The actual value is defined by the non-abstract subclass.
+ */
+ public abstract Object getContent();
+
+ /**
+ * Checks if the object is a RefAddr with the same type and content.
+ *
+ * @return true if the given object is an instance of RefAddr, the addrType
+ * is the same as this addrType and the content is equals to the
+ * content of this object.
+ */
+ public boolean equals(Object o)
+ {
+ if (o instanceof RefAddr)
+ {
+ RefAddr refAddr = (RefAddr) o;
+ if (this.getType().equals(refAddr.getType()))
+ {
+ Object c1 = this.getContent();
+ Object c2 = refAddr.getContent();
+ if (c1 == null)
+ return c2 == null;
+ else
+ return c1.equals(c2);
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Returns the hashCode which is the hasCode of the String returned by
+ * <code>getType()</code> plus the hashCode of the Object returned by
+ * <code>getContent</code> (when not null).
+ */
+ public int hashCode()
+ {
+ int result = getType().hashCode();
+ Object o = getContent();
+ if (o != null)
+ result += o.hashCode();
+
+ return result;
+ }
+
+ /**
+ * Returns a String representation of the RefAddr.
+ * Should only be used for debugging purposes.
+ */
+ public String toString()
+ {
+ return "[RefAddr type: " + getType() + " content: " + getContent() + ']';
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/Reference.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/Reference.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/Reference.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/Reference.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,306 @@
+/* Reference.java --
+ Copyright (C) 2000, 2001, 2005, 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.naming;
+
+import java.io.Serializable;
+import java.util.Enumeration;
+import java.util.Vector;
+
+/**
+ * This class represents a reference to an object that is located outside of the
+ * naming/directory system.
+ *
+ * @see Referenceable
+ *
+ * @author Tom Tromey (tromey at redhat.com)
+ */
+public class Reference implements Cloneable, Serializable
+{
+ private static final long serialVersionUID = - 1673475790065791735L;
+
+ /**
+ * The list of addresses, stored in this reference. The object may be
+ * have by several different addresses.
+ */
+ protected Vector addrs;
+
+ /**
+ * The name of the class factory to create an instance of the object,
+ * referenced by this reference.
+ */
+ protected String classFactory;
+
+ /**
+ * The location, from where the class factory should be loaded.
+ */
+ protected String classFactoryLocation;
+
+ /**
+ * The name of the class of the object, to that this reference refers.
+ */
+ protected String className;
+
+ /**
+ * Create a new reference that is referencting to the object of the
+ * specified class.
+ */
+ public Reference (String className)
+ {
+ this.className = className;
+ addrs = new Vector ();
+ }
+
+ /**
+ * Create a new reference that is referencing to the object of the
+ * specified class with the given address.
+ */
+ public Reference (String className, RefAddr addr)
+ {
+ this.className = className;
+ addrs = new Vector ();
+ addrs.add (addr);
+ }
+
+ /**
+ * Create a new reference that is referencing to the object of the
+ * specified class, specifying the class and location of the factory that
+ * produces these objects.
+ *
+ * @param className the object class name
+ * @param factoryClassName the object factory class name
+ * @param factoryLocation the object factory location
+ */
+ public Reference (String className, String factoryClassName,
+ String factoryLocation)
+ {
+ this.className = className;
+ this.classFactory = factoryClassName;
+ this.classFactoryLocation = factoryLocation;
+ addrs = new Vector ();
+ }
+
+ /**
+ * Create a new reference that is referencing to the object of the
+ * specified class, specifying the class and location of the factory that
+ * produces these objects and also the address of this object.
+ *
+ * @param className the object class name
+ * @param addr the address of the object
+ * @param factoryClassName the object factory class name
+ * @param factoryLocation the object factory location
+ */
+ public Reference (String className, RefAddr addr,
+ String factoryClassName, String factoryLocation)
+ {
+ this.className = className;
+ this.classFactory = factoryClassName;
+ this.classFactoryLocation = factoryLocation;
+ addrs = new Vector ();
+ addrs.add (addr);
+ }
+
+ /**
+ * Add the new address for this object at the given position of the
+ * address list.
+ */
+ public void add (int posn, RefAddr addr)
+ {
+ addrs.add (posn, addr);
+ }
+
+ /**
+ * Appends the new object address to the end of the address list.
+ */
+ public void add (RefAddr addr)
+ {
+ addrs.add (addr);
+ }
+
+ /**
+ * Removes all defined addresses of the object.
+ */
+ public void clear ()
+ {
+ addrs.clear ();
+ }
+
+ public Object clone ()
+ {
+ Reference r = new Reference (className, classFactory,
+ classFactoryLocation);
+ r.addrs = (Vector) addrs.clone ();
+ return r;
+ }
+
+ // Convenience function.
+ private boolean equals (String a, String b)
+ {
+ return (a == null) ? (b == null) : a.equals (b);
+ }
+
+ /**
+ * Compares two addresses for equality, by value.
+ */
+ public boolean equals (Object obj)
+ {
+ if (! (obj instanceof Reference))
+ return false;
+ Reference r = (Reference) obj;
+ return (equals (classFactory, r.classFactory)
+ && equals (classFactoryLocation, r.classFactoryLocation)
+ && equals (className, r.className)
+ && addrs.equals (r.addrs));
+ }
+
+ /**
+ * Get the address of this object at the given position.
+ */
+ public RefAddr get (int posn)
+ {
+ return (RefAddr) addrs.get (posn);
+ }
+
+ /**
+ * Get the given type of address for this object.
+ *
+ * @param addrType the needed type of address
+ *
+ * @return the address of this object, having the specified type. If there
+ * is no address of such type, null is returned.
+ */
+ public RefAddr get (String addrType)
+ {
+ for (int i = 0; i < addrs.size (); ++i)
+ {
+ RefAddr r = (RefAddr) addrs.get (i);
+ if (addrType.equals (r.getType ()))
+ return r;
+ }
+ return null;
+ }
+
+ /**
+ * Get the enumeration over all defined addresses of the object.
+ */
+ public Enumeration getAll ()
+ {
+ return addrs.elements ();
+ }
+
+ /**
+ * Get the name of the class of the referenced object.
+ *
+ * @see #className
+ */
+ public String getClassName ()
+ {
+ return className;
+ }
+
+ /**
+ * Get the location of the factory class of the referenced object.
+ *
+ * @see #classFactoryLocation
+ */
+ public String getFactoryClassLocation ()
+ {
+ return classFactoryLocation;
+ }
+
+ /**
+ * Get the name of the factory class of the referenced object
+ *
+ * @see #classFactory
+ */
+ public String getFactoryClassName ()
+ {
+ return classFactory;
+ }
+
+ /**
+ * Get the hashcode of this reference.
+ *
+ * @return the sum of the hash codes of the addresses.
+ */
+ public int hashCode ()
+ {
+ // The spec says the hash code is the sum of the hash codes of the
+ // addresses. It does not mention the other fields.
+ int h = 0;
+ for (int i = 0; i < addrs.size (); ++i)
+ h += addrs.get (i).hashCode ();
+ return h;
+ }
+
+ /**
+ * Remove the address at the given position.
+ *
+ * @param posn the position of the address to remove
+ *
+ * @return the removed address
+ */
+ public Object remove (int posn)
+ {
+ return addrs.remove (posn);
+ }
+
+ /**
+ * Return the number of the defined addresses.
+ */
+ public int size ()
+ {
+ return addrs.size ();
+ }
+
+ /**
+ * Return the string representation.
+ */
+ public String toString ()
+ {
+ String x = getClass ().toString () + "[";
+ for (int i = 0; i < addrs.size (); ++i)
+ {
+ if (i > 0)
+ x += ",";
+ x += addrs.get (i).toString ();
+ }
+ return x + "]";
+ }
+
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/Referenceable.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/Referenceable.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/Referenceable.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/Referenceable.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,56 @@
+/* Referenceable.java --
+ Copyright (C) 2000, 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.naming;
+
+/**
+ * The object, implementing this interface, can provided the
+ * {@link Reference} about itself.
+ */
+public interface Referenceable
+{
+ /**
+ * Get the reference about this object.
+ *
+ * @return the reference about this object, cannot be null.
+ *
+ * @throws NamingException if the naming exception has been raised while
+ * retrieving the reference.
+ */
+ Reference getReference() throws NamingException;
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/ReferralException.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/ReferralException.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/ReferralException.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/ReferralException.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,68 @@
+/* ReferralException.java --
+ Copyright (C) 2001, 2004, 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.naming;
+
+import java.util.Hashtable;
+
+/**
+ * @author Warren Levy (warrenl at redhat.com)
+ * @date June 14, 2001
+ */
+
+public abstract class ReferralException extends NamingException
+{
+ private static final long serialVersionUID = -2881363844695698876L;
+
+ protected ReferralException ()
+ {
+ super ();
+ }
+
+ protected ReferralException (String msg)
+ {
+ super (msg);
+ }
+
+ public abstract Object getReferralInfo();
+ public abstract Context getReferralContext() throws NamingException;
+ public abstract Context getReferralContext(Hashtable env)
+ throws NamingException;
+ public abstract boolean skipReferral();
+ public abstract void retryReferral();
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/ServiceUnavailableException.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/ServiceUnavailableException.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/ServiceUnavailableException.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/ServiceUnavailableException.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,55 @@
+/* ServiceUnavailableException.java --
+ Copyright (C) 2000, 2004, 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.naming;
+
+
+public class ServiceUnavailableException extends NamingException
+{
+ private static final long serialVersionUID = - 4996964726566773444L;
+
+ public ServiceUnavailableException ()
+ {
+ super ();
+ }
+
+ public ServiceUnavailableException (String msg)
+ {
+ super (msg);
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/SizeLimitExceededException.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/SizeLimitExceededException.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/SizeLimitExceededException.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/SizeLimitExceededException.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,60 @@
+/* SizeLimitExceededException.java --
+ Copyright (C) 2000, 2004, 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.naming;
+
+/**
+ * Thrown from the {@link javax.naming.NamingEnumeration}, this exception
+ * indicates that there are more elements than the previously specified
+ * size limit. Hence the enumeration represents only part of the existing
+ * elements that would be an answer to the specified request.
+ */
+public class SizeLimitExceededException extends LimitExceededException
+{
+ private static final long serialVersionUID = 7129289564879168579L;
+
+ public SizeLimitExceededException ()
+ {
+ super ();
+ }
+
+ public SizeLimitExceededException (String msg)
+ {
+ super (msg);
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/StringRefAddr.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/StringRefAddr.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/StringRefAddr.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/StringRefAddr.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,75 @@
+/* StringRefAddr.java -- RefAddr that uses a String as content.
+ Copyright (C) 2000, 2001 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.naming;
+
+/**
+ * RefAddr that uses a String as content.
+ * This can for example be used to address things through URLs.
+ *
+ * @see Reference
+ * @since 1.3
+ * @author Anthony Green (green at redhat.com)
+ * @author Mark Wielaard (mark at klomp.org)
+ */
+public class StringRefAddr extends RefAddr
+{
+ private static final long serialVersionUID = -8913762495138505527L;
+
+ /**
+ * The possibly null content of this RefAddr.
+ * Set by the constructor and returned by getContent.
+ */
+ private final String contents;
+
+ /**
+ * Contructs a new StringRefAddr with the given type and content.
+ */
+ public StringRefAddr (String addrType, String contents)
+ {
+ super(addrType);
+ this.contents = contents;
+ }
+
+ /**
+ * Returns the String contents as given to the constructor.
+ */
+ public Object getContent ()
+ {
+ return contents;
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/TimeLimitExceededException.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/TimeLimitExceededException.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/TimeLimitExceededException.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/TimeLimitExceededException.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,55 @@
+/* TimeLimitExceededException.java --
+ Copyright (C) 2000, 2004, 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.naming;
+
+
+public class TimeLimitExceededException extends LimitExceededException
+{
+ private static final long serialVersionUID = - 3597009011385034696L;
+
+ public TimeLimitExceededException ()
+ {
+ super ();
+ }
+
+ public TimeLimitExceededException (String msg)
+ {
+ super (msg);
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/directory/Attribute.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/directory/Attribute.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/directory/Attribute.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/directory/Attribute.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,70 @@
+/* Attribute.java --
+ Copyright (C) 2001, 2004, 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.naming.directory;
+
+import java.io.Serializable;
+
+import javax.naming.NamingEnumeration;
+import javax.naming.NamingException;
+
+/**
+ * @author Warren Levy (warrenl at redhat.com)
+ * @date June 14, 2001
+ */
+public interface Attribute extends Cloneable, Serializable
+{
+ long serialVersionUID = 8707690322213556804L;
+
+ NamingEnumeration getAll() throws NamingException;
+ Object get() throws NamingException;
+ int size();
+ String getID();
+ boolean contains(Object attrVal);
+ boolean add(Object attrVal);
+ boolean remove(Object attrval);
+ void clear();
+ DirContext getAttributeSyntaxDefinition() throws NamingException;
+ DirContext getAttributeDefinition() throws NamingException;
+ Object clone();
+ boolean isOrdered();
+ Object get(int ix) throws NamingException;
+ Object remove(int ix);
+ void add(int ix, Object attrVal);
+ Object set(int ix, Object attrVal);
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/directory/AttributeInUseException.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/directory/AttributeInUseException.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/directory/AttributeInUseException.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/directory/AttributeInUseException.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,56 @@
+/* AttributeInUseException.java --
+ Copyright (C) 2000, 2001, 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.naming.directory;
+
+import javax.naming.NamingException;
+
+public class AttributeInUseException extends NamingException
+{
+ private static final long serialVersionUID = 4437710305529322564L;
+
+ public AttributeInUseException ()
+ {
+ super ();
+ }
+
+ public AttributeInUseException (String msg)
+ {
+ super (msg);
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/directory/AttributeModificationException.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/directory/AttributeModificationException.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/directory/AttributeModificationException.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/directory/AttributeModificationException.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,78 @@
+/* AttributeModificationException.java --
+ Copyright (C) 2001, 2005, 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.naming.directory;
+
+import javax.naming.NamingException;
+
+/**
+ * @author Warren Levy (warrenl at redhat.com)
+ * @date June 14, 2001
+ */
+
+public class AttributeModificationException extends NamingException
+{
+ private static final long serialVersionUID = 8060676069678710186L;
+ // Serialized fields.
+ private ModificationItem[] unexecs;
+
+ public AttributeModificationException ()
+ {
+ super ();
+ }
+
+ public AttributeModificationException (String msg)
+ {
+ super (msg);
+ }
+
+ public void setUnexecutedModifications(ModificationItem[] e)
+ {
+ unexecs = e;
+ }
+
+ public ModificationItem[] getUnexecutedModifications()
+ {
+ return unexecs;
+ }
+
+ public String toString()
+ {
+ return super.toString () + ": " + unexecs[0].toString ();
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/directory/Attributes.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/directory/Attributes.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/directory/Attributes.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/directory/Attributes.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,62 @@
+/* Attributes.java --
+ Copyright (C) 2001, 2004, 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.naming.directory;
+
+import java.io.Serializable;
+
+import javax.naming.NamingEnumeration;
+
+/**
+ * @author Warren Levy (warrenl at redhat.com)
+ * @date June 14, 2001
+ */
+
+public interface Attributes extends Cloneable, Serializable
+{
+ boolean isCaseIgnored();
+ int size();
+ Attribute get(String attrID);
+ NamingEnumeration getAll();
+ NamingEnumeration getIDs();
+ Attribute put(String attrID, Object val);
+ Attribute put(Attribute attr);
+ Attribute remove(String attrID);
+ Object clone();
+}
+
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/directory/BasicAttribute.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/directory/BasicAttribute.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/directory/BasicAttribute.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/directory/BasicAttribute.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,358 @@
+/* BasicAttribute.java --
+ Copyright (C) 2000, 2001, 2004, 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.naming.directory;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.util.NoSuchElementException;
+import java.util.Vector;
+
+import javax.naming.NamingEnumeration;
+import javax.naming.NamingException;
+import javax.naming.OperationNotSupportedException;
+
+/**
+ * @author Tom Tromey (tromey at redhat.com)
+ * @date June 20, 2001
+ * @since 1.3
+ */
+public class BasicAttribute implements Attribute
+{
+ private static final long serialVersionUID = 6743528196119291326L;
+
+ /** The ID of this attribute. */
+ protected String attrID;
+ /** True if this attribute's values are ordered. */
+ protected boolean ordered;
+ /** Values for this attribute. */
+ protected transient Vector values;
+
+ // Used by cloning.
+ private BasicAttribute ()
+ {
+ }
+
+ public BasicAttribute (String id)
+ {
+ this (id, false);
+ }
+
+ public BasicAttribute (String id, boolean ordered)
+ {
+ attrID = id;
+ this.ordered = ordered;
+ values = new Vector ();
+ }
+
+ public BasicAttribute (String id, Object value)
+ {
+ this (id, value, false);
+ }
+
+ public BasicAttribute (String id, Object value, boolean ordered)
+ {
+ attrID = id;
+ this.ordered = ordered;
+ values = new Vector ();
+ values.add (value);
+ }
+
+ public void add (int index, Object val)
+ {
+ if (! ordered && contains (val))
+ throw new IllegalStateException ("value already in attribute");
+ values.add (index, val);
+ }
+
+ public boolean add (Object val)
+ {
+ if (! ordered && contains (val))
+ throw new IllegalStateException ("value already in attribute");
+ return values.add (val);
+ }
+
+ public void clear ()
+ {
+ values.clear ();
+ }
+
+ public Object clone ()
+ {
+ BasicAttribute c = new BasicAttribute ();
+ c.attrID = attrID;
+ c.ordered = ordered;
+ c.values = (Vector) values.clone ();
+ return c;
+ }
+
+ public boolean contains (Object val)
+ {
+ for (int i = 0; i < values.size (); ++i)
+ {
+ if (equals (val, values.get (i)))
+ return true;
+ }
+
+ return false;
+ }
+
+ public boolean equals (Object obj)
+ {
+ if (! (obj instanceof BasicAttribute))
+ return false;
+ BasicAttribute b = (BasicAttribute) obj;
+
+ if (ordered != b.ordered
+ || ! attrID.equals (b.attrID)
+ || values.size () != b.values.size ())
+ return false;
+
+ for (int i = 0; i < values.size (); ++i)
+ {
+ boolean ok = false;
+ if (ordered)
+ ok = equals (values.get (i), b.values.get (i));
+ else
+ {
+ for (int j = 0; j < b.values.size (); ++j)
+ {
+ if (equals (values.get (i), b.values.get (j)))
+ {
+ ok = true;
+ break;
+ }
+ }
+ }
+
+ if (! ok)
+ return false;
+ }
+
+ return true;
+ }
+
+ public Object get ()
+ throws NamingException
+ {
+ if (values.size () == 0)
+ throw new NoSuchElementException ("no values");
+ return get (0);
+ }
+
+ public Object get (int index)
+ throws NamingException
+ {
+ return values.get (index);
+ }
+
+ public NamingEnumeration getAll ()
+ throws NamingException
+ {
+ return new BasicAttributeEnumeration ();
+ }
+
+ public DirContext getAttributeDefinition ()
+ throws OperationNotSupportedException, NamingException
+ {
+ throw new OperationNotSupportedException ();
+ }
+
+ public DirContext getAttributeSyntaxDefinition ()
+ throws OperationNotSupportedException, NamingException
+ {
+ throw new OperationNotSupportedException ();
+ }
+
+ public String getID ()
+ {
+ return attrID;
+ }
+
+ public int hashCode ()
+ {
+ int val = attrID.hashCode ();
+ for (int i = 0; i < values.size (); ++i)
+ {
+ Object o = values.get (i);
+ if (o == null)
+ {
+ // Nothing.
+ }
+ else if (o instanceof Object[])
+ {
+ Object[] a = (Object[]) o;
+ for (int j = 0; j < a.length; ++j)
+ val += a[j].hashCode ();
+ }
+ else
+ val += o.hashCode ();
+ }
+
+ return val;
+ }
+
+ public boolean isOrdered ()
+ {
+ return ordered;
+ }
+
+ public Object remove (int index)
+ {
+ return values.remove (index);
+ }
+
+ public boolean remove (Object val)
+ {
+ for (int i = 0; i < values.size (); ++i)
+ {
+ if (equals (val, values.get (i)))
+ {
+ values.remove (i);
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ public Object set (int index, Object val)
+ {
+ if (! ordered && contains (val))
+ throw new IllegalStateException ("value already in attribute");
+ return values.set (index, val);
+ }
+
+ public int size ()
+ {
+ return values.size ();
+ }
+
+ public String toString ()
+ {
+ String r = attrID;
+ for (int i = 0; i < values.size (); ++i)
+ r += ";" + values.get (i).toString ();
+ return r;
+ }
+
+ // This is used for testing equality of two Objects according to our
+ // local rules.
+ private boolean equals (Object one, Object two)
+ {
+ if (one == null)
+ return two == null;
+
+ if (one instanceof Object[])
+ {
+ if (! (two instanceof Object[]))
+ return false;
+
+ Object[] aone = (Object[]) one;
+ Object[] atwo = (Object[]) two;
+
+ if (aone.length != atwo.length)
+ return false;
+
+ for (int i = 0; i < aone.length; ++i)
+ {
+ if (! aone[i].equals (atwo[i]))
+ return false;
+ }
+
+ return true;
+ }
+
+ return one.equals (two);
+ }
+
+ private void readObject(ObjectInputStream s)
+ throws IOException, ClassNotFoundException
+ {
+ s.defaultReadObject();
+ int size = s.readInt();
+ values = new Vector(size);
+ for (int i=0; i < size; i++)
+ values.add(s.readObject());
+ }
+
+ private void writeObject(ObjectOutputStream s) throws IOException
+ {
+ s.defaultWriteObject();
+ s.writeInt(values.size());
+ for (int i=0; i < values.size(); i++)
+ s.writeObject(values.get(i));
+ }
+
+ // Used when enumerating this attribute.
+ private class BasicAttributeEnumeration implements NamingEnumeration
+ {
+ int where = 0;
+
+ public BasicAttributeEnumeration ()
+ {
+ }
+
+ public void close () throws NamingException
+ {
+ }
+
+ public boolean hasMore () throws NamingException
+ {
+ return hasMoreElements ();
+ }
+
+ public Object next () throws NamingException
+ {
+ return nextElement ();
+ }
+
+ public boolean hasMoreElements ()
+ {
+ return where < values.size ();
+ }
+
+ public Object nextElement () throws NoSuchElementException
+ {
+ if (where == values.size ())
+ throw new NoSuchElementException ("no more elements");
+ return values.get (where++);
+ }
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/directory/BasicAttributes.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/directory/BasicAttributes.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/directory/BasicAttributes.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/directory/BasicAttributes.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,259 @@
+/* BasicAttributes.java --
+ Copyright (C) 2000, 2001, 2004, 2005, 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.naming.directory;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.util.NoSuchElementException;
+import java.util.Vector;
+
+import javax.naming.NamingEnumeration;
+import javax.naming.NamingException;
+
+/**
+ * @author Tom Tromey (tromey at redhat.com)
+ * @date June 22, 2001
+ */
+public class BasicAttributes implements Attributes
+{
+ private static final long serialVersionUID = 4980164073184639448L;
+
+ public BasicAttributes ()
+ {
+ this (false);
+ }
+
+ public BasicAttributes (boolean ignoreCase)
+ {
+ this.ignoreCase = ignoreCase;
+ this.attributes = new Vector ();
+ }
+
+ public BasicAttributes (String attrID, Object val)
+ {
+ this (attrID, val, false);
+ }
+
+ public BasicAttributes (String attrID, Object val, boolean ignoreCase)
+ {
+ this.ignoreCase = ignoreCase;
+ attributes = new Vector ();
+ attributes.add (new BasicAttribute (attrID, val));
+ }
+
+ public Object clone ()
+ {
+ // Slightly inefficient as we make a garbage Vector here.
+ BasicAttributes ba = new BasicAttributes (ignoreCase);
+ ba.attributes = (Vector) attributes.clone ();
+ return ba;
+ }
+
+ /**
+ * Returns true if and only if the given Object is an instance of
+ * Attributes, the given attributes both do or don't ignore case for
+ * IDs and the collection of attributes is the same.
+ */
+ public boolean equals (Object obj)
+ {
+ if (! (obj instanceof Attributes))
+ return false;
+
+ Attributes bs = (Attributes) obj;
+ if (ignoreCase != bs.isCaseIgnored()
+ || attributes.size () != bs.size ())
+ return false;
+
+ NamingEnumeration bas = bs.getAll();
+ while (bas.hasMoreElements())
+ {
+ Attribute a = (Attribute) bas.nextElement();
+ Attribute b = get(a.getID ());
+ if (! a.equals(b))
+ return false;
+ }
+
+ return true;
+ }
+
+ public Attribute get (String attrID)
+ {
+ for (int i = 0; i < attributes.size (); ++i)
+ {
+ Attribute at = (Attribute) attributes.get (i);
+ if ((ignoreCase && attrID.equalsIgnoreCase (at.getID ()))
+ || (! ignoreCase && attrID.equals (at.getID ())))
+ return at;
+ }
+
+ return null;
+ }
+
+ public NamingEnumeration getAll ()
+ {
+ return new BasicAttributesEnumeration (false);
+ }
+
+ public NamingEnumeration getIDs ()
+ {
+ return new BasicAttributesEnumeration (true);
+ }
+
+ public int hashCode ()
+ {
+ int val = 0;
+ for (int i = 0; i < attributes.size (); ++i)
+ val += attributes.get (i).hashCode ();
+ return val;
+ }
+
+ public boolean isCaseIgnored ()
+ {
+ return ignoreCase;
+ }
+
+ public Attribute put (Attribute attr)
+ {
+ Attribute r = remove (attr.getID ());
+ attributes.add (attr);
+ return r;
+ }
+
+ public Attribute put (String attrID, Object val)
+ {
+ return put (new BasicAttribute (attrID, val));
+ }
+
+ public Attribute remove (String attrID)
+ {
+ for (int i = 0; i < attributes.size (); ++i)
+ {
+ Attribute at = (Attribute) attributes.get (i);
+ if ((ignoreCase && attrID.equalsIgnoreCase (at.getID ()))
+ || (! ignoreCase && attrID.equals (at.getID ())))
+ {
+ attributes.remove (i);
+ return at;
+ }
+ }
+
+ return null;
+ }
+
+ public int size ()
+ {
+ return attributes.size ();
+ }
+
+ public String toString ()
+ {
+ String r = "";
+ for (int i = 0; i < attributes.size (); ++i)
+ {
+ if (i > 0)
+ r += "; ";
+ r += attributes.get (i).toString ();
+ }
+ return r;
+ }
+
+ // This is set by the serialization spec.
+ private boolean ignoreCase;
+ // Package-private to avoid a trampoline.
+ transient Vector attributes;
+
+ private void readObject(ObjectInputStream s) throws IOException,
+ ClassNotFoundException
+ {
+ s.defaultReadObject();
+ int size = s.readInt();
+ attributes = new Vector(size);
+ for (int i = 0; i < size; i++)
+ attributes.add(s.readObject());
+ }
+
+ private void writeObject(ObjectOutputStream s) throws IOException
+ {
+ s.defaultWriteObject();
+ s.writeInt(attributes.size());
+ for (int i = 0; i < attributes.size(); i++)
+ s.writeObject(attributes.get(i));
+ }
+
+ // Used when enumerating.
+ private class BasicAttributesEnumeration implements NamingEnumeration
+ {
+ int where = 0;
+ boolean id;
+
+ public BasicAttributesEnumeration (boolean id)
+ {
+ this.id = id;
+ }
+
+ public void close () throws NamingException
+ {
+ }
+
+ public boolean hasMore () throws NamingException
+ {
+ return hasMoreElements ();
+ }
+
+ public Object next () throws NamingException
+ {
+ return nextElement ();
+ }
+
+ public boolean hasMoreElements ()
+ {
+ return where < attributes.size ();
+ }
+
+ public Object nextElement () throws NoSuchElementException
+ {
+ if (where >= attributes.size ())
+ throw new NoSuchElementException ("no more elements");
+ Attribute at = (Attribute) attributes.get (where);
+ ++where;
+ return id ? (Object) at.getID () : (Object) at;
+ }
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/directory/DirContext.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/directory/DirContext.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/directory/DirContext.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/directory/DirContext.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,83 @@
+/* DirContext.java --
+ Copyright (C) 2001, 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.naming.directory;
+
+import javax.naming.Context;
+import javax.naming.Name;
+import javax.naming.NamingEnumeration;
+import javax.naming.NamingException;
+
+/**
+ * @author Warren Levy (warrenl at redhat.com)
+ * @date June 13, 2001
+ */
+
+public interface DirContext extends Context
+{
+ int ADD_ATTRIBUTE = 1;
+ int REPLACE_ATTRIBUTE = 2;
+ int REMOVE_ATTRIBUTE = 3;
+
+ Attributes getAttributes (String name) throws NamingException;
+ Attributes getAttributes (String name, String[] attrIds) throws NamingException;
+ Attributes getAttributes (Name name) throws NamingException;
+ Attributes getAttributes(Name name, String[] attrIds) throws NamingException;
+ void modifyAttributes(Name name, int mod_op, Attributes attrs) throws NamingException;
+ void modifyAttributes(String name, int mod_op, Attributes attrs) throws NamingException;
+ void modifyAttributes(Name name, ModificationItem[] mods) throws NamingException;
+ void modifyAttributes(String name, ModificationItem[] mods) throws NamingException;
+ void bind(Name name, Object obj, Attributes attrs) throws NamingException;
+ void bind(String name, Object obj, Attributes attrs) throws NamingException;
+ void rebind(Name name, Object obj, Attributes attrs) throws NamingException;
+ void rebind(String name, Object obj, Attributes attrs) throws NamingException;
+ DirContext createSubcontext(Name name, Attributes attrs) throws NamingException;
+ DirContext createSubcontext(String name, Attributes attrs) throws NamingException;
+ DirContext getSchema(Name name) throws NamingException;
+ DirContext getSchema(String name) throws NamingException;
+ DirContext getSchemaClassDefinition(Name name) throws NamingException;
+ DirContext getSchemaClassDefinition(String name) throws NamingException;
+ NamingEnumeration search(Name name, Attributes matchingAttributes, String[] attributesToReturn) throws NamingException;
+ NamingEnumeration search(String name, Attributes matchingAttributes, String[] attributesToReturn) throws NamingException;
+ NamingEnumeration search(Name name, Attributes matchingAttributes) throws NamingException;
+ NamingEnumeration search(String name, Attributes matchingAttributes) throws NamingException;
+ NamingEnumeration search(Name name, String filter, SearchControls cons) throws NamingException;
+ NamingEnumeration search(String name, String filter, SearchControls cons) throws NamingException;
+ NamingEnumeration search(Name name, String filterExpr, Object[] filterArgs, SearchControls cons) throws NamingException;
+ NamingEnumeration search(String name, String filterExpr, Object[] filterArgs, SearchControls cons) throws NamingException;
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/directory/InitialDirContext.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/directory/InitialDirContext.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/directory/InitialDirContext.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/directory/InitialDirContext.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,265 @@
+/* InitialDirContext.java --
+ Copyright (C) 2000, 2001, 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.naming.directory;
+
+import java.util.Hashtable;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.Name;
+import javax.naming.NamingEnumeration;
+import javax.naming.NamingException;
+import javax.naming.NoInitialContextException;
+import javax.naming.NotContextException;
+
+/**
+ * @author Tom Tromey (tromey at redhat.com)
+ * @date June 25, 2001
+ */
+public class InitialDirContext extends InitialContext implements DirContext
+{
+ public InitialDirContext ()
+ throws NamingException
+ {
+ this (null);
+ }
+
+ protected InitialDirContext (boolean lazy)
+ throws NamingException
+ {
+ super (lazy);
+ }
+
+ public InitialDirContext (Hashtable environment)
+ throws NamingException
+ {
+ super (environment);
+ }
+
+ // The InitialContext docs suggest that this exist. And it does
+ // seem like a good idea. but the InitialDirContext docs indicate
+ // it cannot be non-private.
+ private DirContext getURLOrDefaultInitDirCtx (Name name)
+ throws NamingException
+ {
+ Context c = getURLOrDefaultInitCtx (name);
+ if (c == null)
+ throw new NoInitialContextException ();
+ else if (! (c instanceof DirContext))
+ throw new NotContextException ();
+ return (DirContext) c;
+ }
+
+ private DirContext getURLOrDefaultInitDirCtx (String name)
+ throws NamingException
+ {
+ Context c = getURLOrDefaultInitCtx (name);
+ if (c == null)
+ throw new NoInitialContextException ();
+ else if (! (c instanceof DirContext))
+ throw new NotContextException ();
+ return (DirContext) c;
+ }
+
+ public Attributes getAttributes (String name)
+ throws NamingException
+ {
+ return getURLOrDefaultInitDirCtx (name).getAttributes (name);
+ }
+
+ public Attributes getAttributes (String name, String[] attrIds)
+ throws NamingException
+ {
+ return getURLOrDefaultInitDirCtx (name).getAttributes (name, attrIds);
+ }
+
+ public Attributes getAttributes (Name name)
+ throws NamingException
+ {
+ return getURLOrDefaultInitDirCtx (name).getAttributes (name);
+ }
+
+ public Attributes getAttributes(Name name, String[] attrIds)
+ throws NamingException
+ {
+ return getURLOrDefaultInitDirCtx (name).getAttributes (name, attrIds);
+ }
+
+ public void modifyAttributes(Name name, int mod_op, Attributes attrs)
+ throws NamingException
+ {
+ getURLOrDefaultInitDirCtx (name).modifyAttributes (name, mod_op, attrs);
+ }
+
+ public void modifyAttributes(String name, int mod_op, Attributes attrs)
+ throws NamingException
+ {
+ getURLOrDefaultInitDirCtx (name).modifyAttributes (name, mod_op, attrs);
+ }
+
+ public void modifyAttributes(Name name, ModificationItem[] mods)
+ throws NamingException
+ {
+ getURLOrDefaultInitDirCtx (name).modifyAttributes (name, mods);
+ }
+
+ public void modifyAttributes(String name, ModificationItem[] mods)
+ throws NamingException
+ {
+ getURLOrDefaultInitDirCtx (name).modifyAttributes (name, mods);
+ }
+
+ public void bind(Name name, Object obj, Attributes attrs)
+ throws NamingException
+ {
+ getURLOrDefaultInitDirCtx (name).bind (name, obj, attrs);
+ }
+
+ public void bind(String name, Object obj, Attributes attrs)
+ throws NamingException
+ {
+ getURLOrDefaultInitDirCtx (name).bind (name, obj, attrs);
+ }
+
+ public void rebind(Name name, Object obj, Attributes attrs)
+ throws NamingException
+ {
+ getURLOrDefaultInitDirCtx (name).rebind (name, obj, attrs);
+ }
+
+ public void rebind(String name, Object obj, Attributes attrs)
+ throws NamingException
+ {
+ getURLOrDefaultInitDirCtx (name).rebind (name, obj, attrs);
+ }
+
+ public DirContext createSubcontext(Name name, Attributes attrs)
+ throws NamingException
+ {
+ return getURLOrDefaultInitDirCtx (name).createSubcontext (name, attrs);
+ }
+
+ public DirContext createSubcontext(String name, Attributes attrs)
+ throws NamingException
+ {
+ return getURLOrDefaultInitDirCtx (name).createSubcontext (name, attrs);
+ }
+
+ public DirContext getSchema(Name name)
+ throws NamingException
+ {
+ return getURLOrDefaultInitDirCtx (name).getSchema (name);
+ }
+
+ public DirContext getSchema(String name)
+ throws NamingException
+ {
+ return getURLOrDefaultInitDirCtx (name).getSchema (name);
+ }
+
+ public DirContext getSchemaClassDefinition(Name name)
+ throws NamingException
+ {
+ return getURLOrDefaultInitDirCtx (name).getSchemaClassDefinition (name);
+ }
+
+ public DirContext getSchemaClassDefinition(String name)
+ throws NamingException
+ {
+ return getURLOrDefaultInitDirCtx (name).getSchemaClassDefinition (name);
+ }
+
+ public NamingEnumeration search(Name name, Attributes matchingAttributes,
+ String[] attributesToReturn)
+ throws NamingException
+ {
+ return getURLOrDefaultInitDirCtx (name).search (name, matchingAttributes,
+ attributesToReturn);
+ }
+
+ public NamingEnumeration search(String name, Attributes matchingAttributes,
+ String[] attributesToReturn)
+ throws NamingException
+ {
+ return getURLOrDefaultInitDirCtx (name).search (name, matchingAttributes,
+ attributesToReturn);
+ }
+
+ public NamingEnumeration search(Name name, Attributes matchingAttributes)
+ throws NamingException
+ {
+ return getURLOrDefaultInitDirCtx (name).search (name, matchingAttributes);
+ }
+
+ public NamingEnumeration search(String name, Attributes matchingAttributes)
+ throws NamingException
+ {
+ return getURLOrDefaultInitDirCtx (name).search (name, matchingAttributes);
+ }
+
+ public NamingEnumeration search(Name name, String filter,
+ SearchControls cons)
+ throws NamingException
+ {
+ return getURLOrDefaultInitDirCtx (name).search (name, filter, cons);
+ }
+
+ public NamingEnumeration search(String name, String filter,
+ SearchControls cons)
+ throws NamingException
+ {
+ return getURLOrDefaultInitDirCtx (name).search (name, filter, cons);
+ }
+
+ public NamingEnumeration search(Name name, String filterExpr,
+ Object[] filterArgs, SearchControls cons)
+ throws NamingException
+ {
+ return getURLOrDefaultInitDirCtx (name).search (name, filterExpr,
+ filterArgs, cons);
+ }
+
+ public NamingEnumeration search(String name, String filterExpr,
+ Object[] filterArgs, SearchControls cons)
+ throws NamingException
+ {
+ return getURLOrDefaultInitDirCtx (name).search (name, filterExpr,
+ filterArgs, cons);
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/directory/InvalidAttributeIdentifierException.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/directory/InvalidAttributeIdentifierException.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/directory/InvalidAttributeIdentifierException.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/directory/InvalidAttributeIdentifierException.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,56 @@
+/* InvalidAttributeIdentifierException.java --
+ Copyright (C) 2000, 2001, 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.naming.directory;
+
+import javax.naming.NamingException;
+
+public class InvalidAttributeIdentifierException extends NamingException
+{
+ private static final long serialVersionUID = - 9036920266322999923L;
+
+ public InvalidAttributeIdentifierException ()
+ {
+ super ();
+ }
+
+ public InvalidAttributeIdentifierException (String msg)
+ {
+ super (msg);
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/directory/InvalidAttributeValueException.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/directory/InvalidAttributeValueException.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/directory/InvalidAttributeValueException.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/directory/InvalidAttributeValueException.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,56 @@
+/* InvalidAttributeValueException.java --
+ Copyright (C) 2000, 2001, 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.naming.directory;
+
+import javax.naming.NamingException;
+
+public class InvalidAttributeValueException extends NamingException
+{
+ private static final long serialVersionUID = 8720050295499275011L;
+
+ public InvalidAttributeValueException ()
+ {
+ super ();
+ }
+
+ public InvalidAttributeValueException (String msg)
+ {
+ super (msg);
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/directory/InvalidAttributesException.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/directory/InvalidAttributesException.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/directory/InvalidAttributesException.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/directory/InvalidAttributesException.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,56 @@
+/* InvalidAttributesException.java --
+ Copyright (C) 2000, 2001, 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.naming.directory;
+
+import javax.naming.NamingException;
+
+public class InvalidAttributesException extends NamingException
+{
+ private static final long serialVersionUID = 2607612850539889765L;
+
+ public InvalidAttributesException ()
+ {
+ super ();
+ }
+
+ public InvalidAttributesException (String msg)
+ {
+ super (msg);
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/directory/InvalidSearchControlsException.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/directory/InvalidSearchControlsException.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/directory/InvalidSearchControlsException.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/directory/InvalidSearchControlsException.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,56 @@
+/* InvalidSearchControlsException.java --
+ Copyright (C) 2000, 2001, 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.naming.directory;
+
+import javax.naming.NamingException;
+
+public class InvalidSearchControlsException extends NamingException
+{
+ private static final long serialVersionUID = - 5124108943352665777L;
+
+ public InvalidSearchControlsException ()
+ {
+ super ();
+ }
+
+ public InvalidSearchControlsException (String msg)
+ {
+ super (msg);
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/directory/InvalidSearchFilterException.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/directory/InvalidSearchFilterException.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/directory/InvalidSearchFilterException.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/directory/InvalidSearchFilterException.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,56 @@
+/* InvalidSearchFilterException.java --
+ Copyright (C) 2000, 2001, 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.naming.directory;
+
+import javax.naming.NamingException;
+
+public class InvalidSearchFilterException extends NamingException
+{
+ private static final long serialVersionUID = 2902700940682875441L;
+
+ public InvalidSearchFilterException ()
+ {
+ super ();
+ }
+
+ public InvalidSearchFilterException (String msg)
+ {
+ super (msg);
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/directory/ModificationItem.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/directory/ModificationItem.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/directory/ModificationItem.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/directory/ModificationItem.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,81 @@
+/* ModificationItem.java --
+ Copyright (C) 2001, 2005, 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.naming.directory;
+
+import java.io.Serializable;
+
+/**
+ * @author Warren Levy (warrenl at redhat.com)
+ * @date June 13, 2001
+ */
+
+public class ModificationItem implements Serializable
+{
+ private static final long serialVersionUID = 7573258562534746850L;
+ // Serialized fields.
+ private int mod_op;
+ private Attribute attr;
+
+ public ModificationItem(int mod_op, Attribute attr)
+ {
+ if (attr == null)
+ throw new IllegalArgumentException("attr is null");
+ if (mod_op != DirContext.ADD_ATTRIBUTE &&
+ mod_op != DirContext.REPLACE_ATTRIBUTE &&
+ mod_op != DirContext.REMOVE_ATTRIBUTE)
+ throw new IllegalArgumentException("mod_op is invalid");
+ this.mod_op = mod_op;
+ this.attr = attr;
+ }
+
+ public int getModificationOp()
+ {
+ return mod_op;
+ }
+
+ public Attribute getAttribute()
+ {
+ return attr;
+ }
+
+ public String toString()
+ {
+ return "mod_op=" + mod_op + ":" + "attr=" + attr.toString();
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/directory/NoSuchAttributeException.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/directory/NoSuchAttributeException.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/directory/NoSuchAttributeException.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/directory/NoSuchAttributeException.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,56 @@
+/* NoSuchAttributeException.java --
+ Copyright (C) 2000, 2001, 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.naming.directory;
+
+import javax.naming.NamingException;
+
+public class NoSuchAttributeException extends NamingException
+{
+ private static final long serialVersionUID = 4836415647935888137L;
+
+ public NoSuchAttributeException ()
+ {
+ super ();
+ }
+
+ public NoSuchAttributeException (String msg)
+ {
+ super (msg);
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/directory/SchemaViolationException.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/directory/SchemaViolationException.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/directory/SchemaViolationException.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/directory/SchemaViolationException.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,56 @@
+/* SchemaViolationException.java --
+ Copyright (C) 2000, 2001, 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.naming.directory;
+
+import javax.naming.NamingException;
+
+public class SchemaViolationException extends NamingException
+{
+ private static final long serialVersionUID = - 3041762429525049663L;
+
+ public SchemaViolationException ()
+ {
+ super ();
+ }
+
+ public SchemaViolationException (String msg)
+ {
+ super (msg);
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/directory/SearchControls.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/directory/SearchControls.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/directory/SearchControls.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/directory/SearchControls.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,138 @@
+/* SearchControls.java --
+ Copyright (C) 2001, 2004, 2005, 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.naming.directory;
+
+import java.io.Serializable;
+
+/**
+ * @author Warren Levy (warrenl at redhat.com)
+ * @date June 5, 2001
+ */
+
+public class SearchControls implements Serializable
+{
+ private static final long serialVersionUID = - 2480540967773454797L;
+ public static final int OBJECT_SCOPE = 0;
+ public static final int ONELEVEL_SCOPE = 1;
+ public static final int SUBTREE_SCOPE = 2;
+
+ // Serialized fields.
+ private int searchScope;
+ private int timeLimit;
+ private boolean derefLink;
+ private boolean returnObj;
+ private long countLimit;
+ private String[] attributesToReturn;
+
+ public SearchControls()
+ {
+ this(ONELEVEL_SCOPE, 0L, 0, null, false, false);
+ }
+
+ public SearchControls(int scope, long countlim, int timelim, String[] attrs,
+ boolean retobj, boolean deref)
+ {
+ searchScope = scope;
+ timeLimit = timelim;
+ derefLink = deref;
+ returnObj = retobj;
+ countLimit = countlim;
+ attributesToReturn = attrs;
+ }
+
+ public int getSearchScope()
+ {
+ return searchScope;
+ }
+
+ public int getTimeLimit()
+ {
+ return timeLimit;
+ }
+
+ public boolean getDerefLinkFlag()
+ {
+ return derefLink;
+ }
+
+ public boolean getReturningObjFlag()
+ {
+ return returnObj;
+ }
+
+ public long getCountLimit()
+ {
+ return countLimit;
+ }
+
+ public String[] getReturningAttributes()
+ {
+ return attributesToReturn;
+ }
+
+ public void setSearchScope(int scope)
+ {
+ searchScope = scope;
+ }
+
+ public void setTimeLimit(int ms)
+ {
+ timeLimit = ms;
+ }
+
+ public void setDerefLinkFlag(boolean on)
+ {
+ derefLink = on;
+ }
+
+ public void setReturningObjFlag(boolean on)
+ {
+ returnObj = on;
+ }
+
+ public void setCountLimit(long limit)
+ {
+ countLimit = limit;
+ }
+
+ public void setReturningAttributes(String[] attrs)
+ {
+ attributesToReturn = attrs;
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/directory/SearchResult.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/directory/SearchResult.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/directory/SearchResult.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/directory/SearchResult.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,95 @@
+/* SearchResult.java --
+ Copyright (C) 2001, 2004, 2005, 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.naming.directory;
+
+import javax.naming.Binding;
+
+/**
+ * @author Warren Levy (warrenl at redhat.com)
+ * @date June 13, 2001
+ */
+
+public class SearchResult extends Binding
+{
+ private static final long serialVersionUID = - 9158063327699723172L;
+ // Serialized fields.
+ private Attributes attrs;
+
+ public SearchResult(String name, Object obj, Attributes attrs)
+ {
+ super(name, obj);
+ this.attrs = attrs;
+ }
+
+ public SearchResult(String name, Object obj, Attributes attrs,
+ boolean isRelative)
+ {
+ super(name, obj, isRelative);
+ this.attrs = attrs;
+ }
+
+ public SearchResult(String name, String className, Object obj,
+ Attributes attrs)
+ {
+ super(name, className, obj);
+ this.attrs = attrs;
+ }
+
+ public SearchResult(String name, String className, Object obj,
+ Attributes attrs, boolean isRelative)
+ {
+ super(name, className, obj, isRelative);
+ this.attrs = attrs;
+ }
+
+ public Attributes getAttributes()
+ {
+ return attrs;
+ }
+
+ public void setAttributes(Attributes attrs)
+ {
+ this.attrs = attrs;
+ }
+
+ public String toString()
+ {
+ return super.toString() + ":" + attrs.toString();
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/directory/package.html
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/directory/package.html?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/directory/package.html (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/directory/package.html Thu Nov 8 16:56:19 2007
@@ -0,0 +1,46 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<!-- package.html - describes classes in javax.naming.directory package.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. -->
+
+<html>
+<head><title>GNU Classpath - javax.naming.directory</title></head>
+
+<body>
+<p></p>
+
+</body>
+</html>
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/event/EventContext.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/event/EventContext.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/event/EventContext.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/event/EventContext.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,65 @@
+/* EventContext.java --
+ Copyright (C) 2001, 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.naming.event;
+
+import javax.naming.Context;
+import javax.naming.Name;
+import javax.naming.NamingException;
+
+/**
+ * @author Warren Levy (warrenl at redhat.com)
+ * @date June 1, 2001
+ */
+
+public interface EventContext extends Context
+{
+ int OBJECT_SCOPE = 0;
+ int ONELEVEL_SCOPE = 1;
+ int SUBTREE_SCOPE = 2;
+
+ void addNamingListener (Name target, int scope, NamingListener l)
+ throws NamingException;
+
+ void addNamingListener (String target, int scope, NamingListener l)
+ throws NamingException;
+
+ void removeNamingListener (NamingListener l) throws NamingException;
+
+ boolean targetMustExist() throws NamingException;
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/event/EventDirContext.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/event/EventDirContext.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/event/EventDirContext.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/event/EventDirContext.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,65 @@
+/* EventDirContext.java --
+ Copyright (C) 2001, 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.naming.event;
+
+import javax.naming.Name;
+import javax.naming.NamingException;
+import javax.naming.directory.DirContext;
+import javax.naming.directory.SearchControls;
+
+
+/**
+ * @author Warren Levy (warrenl at redhat.com)
+ * @date June 1, 2001
+ */
+public interface EventDirContext extends EventContext, DirContext
+{
+ void addNamingListener(Name target, String filter, SearchControls ctls,
+ NamingListener l) throws NamingException;
+
+ void addNamingListener(String target, String filter, SearchControls ctls,
+ NamingListener l) throws NamingException;
+
+ void addNamingListener(Name target, String filter, Object[] filterArgs,
+ SearchControls ctls, NamingListener l)
+ throws NamingException;
+
+ void addNamingListener(String target, String filter, Object[] filterArgs,
+ SearchControls ctls, NamingListener l)
+ throws NamingException;
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/event/NamespaceChangeListener.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/event/NamespaceChangeListener.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/event/NamespaceChangeListener.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/event/NamespaceChangeListener.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,51 @@
+/* NamespaceChangeListener.java --
+ Copyright (C) 2001, 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.naming.event;
+
+/**
+ * @author Warren Levy (warrenl at redhat.com)
+ * @date June 1, 2001
+ */
+
+public interface NamespaceChangeListener extends NamingListener
+{
+ void objectAdded(NamingEvent evt);
+ void objectRemoved(NamingEvent evt);
+ void objectRenamed(NamingEvent evt);
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/event/NamingEvent.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/event/NamingEvent.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/event/NamingEvent.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/event/NamingEvent.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,122 @@
+/* NamingEvent.java --
+ Copyright (C) 2001, 2004, 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.naming.event;
+
+import java.util.EventObject;
+
+import javax.naming.Binding;
+
+/**
+ * @author Warren Levy (warrenl at redhat.com)
+ * @date June 5, 2001
+ */
+public class NamingEvent extends EventObject
+{
+ private static final long serialVersionUID = - 7126752885365133499L;
+
+ public static final int OBJECT_ADDED = 0;
+ public static final int OBJECT_REMOVED = 1;
+ public static final int OBJECT_RENAMED = 2;
+ public static final int OBJECT_CHANGED = 3;
+
+ // Serialized fields.
+ protected Object changeInfo;
+ protected int type;
+ protected Binding oldBinding;
+ protected Binding newBinding;
+
+ public NamingEvent(EventContext source, int type, Binding newBd,
+ Binding oldBd, Object changeInfo)
+ {
+ super(source);
+ this.type = type;
+ this.oldBinding = oldBd;
+ this.newBinding = newBd;
+ this.changeInfo = changeInfo;
+ // FIXME: for OBJECT_ADDED, newBd must not be null;
+ // FIXME: for OBJECT_CHANGED, newBd and oldBd must not be null;
+ // FIXME: for OBJECT_RENAMED, one of newBd or oldBd may be null if newBd or
+ // FIXME: oldBd is outside of the scope for which listener has registered.
+ // FIXME: namingExceptionThrown() is called for the listener in question.
+ }
+
+ public int getType()
+ {
+ return type;
+ }
+
+ public EventContext getEventContext()
+ {
+ return (EventContext) getSource();
+ }
+
+ public Binding getOldBinding()
+ {
+ return oldBinding;
+ }
+
+ public Binding getNewBinding()
+ {
+ return newBinding;
+ }
+
+ public Object getChangeInfo()
+ {
+ return changeInfo;
+ }
+
+ public void dispatch(NamingListener listener)
+ {
+ switch (type)
+ {
+ case OBJECT_ADDED:
+ ((NamespaceChangeListener) listener).objectAdded(this);
+ break;
+ case OBJECT_REMOVED:
+ ((NamespaceChangeListener) listener).objectRemoved(this);
+ break;
+ case OBJECT_RENAMED:
+ ((NamespaceChangeListener) listener).objectRenamed(this);
+ break;
+ case OBJECT_CHANGED:
+ ((ObjectChangeListener) listener).objectChanged(this);
+ break;
+ }
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/event/NamingExceptionEvent.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/event/NamingExceptionEvent.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/event/NamingExceptionEvent.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/event/NamingExceptionEvent.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,77 @@
+/* NamingExceptionEvent.java --
+ Copyright (C) 2001, 2004, 2005, 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.naming.event;
+
+import java.util.EventObject;
+
+import javax.naming.NamingException;
+
+/**
+ * @author Warren Levy (warrenl at redhat.com)
+ * @date June 5, 2001
+ */
+
+public class NamingExceptionEvent extends EventObject
+{
+ private static final long serialVersionUID = - 4877678086134736336L;
+
+ // Serialized fields.
+ private NamingException exception;
+
+ public NamingExceptionEvent(EventContext source, NamingException exc)
+ {
+ super(source);
+ exception = exc;
+ }
+
+ public NamingException getException()
+ {
+ return exception;
+ }
+
+ public EventContext getEventContext()
+ {
+ return (EventContext) getSource();
+ }
+
+ public void dispatch(NamingListener listener)
+ {
+ listener.namingExceptionThrown(this);
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/event/NamingListener.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/event/NamingListener.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/event/NamingListener.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/event/NamingListener.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,51 @@
+/* NamingListener.java --
+ Copyright (C) 2001, 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.naming.event;
+
+import java.util.EventListener;
+
+/**
+ * @author Warren Levy (warrenl at redhat.com)
+ * @date June 1, 2001
+ */
+
+public interface NamingListener extends EventListener
+{
+ void namingExceptionThrown(NamingExceptionEvent evt);
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/event/ObjectChangeListener.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/event/ObjectChangeListener.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/event/ObjectChangeListener.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/event/ObjectChangeListener.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,49 @@
+/* ObjectChangeListener.java --
+ Copyright (C) 2001, 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.naming.event;
+
+/**
+ * @author Warren Levy (warrenl at redhat.com)
+ * @date June 1, 2001
+ */
+
+public interface ObjectChangeListener extends NamingListener
+{
+ void objectChanged(NamingEvent evt);
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/event/package.html
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/event/package.html?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/event/package.html (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/event/package.html Thu Nov 8 16:56:19 2007
@@ -0,0 +1,46 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<!-- package.html - describes classes in javax.naming.event package.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. -->
+
+<html>
+<head><title>GNU Classpath - javax.naming.event</title></head>
+
+<body>
+<p></p>
+
+</body>
+</html>
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/ldap/Control.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/ldap/Control.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/ldap/Control.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/ldap/Control.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,56 @@
+/* Control.java --
+ Copyright (C) 2001, 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.naming.ldap;
+
+import java.io.Serializable;
+
+/**
+ * @author Warren Levy (warrenl at redhat.com)
+ * @date June 1, 2001
+ */
+
+public interface Control extends Serializable
+{
+ boolean CRITICAL = true;
+ boolean NONCRITICAL = false;
+
+ String getID();
+ boolean isCritical();
+ byte[] getEncodedValue();
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/ldap/ControlFactory.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/ldap/ControlFactory.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/ldap/ControlFactory.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/ldap/ControlFactory.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,107 @@
+/* ControlFactory.java --
+ Copyright (C) 2001, 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.naming.ldap;
+
+import java.util.Hashtable;
+import java.util.StringTokenizer;
+
+import javax.naming.Context;
+import javax.naming.NamingException;
+
+/**
+ * @author Tom Tromey (tromey at redhat.com)
+ * @date June 22, 2001
+ */
+public abstract class ControlFactory
+{
+ protected ControlFactory ()
+ {
+ }
+
+ public abstract Control getControlInstance (Control control)
+ throws NamingException;
+
+ public static Control getControlInstance (Control control,
+ Context ctx,
+ Hashtable env)
+ throws NamingException
+ {
+ String path = (String) env.get (LdapContext.CONTROL_FACTORIES);
+ String path2 = null;
+ if (ctx != null)
+ path2 = (String) ctx.getEnvironment ().get (LdapContext.CONTROL_FACTORIES);
+ if (path == null)
+ path = path2;
+ else if (path2 != null)
+ path += ":" + path2;
+
+ StringTokenizer tokens = new StringTokenizer (path, ":");
+ while (tokens.hasMoreTokens ())
+ {
+ String name = tokens.nextToken ();
+ try
+ {
+ Class k = Class.forName (name);
+ ControlFactory cf = (ControlFactory) k.newInstance ();
+ Control ctrl = cf.getControlInstance (control);
+ if (ctrl != null)
+ return ctrl;
+ }
+ catch (ClassNotFoundException _1)
+ {
+ // Ignore it.
+ }
+ catch (ClassCastException _2)
+ {
+ // Ignore it.
+ }
+ catch (InstantiationException _3)
+ {
+ // If we couldn't instantiate the factory we might get
+ // this.
+ }
+ catch (IllegalAccessException _4)
+ {
+ // Another possibility when instantiating.
+ }
+ }
+
+ return control;
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/ldap/ExtendedRequest.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/ldap/ExtendedRequest.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/ldap/ExtendedRequest.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/ldap/ExtendedRequest.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,57 @@
+/* ExtendedRequest.java --
+ Copyright (C) 2001, 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.naming.ldap;
+
+import java.io.Serializable;
+
+import javax.naming.NamingException;
+
+/**
+ * @author Warren Levy (warrenl at redhat.com)
+ * @date June 1, 2001
+ */
+public interface ExtendedRequest extends Serializable
+{
+ String getID();
+ byte[] getEncodedValue();
+ ExtendedResponse createExtendedResponse(String id,
+ byte[] berValue, int offset,
+ int length)
+ throws NamingException;
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/ldap/ExtendedResponse.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/ldap/ExtendedResponse.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/ldap/ExtendedResponse.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/ldap/ExtendedResponse.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,52 @@
+/* ExtendedResponse.java --
+ Copyright (C) 2001, 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.naming.ldap;
+
+import java.io.Serializable;
+
+/**
+ * @author Warren Levy (warrenl at redhat.com)
+ * @date June 1, 2001
+ */
+
+public interface ExtendedResponse extends Serializable
+{
+ String getID();
+ byte[] getEncodedValue();
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/ldap/HasControls.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/ldap/HasControls.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/ldap/HasControls.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/ldap/HasControls.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,51 @@
+/* HasControls.java --
+ Copyright (C) 2001, 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.naming.ldap;
+
+import javax.naming.NamingException;
+
+/**
+ * @author Warren Levy (warrenl at redhat.com)
+ * @date June 1, 2001
+ */
+
+public interface HasControls
+{
+ Control[] getControls() throws NamingException;
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/ldap/InitialLdapContext.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/ldap/InitialLdapContext.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/ldap/InitialLdapContext.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/ldap/InitialLdapContext.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,133 @@
+/* InitialLdapContext.java --
+ Copyright (C) 2001, 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.naming.ldap;
+
+import java.util.Hashtable;
+
+import javax.naming.Context;
+import javax.naming.NamingException;
+import javax.naming.NoInitialContextException;
+import javax.naming.NotContextException;
+import javax.naming.directory.InitialDirContext;
+
+/**
+ * @author Tom Tromey (tromey at redhat.com)
+ * @date June 21, 2001
+ */
+public class InitialLdapContext
+ extends InitialDirContext
+ implements LdapContext
+{
+ public InitialLdapContext ()
+ throws NamingException
+ {
+ this (null, null);
+ }
+
+ public InitialLdapContext (Hashtable environment, Control[] connControls)
+ throws NamingException
+ {
+ super (false);
+
+ if (connControls != null)
+ {
+ if (environment == null)
+ environment = new Hashtable ();
+ else
+ environment = (Hashtable) environment.clone ();
+ environment.put ("java.naming.ldap.control.connect",
+ connControls);
+ }
+
+ init (environment);
+ }
+
+ private LdapContext getDefaultInitLdapCtx ()
+ throws NamingException
+ {
+ Context c = getDefaultInitCtx ();
+ if (c == null)
+ throw new NoInitialContextException ();
+ else if (! (c instanceof LdapContext))
+ throw new NotContextException ();
+ return (LdapContext) c;
+ }
+
+ public ExtendedResponse extendedOperation (ExtendedRequest request)
+ throws NamingException
+ {
+ return getDefaultInitLdapCtx ().extendedOperation (request);
+ }
+
+ public Control[] getConnectControls ()
+ throws NamingException
+ {
+ return getDefaultInitLdapCtx ().getConnectControls ();
+ }
+
+ public Control[] getRequestControls ()
+ throws NamingException
+ {
+ return getDefaultInitLdapCtx ().getRequestControls ();
+ }
+
+ public Control[] getResponseControls ()
+ throws NamingException
+ {
+ return getDefaultInitLdapCtx ().getResponseControls ();
+ }
+
+ public LdapContext newInstance (Control[] reqControls)
+ throws NamingException
+ {
+ return getDefaultInitLdapCtx ().newInstance (reqControls);
+ }
+
+ public void reconnect (Control[] connControls)
+ throws NamingException
+ {
+ getDefaultInitLdapCtx ().reconnect (connControls);
+ }
+
+ public void setRequestControls (Control[] reqControls)
+ throws NamingException
+ {
+ getDefaultInitLdapCtx ().setRequestControls (reqControls);
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/ldap/LdapContext.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/ldap/LdapContext.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/ldap/LdapContext.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/ldap/LdapContext.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,63 @@
+/* LdapContext.java --
+ Copyright (C) 2001, 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.naming.ldap;
+
+import javax.naming.NamingException;
+import javax.naming.directory.DirContext;
+
+/**
+ * @author Warren Levy (warrenl at redhat.com)
+ * @date June 1, 2001
+ */
+
+public interface LdapContext extends DirContext
+{
+ String CONTROL_FACTORIES = "java.naming.factory.control";
+
+ ExtendedResponse extendedOperation(ExtendedRequest request)
+ throws NamingException;
+ LdapContext newInstance(Control[] requestControls)
+ throws NamingException;
+ void reconnect(Control[] connCtls) throws NamingException;
+ Control[] getConnectControls() throws NamingException;
+ void setRequestControls(Control[] requestControls)
+ throws NamingException;
+ Control[] getRequestControls() throws NamingException;
+ Control[] getResponseControls() throws NamingException;
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/ldap/LdapReferralException.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/ldap/LdapReferralException.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/ldap/LdapReferralException.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/ldap/LdapReferralException.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,68 @@
+/* LdapReferralException.java --
+ Copyright (C) 2001, 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.naming.ldap;
+
+import java.util.Hashtable;
+
+import javax.naming.Context;
+import javax.naming.NamingException;
+import javax.naming.ReferralException;
+
+/**
+ * @author Warren Levy (warrenl at redhat.com)
+ * @date June 1, 2001
+ */
+public abstract class LdapReferralException extends ReferralException
+{
+ protected LdapReferralException()
+ {
+ super();
+ }
+
+ protected LdapReferralException(String explanation)
+ {
+ super(explanation);
+ }
+
+ public abstract Context getReferralContext() throws NamingException;
+ public abstract Context getReferralContext(Hashtable env)
+ throws NamingException;
+ public abstract Context getReferralContext(Hashtable env, Control[] reqCtls)
+ throws NamingException;
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/ldap/StartTlsRequest.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/ldap/StartTlsRequest.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/ldap/StartTlsRequest.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/ldap/StartTlsRequest.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,108 @@
+/* StartTlsRequest.java -- extended ldap TLS request
+ Copyright (C) 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.naming.ldap;
+
+import java.util.Iterator;
+
+import gnu.classpath.ServiceFactory;
+
+import javax.naming.NamingException;
+
+/**
+ * @since 1.4
+ */
+public class StartTlsRequest
+ implements ExtendedRequest
+{
+ private static final long serialVersionUID = 4441679576360753397L;
+
+ /**
+ * The assigned object identifier for this response.
+ */
+ public static final String OID = "1.3.6.1.4.1.1466.20037";
+
+ /**
+ * Create a new instance.
+ */
+ public StartTlsRequest()
+ {
+ }
+
+ /**
+ * Return the response identifier. This is simply the value
+ * of the {@link #OID} field.
+ */
+ public String getID()
+ {
+ return OID;
+ }
+
+ /**
+ * Return the encoded value. This implementation always returns null.
+ */
+ public byte[] getEncodedValue()
+ {
+ return null;
+ }
+
+ /**
+ * Create a new extended reponse object, using the standard service
+ * provider approach to load a provider. The provider will be a subclass
+ * of StartTlsRequest with a no-argument constructor. The key is
+ * "javax.naming.ldap.StartTlsRequest".
+ * @param id the identifier, must be {@link #OID} or null
+ * @param berValue ignored
+ * @param offset ignored
+ * @param length ignored
+ * @throws NamingException if there is a problem creating the response
+ */
+ public ExtendedResponse createExtendedResponse(String id, byte[] berValue,
+ int offset, int length)
+ throws NamingException
+ {
+ if (id != null && ! OID.equals(id))
+ throw new NamingException("incorrect id: was \"" + id
+ + "\", but expected: \"" + OID + "\"");
+ Iterator it = ServiceFactory.lookupProviders(StartTlsRequest.class);
+ if (it.hasNext())
+ return (ExtendedResponse) it.next();
+ throw new NamingException("couldn't find provider for "
+ + "javax.naming.ldap.StartTlsRequest");
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/ldap/StartTlsResponse.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/ldap/StartTlsResponse.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/ldap/StartTlsResponse.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/ldap/StartTlsResponse.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,119 @@
+/* StartTlsResponse.java -- extended ldap TLS response
+ Copyright (C) 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.naming.ldap;
+
+import java.io.IOException;
+
+import javax.net.ssl.HostnameVerifier;
+import javax.net.ssl.SSLSession;
+import javax.net.ssl.SSLSocketFactory;
+
+/**
+ * @since 1.4
+ */
+public abstract class StartTlsResponse
+ implements ExtendedResponse
+{
+ private static final long serialVersionUID = 8372842182579276418L;
+
+ /**
+ * The assigned object identifier for this response.
+ */
+ public static final String OID = "1.3.6.1.4.1.1466.20037";
+
+ /**
+ * Create a new instance.
+ */
+ protected StartTlsResponse()
+ {
+ }
+
+ /**
+ * Return the response identifier. This is simply the value
+ * of the {@link #OID} field.
+ */
+ public String getID()
+ {
+ return OID;
+ }
+
+ /**
+ * Return the encoded value. This implementation always returns null.
+ */
+ public byte[] getEncodedValue()
+ {
+ return null;
+ }
+
+ /**
+ * Set the list of cipher suites to use.
+ * @param cipherSuites the list of suites
+ * @see SSLSocketFactory#getSupportedCipherSuites()
+ */
+ public abstract void setEnabledCipherSuites(String[] cipherSuites);
+
+ /**
+ * Set the hostname verifier to use. This must be called before
+ * {@link #negotiate()}.
+ * @param verifier the hostname verifier
+ */
+ public abstract void setHostnameVerifier(HostnameVerifier verifier);
+
+ /**
+ * Negotiate the TLS session using the default SSL socket factory.
+ * @return the SSL session
+ * @throws IOException if communication fails for some reason
+ */
+ public abstract SSLSession negotiate() throws IOException;
+
+ /**
+ * Negotiate the TLS session using the supplied SSL socket factory.
+ * @param factory the socket factory to use
+ * @return the SSL session
+ * @throws IOException if communication fails for some reason
+ */
+ public abstract SSLSession negotiate(SSLSocketFactory factory)
+ throws IOException;
+
+ /**
+ * Close the connection.
+ * @throws IOException if communication fails for some reason
+ */
+ public abstract void close() throws IOException;
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/ldap/UnsolicitedNotification.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/ldap/UnsolicitedNotification.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/ldap/UnsolicitedNotification.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/ldap/UnsolicitedNotification.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,52 @@
+/* UnsolicitedNotification.java --
+ Copyright (C) 2001, 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.naming.ldap;
+
+import javax.naming.NamingException;
+
+/**
+ * @author Warren Levy (warrenl at redhat.com)
+ * @date June 1, 2001
+ */
+
+public interface UnsolicitedNotification extends ExtendedResponse, HasControls
+{
+ String[] getReferrals();
+ NamingException getException();
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/ldap/UnsolicitedNotificationEvent.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/ldap/UnsolicitedNotificationEvent.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/ldap/UnsolicitedNotificationEvent.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/ldap/UnsolicitedNotificationEvent.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,70 @@
+/* UnsolicitedNotificationEvent.java --
+ Copyright (C) 2001, 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.naming.ldap;
+
+import java.util.EventObject;
+
+/**
+ * @author Warren Levy (warrenl at redhat.com)
+ * @date June 5, 2001
+ */
+public class UnsolicitedNotificationEvent extends EventObject
+{
+ private static final long serialVersionUID = -2382603380799883705L;
+
+ // Serialized fields.
+ private UnsolicitedNotification notice;
+
+ public UnsolicitedNotificationEvent(Object src,
+ UnsolicitedNotification notice)
+ {
+ super(src);
+ this.notice = notice;
+ }
+
+ public UnsolicitedNotification getNotification()
+ {
+ return notice;
+ }
+
+ public void dispatch(UnsolicitedNotificationListener listener)
+ {
+ listener.notificationReceived(this);
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/ldap/UnsolicitedNotificationListener.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/ldap/UnsolicitedNotificationListener.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/ldap/UnsolicitedNotificationListener.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/ldap/UnsolicitedNotificationListener.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,51 @@
+/* UnsolicitedNotificationListener.java --
+ Copyright (C) 2001, 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.naming.ldap;
+
+import javax.naming.event.NamingListener;
+
+/**
+ * @author Warren Levy (warrenl at redhat.com)
+ * @date June 1, 2001
+ */
+
+public interface UnsolicitedNotificationListener extends NamingListener
+{
+ void notificationReceived(UnsolicitedNotificationEvent evt);
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/ldap/package.html
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/ldap/package.html?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/ldap/package.html (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/ldap/package.html Thu Nov 8 16:56:19 2007
@@ -0,0 +1,46 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<!-- package.html - describes classes in javax.naming.ldap package.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. -->
+
+<html>
+<head><title>GNU Classpath - javax.naming.ldap</title></head>
+
+<body>
+<p></p>
+
+</body>
+</html>
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/package.html
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/package.html?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/package.html (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/package.html Thu Nov 8 16:56:19 2007
@@ -0,0 +1,46 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<!-- package.html - describes classes in javax.naming package.
+ Copyright (C) 2002 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. -->
+
+<html>
+<head><title>GNU Classpath - javax.naming</title></head>
+
+<body>
+<p></p>
+
+</body>
+</html>
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/spi/DirObjectFactory.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/spi/DirObjectFactory.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/spi/DirObjectFactory.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/spi/DirObjectFactory.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,56 @@
+/* DirObjectFactory.java --
+ Copyright (C) 2001, 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.naming.spi;
+
+import java.util.Hashtable;
+
+import javax.naming.Context;
+import javax.naming.Name;
+import javax.naming.directory.Attributes;
+
+/**
+ * @author Warren Levy (warrenl at redhat.com)
+ * @date June 1, 2001
+ */
+public interface DirObjectFactory extends ObjectFactory
+{
+ Object getObjectInstance(Object obj, Name name, Context nameCtx,
+ Hashtable environment, Attributes attrs)
+ throws Exception;
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/spi/DirStateFactory.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/spi/DirStateFactory.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/spi/DirStateFactory.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/spi/DirStateFactory.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,83 @@
+/* DirStateFactory.java --
+ Copyright (C) 2001, 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.naming.spi;
+
+import java.util.Hashtable;
+
+import javax.naming.Context;
+import javax.naming.Name;
+import javax.naming.NamingException;
+import javax.naming.directory.Attributes;
+
+/**
+ * @author Warren Levy (warrenl at redhat.com)
+ * @date June 1, 2001
+ */
+public interface DirStateFactory extends StateFactory
+{
+ // Inner class
+
+ public static class Result
+ {
+ private Object obj;
+ private Attributes outAttrs;
+
+ public Result(Object obj, Attributes outAttrs)
+ {
+ this.obj = obj;
+ this.outAttrs = outAttrs;
+ }
+
+ public Object getObject()
+ {
+ return obj;
+ }
+
+ public Attributes getAttributes()
+ {
+ return outAttrs;
+ }
+ }
+
+ DirStateFactory.Result getStateToBind(Object obj, Name name,
+ Context nameCtx,
+ Hashtable environment,
+ Attributes inAttrs)
+ throws NamingException;
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/spi/DirectoryManager.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/spi/DirectoryManager.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/spi/DirectoryManager.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/spi/DirectoryManager.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,243 @@
+/* DirectoryManager.java --
+ Copyright (C) 2000, 2001, 2004, 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.naming.spi;
+
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.StringTokenizer;
+
+import javax.naming.CannotProceedException;
+import javax.naming.Context;
+import javax.naming.Name;
+import javax.naming.NamingException;
+import javax.naming.RefAddr;
+import javax.naming.Reference;
+import javax.naming.Referenceable;
+import javax.naming.StringRefAddr;
+import javax.naming.directory.Attributes;
+import javax.naming.directory.DirContext;
+
+/**
+ * @author Tom Tromey (tromey at redhat.com)
+ * @date June 25, 2001
+ */
+public class DirectoryManager extends NamingManager
+{
+ // Can't instantiate this class.
+ DirectoryManager ()
+ {
+ }
+
+ public static DirContext getContinuationDirContext (CannotProceedException c)
+ throws NamingException
+ {
+ return (DirContext) getContinuationContext (c);
+ }
+
+ // Try to create an object using the factory. Return null on
+ // failure.
+ private static Object tryCreateObject (ObjectFactory factory,
+ Object refInfo,
+ Name name,
+ Context nameCtx,
+ Hashtable environment,
+ Attributes attrs)
+ throws Exception
+ {
+ if (factory instanceof DirObjectFactory)
+ {
+ DirObjectFactory dof = (DirObjectFactory) factory;
+ return dof.getObjectInstance (refInfo, name, nameCtx,
+ environment, attrs);
+ }
+ else
+ return factory.getObjectInstance (refInfo, name, nameCtx,
+ environment);
+ }
+
+ public static Object getObjectInstance (Object refInfo, Name name,
+ Context nameCtx,
+ Hashtable environment,
+ Attributes attrs)
+ throws Exception
+ {
+ ObjectFactory factory = null;
+
+ if (ofb != null)
+ factory = ofb.createObjectFactory (refInfo, environment);
+ else
+ {
+ // First see if we have a Reference or a Referenceable. If so
+ // we do some special processing.
+ Object ref2 = refInfo;
+ if (refInfo instanceof Referenceable)
+ ref2 = ((Referenceable) refInfo).getReference ();
+ if (ref2 instanceof Reference)
+ {
+ Reference ref = (Reference) ref2;
+
+ // If we have a factory class name then we use that.
+ String fClass = ref.getFactoryClassName ();
+ if (fClass != null)
+ {
+ // Exceptions here are passed to the caller.
+ Class k = Class.forName (fClass);
+ factory = (ObjectFactory) k.newInstance ();
+ }
+ else
+ {
+ // There's no factory class name. If the address is a
+ // StringRefAddr with address type `URL', then we try
+ // the URL's context factory.
+ Enumeration e = ref.getAll ();
+ while (e.hasMoreElements ())
+ {
+ RefAddr ra = (RefAddr) e.nextElement ();
+ if (ra instanceof StringRefAddr
+ && "URL".equals (ra.getType ()))
+ {
+ factory
+ = (ObjectFactory) getURLContext (refInfo,
+ name,
+ nameCtx,
+ (String) ra.getContent (),
+ environment);
+ Object obj = tryCreateObject (factory,
+ refInfo,
+ name,
+ nameCtx,
+ environment,
+ attrs);
+ if (obj != null)
+ return obj;
+ }
+ }
+
+ // Have to try the next step.
+ factory = null;
+ }
+ }
+
+ // Now look at OBJECT_FACTORIES to find the factory.
+ if (factory == null)
+ {
+ StringTokenizer tokens = getPlusPath (Context.OBJECT_FACTORIES,
+ environment, nameCtx);
+
+ while (tokens.hasMoreTokens ())
+ {
+ String klassName = tokens.nextToken ();
+ Class k = Class.forName (klassName);
+ factory = (ObjectFactory) k.newInstance ();
+ Object obj = tryCreateObject (factory, refInfo, name,
+ nameCtx, environment, attrs);
+ if (obj != null)
+ return obj;
+ }
+
+ // Failure.
+ return refInfo;
+ }
+ }
+
+ if (factory == null)
+ return refInfo;
+ Object obj = tryCreateObject (factory, refInfo, name,
+ nameCtx, environment, attrs);
+ return obj == null ? refInfo : obj;
+ }
+
+ public static DirStateFactory.Result getStateToBind (Object obj,
+ Name name,
+ Context nameCtx,
+ Hashtable environment,
+ Attributes attrs)
+ throws NamingException
+ {
+ StringTokenizer tokens = getPlusPath (Context.STATE_FACTORIES,
+ environment, nameCtx);
+ while (tokens.hasMoreTokens ())
+ {
+ String klassName = tokens.nextToken ();
+ try
+ {
+ Class k = Class.forName (klassName);
+ StateFactory factory = (StateFactory) k.newInstance ();
+
+ DirStateFactory.Result result = null;
+ if (factory instanceof DirStateFactory)
+ {
+ DirStateFactory dsf = (DirStateFactory) factory;
+ result = dsf.getStateToBind (obj, name, nameCtx, environment,
+ attrs);
+ }
+ else
+ {
+ Object o = factory.getStateToBind (obj, name, nameCtx,
+ environment);
+ if (o != null)
+ result = new DirStateFactory.Result (o, attrs);
+ }
+ if (result != null)
+ return result;
+ }
+ catch (ClassNotFoundException _1)
+ {
+ // Ignore it.
+ }
+ catch (ClassCastException _2)
+ {
+ // This means that the class we found was not an
+ // ObjectFactory or that the factory returned something
+ // which was not a Context.
+ }
+ catch (InstantiationException _3)
+ {
+ // If we couldn't instantiate the factory we might get
+ // this.
+ }
+ catch (IllegalAccessException _4)
+ {
+ // Another possibility when instantiating.
+ }
+ }
+
+ return new DirStateFactory.Result (obj, attrs);
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/spi/InitialContextFactory.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/spi/InitialContextFactory.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/spi/InitialContextFactory.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/spi/InitialContextFactory.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,70 @@
+/* InitialContextFactory.java --
+ Copyright (C) 2000, 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.naming.spi;
+
+import java.util.Hashtable;
+
+import javax.naming.Context;
+import javax.naming.NamingException;
+
+/**
+ * <p>
+ * Defines a factory that creates the initial context for the beginning of the
+ * name resolution. JNDI allows to specify different implementations of the
+ * initial context at runtime.
+ * </p>
+ * <p>
+ * The class, implementing this interface, must be public and have a public
+ * parameterless constructor
+ * </p>
+ */
+public interface InitialContextFactory
+{
+ /**
+ * Create a new initial context
+ *
+ * @param environment the properties, used when creating the context. The
+ * implementing class will not modify the table nor keep the
+ * reference to it. After the method returns, the caller can safely
+ * reuse the table for other purposes.
+ * @return the new initial context
+ * @throws NamingException if the naming exception has occured
+ */
+ Context getInitialContext(Hashtable environment) throws NamingException;
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/spi/InitialContextFactoryBuilder.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/spi/InitialContextFactoryBuilder.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/spi/InitialContextFactoryBuilder.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/spi/InitialContextFactoryBuilder.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,66 @@
+/* InitialContextFactoryBuilder.java --
+ Copyright (C) 2000, 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.naming.spi;
+
+import java.util.Hashtable;
+
+import javax.naming.NamingException;
+
+/**
+ * Represents the builder that creates instances of the factories that produce
+ * initial naming contexts. JNDI allows to specifiy different initial contexts
+ * at runtime. The user program can install its own initial context factory
+ * builder.
+ *
+ * @see NamingManager#setInitialContextFactoryBuilder
+ */
+public interface InitialContextFactoryBuilder
+{
+ /**
+ * Create the new inital context factory
+ *
+ * @param environment the properties, used for creation of the initial context
+ * factory. The parameter is owned by the caller: it is safe to reuse
+ * the table for other purposes after the method returns.
+ * @return the created initial context factory, never null.
+ * @throws NamingException on failure
+ */
+ InitialContextFactory createInitialContextFactory (Hashtable environment)
+ throws NamingException;
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/spi/NamingManager.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/spi/NamingManager.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/spi/NamingManager.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/spi/NamingManager.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,654 @@
+/* NamingManager.java -- Creates contexts and objects
+ Copyright (C) 2000, 2001, 2002, 2003, 2004,
+ 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.naming.spi;
+
+import gnu.classpath.VMStackWalker;
+
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.StringTokenizer;
+
+import javax.naming.CannotProceedException;
+import javax.naming.Context;
+import javax.naming.Name;
+import javax.naming.NamingException;
+import javax.naming.NoInitialContextException;
+import javax.naming.RefAddr;
+import javax.naming.Reference;
+import javax.naming.Referenceable;
+import javax.naming.StringRefAddr;
+
+/**
+ * Contains methods for creating contexts and objects referred to by
+ * location information. The location is specified in the scope of the
+ * certain naming or directory service. This class only contais static
+ * methods and cannot be instantiated.
+ */
+public class NamingManager
+{
+ /**
+ * The environment property into which getContinuationContext() stores the
+ * value of the CannotProceedException parameter. The value of this field
+ * is <i>java.naming.spi.CannotProceedException<i>.
+ */
+ public static final String CPE = "java.naming.spi.CannotProceedException";
+
+ private static InitialContextFactoryBuilder icfb;
+
+ // Package private so DirectoryManager can access it.
+ static ObjectFactoryBuilder ofb;
+
+ // This class cannot be instantiated.
+ NamingManager ()
+ {
+ }
+
+ /**
+ * Checks if the initial context factory builder has been set.
+ *
+ * @return true if the builder has been set
+ *
+ * @see #setInitialContextFactoryBuilder(InitialContextFactoryBuilder)
+ */
+ public static boolean hasInitialContextFactoryBuilder ()
+ {
+ return icfb != null;
+ }
+
+ /**
+ * Creates the initial context. If the initial object factory builder has
+ * been set with {@link #setObjectFactoryBuilder(ObjectFactoryBuilder)},
+ * the work is delegated to this builder. Otherwise, the method searches
+ * for the property Context.INITIAL_CONTEXT_FACTORY first in the passed
+ * table and then in the system properties. The value of this property is
+ * uses as a class name to install the context factory. The corresponding
+ * class must exist, be public and have the public parameterless constructor.
+ *
+ * @param environment the properties, used to create the context.
+ *
+ * @return the created context
+ *
+ * @throws NoInitialContextException if the initial builder is not set,
+ * the property Context.INITIAL_CONTEXT_FACTORY is missing of the
+ * class, named by this property, cannot be instantiated.
+ * @throws NamingException if throws by the context factory
+ */
+ public static Context getInitialContext (Hashtable environment)
+ throws NamingException
+ {
+ InitialContextFactory icf = null;
+
+ if (icfb != null)
+ icf = icfb.createInitialContextFactory(environment);
+ else
+ {
+ String java_naming_factory_initial = null;
+ if (environment != null)
+ java_naming_factory_initial
+ = (String) environment.get (Context.INITIAL_CONTEXT_FACTORY);
+ if (java_naming_factory_initial == null)
+ java_naming_factory_initial =
+ System.getProperty (Context.INITIAL_CONTEXT_FACTORY);
+ if (java_naming_factory_initial == null)
+ throw new
+ NoInitialContextException ("Can't find property: "
+ + Context.INITIAL_CONTEXT_FACTORY);
+
+ try
+ {
+ icf = (InitialContextFactory)Class.forName
+ (java_naming_factory_initial, true,
+ Thread.currentThread().getContextClassLoader())
+ .newInstance ();
+ }
+ catch (Exception exception)
+ {
+ NoInitialContextException e
+ = new NoInitialContextException
+ ("Can't load InitialContextFactory class: "
+ + java_naming_factory_initial);
+ e.setRootCause(exception);
+ throw e;
+ }
+ }
+
+ return icf.getInitialContext (environment);
+ }
+
+ /**
+ * <p>
+ * Creates the URL context for the given URL scheme id.
+ * </p>
+ * <p>
+ * The class name of the factory that creates the context has the naming
+ * pattern scheme-idURLContextFactory. For instance, the factory for the "ftp"
+ * sheme should be named "ftpURLContextFactory".
+ * </p>
+ * <p>
+ * The Context.URL_PKG_PREFIXES environment property contains the
+ * colon-separated list of the possible package prefixes. The package name is
+ * constructed concatenating the package prefix with the scheme id. This
+ * property is searched in the passed <i>environment</i> parameter and later
+ * in the system properties.
+ * </p>
+ * <p>
+ * If the factory class cannot be found in the specified packages, system will
+ * try to use the default internal factory for the given scheme.
+ * </p>
+ * <p>
+ * After the factory is instantiated, its method
+ * {@link ObjectFactory#getObjectInstance(Object, Name, Context, Hashtable)}
+ * is called to create and return the object instance.
+ *
+ * @param refInfo passed to the factory
+ * @param name passed to the factory
+ * @param nameCtx passed to the factory
+ * @param scheme the url scheme that must be supported by the given context
+ * @param environment the properties for creating the factory and context (may
+ * be null)
+ * @return the created context
+ * @throws NamingException if thrown by the factory when creating the context.
+ */
+ static Context getURLContext(Object refInfo, Name name, Context nameCtx,
+ String scheme, Hashtable environment)
+ throws NamingException
+ {
+ // Specified as the default in the docs. Unclear if this is
+ // right for us.
+ String defaultPrefix = "com.sun.jndi.url";
+
+ StringBuffer allPrefixes = new StringBuffer();
+
+ String prefixes;
+ if (environment != null)
+ {
+ prefixes = (String) environment.get(Context.URL_PKG_PREFIXES);
+ if (prefixes != null)
+ allPrefixes.append(prefixes);
+ }
+
+ prefixes = System.getProperty(Context.URL_PKG_PREFIXES);
+ if (prefixes != null)
+ {
+ if (allPrefixes.length() > 0)
+ allPrefixes.append(':');
+ allPrefixes.append(prefixes);
+ }
+
+ if (allPrefixes.length() > 0)
+ allPrefixes.append(':');
+ allPrefixes.append(defaultPrefix);
+
+ scheme = scheme + "." + scheme + "URLContextFactory";
+
+ StringTokenizer tokens = new StringTokenizer(allPrefixes.toString(), ":");
+ while (tokens.hasMoreTokens())
+ {
+ String aTry = tokens.nextToken();
+ try
+ {
+ String tryClass = aTry + "." + scheme;
+ Class factoryClass = forName(tryClass);
+ if (factoryClass != null)
+ {
+ ObjectFactory factory = (ObjectFactory) factoryClass.newInstance();
+ Object obj = factory.getObjectInstance(refInfo, name, nameCtx,
+ environment);
+ Context ctx = (Context) obj;
+ if (ctx != null)
+ return ctx;
+ }
+ }
+ catch (ClassNotFoundException _1)
+ {
+ // Ignore it.
+ }
+ catch (ClassCastException _2)
+ {
+ // This means that the class we found was not an
+ // ObjectFactory or that the factory returned something
+ // which was not a Context.
+ }
+ catch (InstantiationException _3)
+ {
+ // If we couldn't instantiate the factory we might get
+ // this.
+ }
+ catch (IllegalAccessException _4)
+ {
+ // Another possibility when instantiating.
+ }
+ catch (NamingException _5)
+ {
+ throw _5;
+ }
+ catch (Exception _6)
+ {
+ // Anything from getObjectInstance.
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * Load the class with the given name. This method tries to use the context
+ * class loader first. If this fails, it searches for the suitable class
+ * loader in the caller stack trace. This method is a central point where all
+ * requests to find a class by name are delegated.
+ */
+ static Class forName(String className)
+ {
+ try
+ {
+ return Class.forName(className, true,
+ Thread.currentThread().getContextClassLoader());
+ }
+ catch (ClassNotFoundException nex)
+ {
+ /**
+ * Returns the first user defined class loader on the call stack, or
+ * null when no non-null class loader was found.
+ */
+ Class[] ctx = VMStackWalker.getClassContext();
+ for (int i = 0; i < ctx.length; i++)
+ {
+ // Since we live in a class loaded by the bootstrap
+ // class loader, getClassLoader is safe to call without
+ // needing to be wrapped in a privileged action.
+ ClassLoader cl = ctx[i].getClassLoader();
+ try
+ {
+ if (cl != null)
+ return Class.forName(className, true, cl);
+ }
+ catch (ClassNotFoundException nex2)
+ {
+ // Try next.
+ }
+ }
+ }
+ return null;
+ }
+
+
+ /**
+ * <p>
+ * Creates the URL context for the given URL scheme id.
+ * </p>
+ * <p>
+ * The class name of the factory that creates the context has the naming
+ * pattern scheme-idURLContextFactory. For instance, the factory for the "ftp"
+ * sheme should be named "ftpURLContextFactory". The Context.URL_PKG_PREFIXES
+ * environment property contains the colon-separated list of the possible
+ * package prefixes. The package name is constructed concatenating the package
+ * prefix with the scheme id.
+ * </p>
+ * <p>
+ * If the factory class cannot be found in the specified packages, system will
+ * try to use the default internal factory for the given scheme.
+ * </p>
+ * <p>
+ * After the factory is instantiated, its method
+ * {@link ObjectFactory#getObjectInstance(Object, Name, Context, Hashtable)}
+ * is called to create and return the object instance.
+ *
+ * @param scheme the url scheme that must be supported by the given context
+ * @param environment the properties for creating the factory and context (may
+ * be null)
+ * @return the created context
+ * @throws NamingException if thrown by the factory when creating the context.
+ */
+ public static Context getURLContext (String scheme,
+ Hashtable environment)
+ throws NamingException
+ {
+ return getURLContext (null, null, null, scheme, environment);
+ }
+
+ /**
+ * Sets the initial object factory builder.
+ *
+ * @param builder the builder to set
+ *
+ * @throws SecurityException if the builder cannot be installed due
+ * security restrictions.
+ * @throws NamingException if the builder cannot be installed due other
+ * reasons
+ * @throws IllegalStateException if setting the builder repeatedly
+ */
+ public static void setObjectFactoryBuilder (ObjectFactoryBuilder builder)
+ throws NamingException
+ {
+ SecurityManager sm = System.getSecurityManager ();
+ if (sm != null)
+ sm.checkSetFactory ();
+ // Once the builder is installed it cannot be replaced.
+ if (ofb != null)
+ throw new IllegalStateException ("object factory builder already installed");
+ if (builder != null)
+ ofb = builder;
+ }
+
+ static StringTokenizer getPlusPath (String property, Hashtable env,
+ Context nameCtx)
+ throws NamingException
+ {
+ String path = (String) env.get (property);
+ if (nameCtx == null)
+ nameCtx = getInitialContext (env);
+ String path2 = (String) nameCtx.getEnvironment ().get (property);
+ if (path == null)
+ path = path2;
+ else if (path2 != null)
+ path += ":" + path2;
+ return new StringTokenizer (path != null ? path : "", ":");
+ }
+
+ /**
+ * <p>Creates an object for the specified name context, environment and
+ * referencing context object.</p>
+ * <p>
+ * If the builder factory is set by
+ * {@link #setObjectFactoryBuilder(ObjectFactoryBuilder)}, the call is
+ * delegated to that factory. Otherwise, the object is created using the
+ * following rules:
+ * <ul>
+ * <li>If the referencing object (refInfo) contains the factory class name,
+ * the object is created by this factory. If the creation fails,
+ * the parameter refInfo is returned as the method return value.</li>
+ * <li>If the referencing object has no factory class name, and the addresses
+ * are StringRefAddrs having the address type "URL", the object is
+ * created by the URL context factory. The used factory corresponds the
+ * the naming schema of the each URL. If the attempt to create
+ * the object this way is not successful, the subsequent rule is
+ * tried.</li>
+ * <li> If the refInfo is not an instance of Reference or Referencable
+ * (for example, null), the object is created by the factories,
+ * specified in the Context.OBJECT_FACTORIES property of the
+ * environment and the provider resource file, associated with the
+ * nameCtx. The value of this property is the colon separated list
+ * of the possible factories. If none of the factories can be
+ * loaded, the refInfo is returned.
+ * </ul>
+ * </p>
+ * <p>The object factory must be public and have the public parameterless
+ * constructor.</p>
+ *
+ * @param refInfo the referencing object, for which the new object must be
+ * created (can be null). If not null, it is usually an instance of
+ * the {@link Reference} or {@link Referenceable}.
+ * @param name the name of the object. The name is relative to
+ * the nameCtx naming context. The value of this parameter can be
+ * null if the name is not specified.
+ * @param nameCtx the naming context, in which scope the name of the new
+ * object is specified. If this parameter is null, the name is
+ * specified in the scope of the initial context.
+ * @param environment contains additional information for creating the object.
+ * This paramter can be null if there is no need to provide any
+ * additional information.
+ *
+ * @return the created object. If the creation fails, in some cases
+ * the parameter refInfo may be returned.
+ *
+ * @throws NamingException if the attempt to name the new object has failed
+ * @throws Exception if the object factory throws it. The object factory
+ * only throws an exception if it does not want other factories
+ * to be used to create the object.
+ */
+ public static Object getObjectInstance (Object refInfo,
+ Name name,
+ Context nameCtx,
+ Hashtable environment)
+ throws Exception
+ {
+ ObjectFactory factory = null;
+
+ if (ofb != null)
+ factory = ofb.createObjectFactory (refInfo, environment);
+ else
+ {
+ // First see if we have a Reference or a Referenceable. If so
+ // we do some special processing.
+ Object ref2 = refInfo;
+ if (refInfo instanceof Referenceable)
+ ref2 = ((Referenceable) refInfo).getReference ();
+ if (ref2 instanceof Reference)
+ {
+ Reference ref = (Reference) ref2;
+
+ // If we have a factory class name then we use that.
+ String fClass = ref.getFactoryClassName ();
+ if (fClass != null)
+ {
+ // Exceptions here are passed to the caller.
+ Class k = Class.forName (fClass,
+ true,
+ Thread.currentThread().getContextClassLoader());
+ factory = (ObjectFactory) k.newInstance ();
+ }
+ else
+ {
+ // There's no factory class name. If the address is a
+ // StringRefAddr with address type `URL', then we try
+ // the URL's context factory.
+ Enumeration e = ref.getAll ();
+ while (e.hasMoreElements ())
+ {
+ RefAddr ra = (RefAddr) e.nextElement ();
+ if (ra instanceof StringRefAddr
+ && "URL".equals (ra.getType ()))
+ {
+ factory
+ = (ObjectFactory) getURLContext (refInfo,
+ name,
+ nameCtx,
+ (String) ra.getContent (),
+ environment);
+ Object obj = factory.getObjectInstance (refInfo,
+ name,
+ nameCtx,
+ environment);
+ if (obj != null)
+ return obj;
+ }
+ }
+
+ // Have to try the next step.
+ factory = null;
+ }
+ }
+
+ // Now look at OBJECT_FACTORIES to find the factory.
+ if (factory == null)
+ {
+ StringTokenizer tokens = getPlusPath (Context.OBJECT_FACTORIES,
+ environment, nameCtx);
+
+ while (tokens.hasMoreTokens ())
+ {
+ String klassName = tokens.nextToken ();
+ Class k = Class.forName (klassName,
+ true,
+ Thread.currentThread().getContextClassLoader());
+ factory = (ObjectFactory) k.newInstance ();
+ Object obj = factory.getObjectInstance (refInfo, name,
+ nameCtx, environment);
+ if (obj != null)
+ return obj;
+ }
+
+ // Failure.
+ return refInfo;
+ }
+ }
+
+ if (factory == null)
+ return refInfo;
+ Object obj = factory.getObjectInstance (refInfo, name,
+ nameCtx, environment);
+ return obj == null ? refInfo : obj;
+ }
+
+ /**
+ * Sets the initial context factory builder.
+ *
+ * @param builder the builder to set
+ *
+ * @throws SecurityException if the builder cannot be installed due
+ * security restrictions.
+ * @throws NamingException if the builder cannot be installed due other
+ * reasons
+ * @throws IllegalStateException if setting the builder repeatedly
+ *
+ * @see #hasInitialContextFactoryBuilder()
+ */
+ public static void setInitialContextFactoryBuilder
+ (InitialContextFactoryBuilder builder)
+ throws NamingException
+ {
+ SecurityManager sm = System.getSecurityManager ();
+ if (sm != null)
+ sm.checkSetFactory ();
+ // Once the builder is installed it cannot be replaced.
+ if (icfb != null)
+ throw new IllegalStateException ("ctx factory builder already installed");
+ if (builder != null)
+ icfb = builder;
+ }
+
+ /**
+ * Creates a context in which the context operation must be continued.
+ * This method is used by operations on names that span multiple namespaces.
+ *
+ * @param cpe the exception that triggered this continuation. This method
+ * obtains the environment ({@link CannotProceedException#getEnvironment()}
+ * and sets the environment property {@link #CPE} = cpe.
+ *
+ * @return a non null context for continuing the operation
+ *
+ * @throws NamingException if the naming problems have occured
+ */
+ public static Context getContinuationContext (CannotProceedException cpe)
+ throws NamingException
+ {
+ Hashtable env = cpe.getEnvironment ();
+ if (env != null)
+ env.put (CPE, cpe);
+
+ // TODO: Check if this implementation matches the API specification
+ try
+ {
+ Object obj = getObjectInstance (cpe.getResolvedObj(),
+ cpe.getAltName (),
+ cpe.getAltNameCtx (),
+ env);
+ if (obj != null)
+ return (Context) obj;
+ }
+ catch (Exception _)
+ {
+ }
+
+ // fix stack trace for re-thrown exception (message confusing otherwise)
+ cpe.fillInStackTrace();
+
+ throw cpe;
+ }
+
+ /**
+ * Get the object state for binding.
+ *
+ * @param obj the object, for that the binding state must be retrieved. Cannot
+ * be null.
+ * @param name the name of this object, related to the nameCtx. Can be null if
+ * not specified.
+ * @param nameCtx the naming context, to that the object name is related. Can
+ * be null if the name is related to the initial default context.
+ * @param environment the properties for creating the object state. Can be
+ * null if no properties are provided.
+ * @return the object state for binding, may be null if no changes are
+ * returned by the factory
+ * @throws NamingException
+ */
+ public static Object getStateToBind (Object obj, Name name,
+ Context nameCtx, Hashtable environment)
+ throws NamingException
+ {
+ StringTokenizer tokens = getPlusPath (Context.STATE_FACTORIES,
+ environment, nameCtx);
+ while (tokens.hasMoreTokens ())
+ {
+ String klassName = tokens.nextToken ();
+ try
+ {
+ Class k = Class.forName (klassName,
+ true,
+ Thread.currentThread().getContextClassLoader());
+ StateFactory factory = (StateFactory) k.newInstance ();
+ Object o = factory.getStateToBind (obj, name, nameCtx,
+ environment);
+ if (o != null)
+ return o;
+ }
+ catch (ClassNotFoundException _1)
+ {
+ // Ignore it.
+ }
+ catch (ClassCastException _2)
+ {
+ // This means that the class we found was not an
+ // ObjectFactory or that the factory returned something
+ // which was not a Context.
+ }
+ catch (InstantiationException _3)
+ {
+ // If we couldn't instantiate the factory we might get
+ // this.
+ }
+ catch (IllegalAccessException _4)
+ {
+ // Another possibility when instantiating.
+ }
+ }
+
+ return obj;
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/spi/ObjectFactory.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/spi/ObjectFactory.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/spi/ObjectFactory.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/spi/ObjectFactory.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,75 @@
+/* ObjectFactory.java --
+ Copyright (C) 2001, 2004, 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.naming.spi;
+
+import java.util.Hashtable;
+
+import javax.naming.Context;
+import javax.naming.Name;
+
+/**
+ * Represents a factory for creating the object. ObjectFactory performs the
+ * operation, that is the opposite to the operation, performed by the
+ * {@link StateFactory}. Classes, implementing this interface, must be public
+ * and have public parameterless constructor.
+ */
+public interface ObjectFactory
+{
+ /**
+ * Creates the object, using the specified name and location information. The
+ * call of this method must be thread safe.
+ *
+ * @param refObj may provide the reference and location information. Can be null.
+ * @param name the name of the new object in the scope of the specified naming
+ * context. Can be null if the name is not specified.
+ * @param nameCtx the context, in which the object name is specified. Can be
+ * null if the name is specified in the scope of the default initial
+ * context.
+ * @param environment the properties, providing additional information on how
+ * to create an object. Can be null if not additional information is
+ * provided.
+ * @return the newly created object or null if the object cannot be created
+ * @throws Exception if this factory suggest not to try creating of this
+ * object by other alternative factories
+ *
+ * @see NamingManager#getObjectInstance(Object, Name, Context, Hashtable)
+ */
+ Object getObjectInstance(Object refObj, Name name, Context nameCtx,
+ Hashtable environment) throws Exception;
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/spi/ObjectFactoryBuilder.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/spi/ObjectFactoryBuilder.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/spi/ObjectFactoryBuilder.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/spi/ObjectFactoryBuilder.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,70 @@
+/* ObjectFactoryBuilder.java -- the builder that creates the object factories.
+ Copyright (C) 2001, 2004, 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.naming.spi;
+
+import java.util.Hashtable;
+
+import javax.naming.NamingException;
+import javax.naming.Reference;
+import javax.naming.Referenceable;
+
+/**
+ * Represents the builder that creates the object factories.
+ *
+ * @see NamingManager#setObjectFactoryBuilder(ObjectFactoryBuilder)
+ *
+ * @author Warren Levy (warrenl at redhat.com)
+ */
+public interface ObjectFactoryBuilder
+{
+ /**
+ * Create a new object using the supplied environment.
+ *
+ * @param refInfo the referencing object, for which the new object must be
+ * created (can be null). If not null, it is usually an instance of
+ * the {@link Reference} or {@link Referenceable}.
+ * @param environment contains the additional information about the factory
+ * being created. Can be null.
+ * @return the created object factory. The null is never returned.
+ * @throws NamingException
+ */
+ ObjectFactory createObjectFactory(Object refInfo,
+ Hashtable environment)
+ throws NamingException;
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/spi/ResolveResult.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/spi/ResolveResult.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/spi/ResolveResult.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/spi/ResolveResult.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,182 @@
+/* ResolveResult.java --
+ Copyright (C) 2001, 2004, 2005, 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.naming.spi;
+
+import java.io.Serializable;
+
+import javax.naming.CompositeName;
+import javax.naming.InvalidNameException;
+import javax.naming.Name;
+
+/**
+ * Stores the partial resolution of the name. This class contains the
+ * object to which part of the name has been resolved and the remaining,
+ * unresolved part of this name.
+ *
+ * @author Warren Levy (warrenl at redhat.com)
+ */
+
+public class ResolveResult implements Serializable
+{
+ private static final long serialVersionUID = - 4552108072002407559L;
+
+ // Serialized fields.
+ /**
+ * The object, to that part of the name has been resolved.
+ */
+ protected Object resolvedObj;
+
+ /**
+ * The remaining, unresolved part of the name.
+ */
+ protected Name remainingName;
+
+ /**
+ * Create the unitialised instance with both parts being null.
+ */
+ protected ResolveResult()
+ {
+ }
+
+ /**
+ * Create the initialised instance
+ *
+ * @param resolved the object, to that the name is partially resolved
+ * @param remaining the remaining unresolved part of the name.
+ */
+ public ResolveResult(Object resolved, String remaining)
+ {
+ if (resolved == null || remaining == null)
+ throw new IllegalArgumentException ();
+ resolvedObj = resolved;
+ remainingName = new CompositeName ();
+ try
+ {
+ remainingName.add (remaining);
+ }
+ catch (InvalidNameException _)
+ {
+ }
+ }
+
+ /**
+ * Create the initialised instance
+ *
+ * @param resolved the object, to that the name is partially resolved
+ * @param remaining the remaining unresolved part of the name.
+ */
+ public ResolveResult(Object resolved, Name remaining)
+ {
+ resolvedObj = resolved;
+ remainingName = remaining;
+ }
+
+ /**
+ * Get the remaining unresolved part of the name
+ *
+ * @return the remaining unresolved part of the name.
+ */
+ public Name getRemainingName()
+ {
+ return remainingName;
+ }
+
+ /**
+ * Get the object to that the name was partially resolved
+ *
+ * @return the object, to that the name is partially resolved
+ */
+ public Object getResolvedObj()
+ {
+ return resolvedObj;
+ }
+
+ /**
+ * Set the remaining unresolved name.
+ *
+ * @param name the name being set. The passed parameter is cloned, so the
+ * caller can reuse or modify it after the method returns.
+ */
+ public void setRemainingName(Name name)
+ {
+ remainingName = (Name) name.clone();
+ }
+
+ /**
+ * Append the name to the end of the resolved name.
+ *
+ * @param name the name to append
+ */
+ public void appendRemainingName(Name name)
+ {
+ try
+ {
+ remainingName.addAll(name);
+ }
+ catch (InvalidNameException _)
+ {
+ }
+ }
+
+ /**
+ * Append the name to the end of the resolved name.
+ *
+ * @param name the name to append
+ */
+ public void appendRemainingComponent(String name)
+ {
+ try
+ {
+ remainingName.add(name);
+ }
+ catch (InvalidNameException _)
+ {
+ }
+ }
+
+ /**
+ * Set the object to that the part of the name has been resolved.
+ *
+ * @param obj the object, to that the name has been partially resolved.
+ */
+ public void setResolvedObj(Object obj)
+ {
+ resolvedObj = obj;
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/spi/Resolver.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/spi/Resolver.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/spi/Resolver.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/spi/Resolver.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,84 @@
+/* Resolver.java --
+ Copyright (C) 2001, 2005, 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.naming.spi;
+
+import javax.naming.Context;
+import javax.naming.Name;
+import javax.naming.NamingException;
+import javax.naming.NotContextException;
+
+/**
+ * <p>Represents the object, capable for the at least partial name resolution.
+ * The object is not necessay capable for the complete name resolution and
+ * need not implement the {@link Context}.</p>
+ * <p>
+ * Both passed parameters and returned results are owned by the caller.</p>
+ *
+ * @author Warren Levy (warrenl at redhat.com)
+ */
+public interface Resolver
+{
+ /**
+ * Partially resolve the name, stopping at the first instance of the context
+ * that is an instance of the contextType
+ *
+ * @param name the name to resolve
+ * @param contextType the class of the context, on that the resolution should
+ * be terminated
+ * @return the complete or partial name resolution
+ * @throws NotContextException if the context of the contextType is not found
+ * @throws NamingException on other failure
+ */
+ ResolveResult resolveToClass(Name name, Class contextType)
+ throws NamingException;
+
+ /**
+ * Partially resolve the name, stopping at the first instance of the context
+ * that is an instance of the contextType
+ *
+ * @param name the name to resolve
+ * @param contextType the class of the context, on that the resolution should
+ * be terminated
+ * @return the complete or partial name resolution
+ * @throws NotContextException if the context of the contextType is not found
+ * @throws NamingException on other failure
+ */
+ ResolveResult resolveToClass(String name, Class contextType)
+ throws NamingException;
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/spi/StateFactory.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/spi/StateFactory.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/spi/StateFactory.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/spi/StateFactory.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,79 @@
+/* StateFactory.java --
+ Copyright (C) 2001, 2004, 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.naming.spi;
+
+import java.util.Hashtable;
+
+import javax.naming.Context;
+import javax.naming.Name;
+import javax.naming.NamingException;
+
+/**
+ * Represents a factory, producing the object states for binding. The operation,
+ * performed by this factory, is the reverse operation with related to the
+ * operation, performed by the {@link ObjectFactory}. Classes, implementing
+ * this interface, must be public and have public parameterless constructor.
+ *
+ * @see DirStateFactory
+ * @see ObjectFactory
+ * @author Warren Levy (warrenl at redhat.com)
+ */
+public interface StateFactory
+{
+ /**
+ * Get the object state for binding.
+ *
+ * @param obj the object, for that the binding state must be retrieved. Cannot
+ * be null.
+ * @param name the name of this object, related to the nameCtx. Can be null if
+ * not specified.
+ * @param nameCtx the naming context, to that the object name is related. Can
+ * be null if the name is related to the initial default context.
+ * @param environment the properties for creating the object state. Can be
+ * null if no properties are provided.
+ * @return the object state for binding, may be null if no changes are
+ * returned by the factory
+ * @throws NamingException
+ *
+ * @see NamingManager#getStateToBind
+ * @see DirectoryManager#getStateToBind
+ */
+ Object getStateToBind(Object obj, Name name, Context nameCtx,
+ Hashtable environment) throws NamingException;
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/spi/package.html
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/spi/package.html?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/spi/package.html (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/naming/spi/package.html Thu Nov 8 16:56:19 2007
@@ -0,0 +1,46 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<!-- package.html - describes classes in javax.naming.spi package.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. -->
+
+<html>
+<head><title>GNU Classpath - javax.naming.spi</title></head>
+
+<body>
+<p></p>
+
+</body>
+</html>
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ServerSocketFactory.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ServerSocketFactory.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ServerSocketFactory.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ServerSocketFactory.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,122 @@
+/* ServerSocketFactory.java -- factory for server sockets.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.net;
+
+import java.io.IOException;
+
+import java.net.InetAddress;
+import java.net.ServerSocket;
+
+import java.security.Security;
+
+/**
+ * A factory for server sockets. The purpose of this class is to serve
+ * as the superclass of server socket factories that produce server
+ * sockets of a particular type, such as <i>Secure Socket Layer</i>
+ * (<b>SSL</b>) server sockets.
+ *
+ * @author Casey Marshall (rsdio at metastatic.org)
+ */
+public abstract class ServerSocketFactory
+{
+
+ // Constructors.
+ // ------------------------------------------------------------------------
+
+ /**
+ * Default 0-argument constructor.
+ */
+ protected ServerSocketFactory()
+ {
+ super();
+ }
+
+ // Class methods.
+ // ------------------------------------------------------------------------
+
+ /**
+ * Returns the default server socket factory. The type of factory
+ * returned may depend upon the installation.
+ *
+ * @return The default server socket factory.
+ */
+ public static synchronized ServerSocketFactory getDefault()
+ {
+ try
+ {
+ String s = Security.getProperty("gnu.defaultServerSocketFactory");
+ if (s != null)
+ {
+ Class c = Class.forName(s);
+ return (ServerSocketFactory) c.newInstance();
+ }
+ }
+ catch (Exception e)
+ {
+ }
+ return new VanillaServerSocketFactory();
+ }
+
+ // Instance methods.
+ // ------------------------------------------------------------------------
+
+ /**
+ * Create an unbound server socket.
+ *
+ * @return The new server socket.
+ * @throws IOException If a networking error occurs.
+ */
+ public ServerSocket createServerSocket() throws IOException
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Create a server socket bound to the given port.
+ *
+ * @param port The port to bind the server socket to.
+ * @return A server socket bound to <i>port</i>.
+ * @throws IOException If a networking error occurs.
+ */
+ public abstract ServerSocket createServerSocket(int port) throws IOException;
+
+ public abstract ServerSocket createServerSocket(int port, int backlog) throws IOException;
+
+ public abstract ServerSocket createServerSocket(int port, int backlog, InetAddress bindAddress) throws IOException;
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/net/SocketFactory.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/net/SocketFactory.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/net/SocketFactory.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/net/SocketFactory.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,157 @@
+/* SocketFactory.java -- factory for client sockets.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.net;
+
+import java.io.IOException;
+
+import java.net.InetAddress;
+import java.net.Socket;
+import java.net.UnknownHostException;
+
+import java.security.Security;
+
+/**
+ * A factory for client sockets. The purpose of this class is to serve
+ * as the superclass of server socket factories that produce client
+ * sockets of a particular type, such as <i>Secure Socket Layer</i>
+ * (<b>SSL</b>) sockets.
+ *
+ * @author Casey Marshall (rsdio at metastatic.org)
+ */
+public abstract class SocketFactory
+{
+
+ // Constructor.
+ // -------------------------------------------------------------------
+
+ /**
+ * Default 0-arguments constructor.
+ */
+ protected SocketFactory()
+ {
+ super();
+ }
+
+ // Class methods.
+ // -------------------------------------------------------------------
+
+ /**
+ * Returns the default socket factory. The type of factory
+ * returned may depend upon the installation.
+ *
+ * @return The default socket factory.
+ */
+ public static synchronized SocketFactory getDefault()
+ {
+ try
+ {
+ String s = Security.getProperty("gnu.defaultSocketFactory");
+ if (s != null)
+ {
+ Class c = Class.forName(s);
+ return (SocketFactory) c.newInstance();
+ }
+ }
+ catch (Exception e)
+ {
+ }
+ return new VanillaSocketFactory();
+ }
+
+ // Instance methods.
+ // -------------------------------------------------------------------
+
+ /**
+ * Returns an unbound client socket.
+ *
+ * @return The new, unbound socket.
+ */
+ public Socket createSocket() throws IOException
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Creates a socket connected to a given host on a given port.
+ *
+ * @param host The hostname to connect to.
+ * @param port The port on <i>host</i> to connect to.
+ * @return A socket connected to <i>host</i> on <i>port</i>.
+ * @throws IOException If a network error occurs.
+ * @throws UnknownHostException If <i>host</i> cannot be resolved.
+ */
+ public abstract Socket createSocket(String host, int port) throws IOException, UnknownHostException;
+
+ /**
+ * Creates a socket connected to a given host on a given port,
+ * connecting locally to the interface with the given address and port.
+ *
+ * @param host The hostname to connect to.
+ * @param port The port on <i>host</i> to connect to.
+ * @param localHost The address of the local interface to bind to.
+ * @param localPort The local port to bind to.
+ * @return A socket connected to <i>host</i> on <i>port</i>.
+ * @throws IOException If a network error occurs.
+ * @throws UnknownHostException If <i>host</i> cannot be resolved.
+ */
+ public abstract Socket createSocket(String host, int port, InetAddress localHost, int localPort) throws IOException, UnknownHostException;
+
+ /**
+ * Creates a socket connected to a given host on a given port.
+ *
+ * @param host The host address to connect to.
+ * @param port The port on <i>host</i> to connect to.
+ * @return A socket connected to <i>host</i> on <i>port</i>.
+ * @throws IOException If a network error occurs.
+ */
+ public abstract Socket createSocket(InetAddress host, int port) throws IOException;
+
+ /**
+ * Creates a socket connected to a given host on a given port,
+ * connecting locally to the interface with the given address and port.
+ *
+ * @param host The host address to connect to.
+ * @param port The port on <i>host</i> to connect to.
+ * @param localHost The address of the local interface to bind to.
+ * @param localPort The local port to bind to.
+ * @return A socket connected to <i>host</i> on <i>port</i>.
+ * @throws IOException If a network error occurs.
+ */
+ public abstract Socket createSocket(InetAddress hast, int port, InetAddress localHost, int localPort) throws IOException;
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/net/VanillaServerSocketFactory.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/net/VanillaServerSocketFactory.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/net/VanillaServerSocketFactory.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/net/VanillaServerSocketFactory.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,82 @@
+/* VanillaServerSocketFactory.java -- trivial socket factory.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.net;
+
+import java.io.IOException;
+
+import java.net.InetAddress;
+import java.net.ServerSocket;
+
+/**
+ * A trivial server socket factory.
+ */
+class VanillaServerSocketFactory extends ServerSocketFactory
+{
+
+ // Constructor.
+ // ------------------------------------------------------------------
+
+ VanillaServerSocketFactory()
+ {
+ super();
+ }
+
+ // Instance methods.
+ // ------------------------------------------------------------------
+
+ public ServerSocket createServerSocket() throws IOException
+ {
+ return new ServerSocket();
+ }
+
+ public ServerSocket createServerSocket(int port) throws IOException
+ {
+ return new ServerSocket(port);
+ }
+
+ public ServerSocket createServerSocket(int port, int backlog) throws IOException
+ {
+ return new ServerSocket(port, backlog);
+ }
+
+ public ServerSocket createServerSocket(int port, int backlog, InetAddress bindAddress) throws IOException
+ {
+ return new ServerSocket(port, backlog, bindAddress);
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/net/VanillaSocketFactory.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/net/VanillaSocketFactory.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/net/VanillaSocketFactory.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/net/VanillaSocketFactory.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,88 @@
+/* VanillaSocketFactory.java -- trivial socket factory.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.net;
+
+import java.io.IOException;
+
+import java.net.InetAddress;
+import java.net.Socket;
+import java.net.UnknownHostException;
+
+/**
+ * A trivial client socket factory.
+ */
+class VanillaSocketFactory extends SocketFactory
+{
+
+ // Constructor.
+ // ------------------------------------------------------------------
+
+ VanillaSocketFactory()
+ {
+ super();
+ }
+
+ // Instance methods.
+ // ------------------------------------------------------------------
+
+ public Socket createSocket() throws IOException
+ {
+ return new Socket();
+ }
+
+ public Socket createSocket(String host, int port) throws IOException, UnknownHostException
+ {
+ return new Socket(host, port);
+ }
+
+ public Socket createSocket(String host, int port, InetAddress localAddr, int localPort) throws IOException, UnknownHostException
+ {
+ return new Socket(host, port, localAddr, localPort);
+ }
+
+ public Socket createSocket(InetAddress address, int port) throws IOException
+ {
+ return new Socket(address, port);
+ }
+
+ public Socket createSocket(InetAddress address, int port, InetAddress localAddr, int localPort) throws IOException
+ {
+ return new Socket(address, port, localAddr, localPort);
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/net/package.html
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/net/package.html?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/net/package.html (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/net/package.html Thu Nov 8 16:56:19 2007
@@ -0,0 +1,46 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<!-- package.html - describes classes in javax.net package.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. -->
+
+<html>
+<head><title>GNU Classpath - javax.net</title></head>
+
+<body>
+<p></p>
+
+</body>
+</html>
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/HandshakeCompletedEvent.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/HandshakeCompletedEvent.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/HandshakeCompletedEvent.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/HandshakeCompletedEvent.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,152 @@
+/* HandshakeCompletedEvent.java -- SSL handshake completed.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.net.ssl;
+
+import java.security.cert.Certificate;
+
+import javax.security.cert.X509Certificate;
+
+/**
+ * An event raised by a SSLSocket and passed to the {@link
+ * HandshakeCompletedListener#handshakeCompleted(HandshakeCompletedEvent)}
+ * method of all registered listeners when a SSL handshake in a SSL
+ * protocol is completed.
+ *
+ * @author Casey Marshall (rsdio at metastatic.org)
+ */
+public class HandshakeCompletedEvent extends java.util.EventObject
+{
+ // Fields.
+ // -------------------------------------------------------------------
+
+ /** Serialization constant. */
+ private static final long serialVersionUID = 7914963744257769778L;
+
+ /** The session. */
+ private final transient SSLSession session;
+
+ // Constructor.
+ // -------------------------------------------------------------------
+
+ /**
+ * Creates a new handshake completed event.
+ *
+ * @param socket The socket (also the source) creating this event.
+ * @param session The associated session object.
+ * @throws NullPointerException If <i>session</i> is null.
+ */
+ public HandshakeCompletedEvent(SSLSocket socket, SSLSession session)
+ {
+ super(socket);
+ if (session == null)
+ throw new NullPointerException();
+ this.session = session;
+ }
+
+ // Instance methods.
+ // --------------------------------------------------------------------
+
+ /**
+ * Returns the name of the cipher that was negotiated in this
+ * connection.
+ *
+ * @return The negotiated cipher name.
+ */
+ public String getCipherSuite()
+ {
+ if (session != null)
+ return session.getCipherSuite();
+ return null;
+ }
+
+ /**
+ * Returns the local certificates being used in this connection.
+ *
+ * @return The local certificates.
+ */
+ public Certificate[] getLocalCertificates()
+ {
+ if (session != null)
+ return session.getLocalCertificates();
+ return null;
+ }
+
+ /**
+ * Returns the peer's certificates being used in this connection.
+ *
+ * @return The peer's certificates.
+ * @throws SSLPeerUnverifiedException If the peer has not been
+ * verified.
+ */
+ public Certificate[] getPeerCertificates() throws SSLPeerUnverifiedException
+ {
+ if (session != null)
+ return session.getPeerCertificates();
+ return null;
+ }
+
+ public X509Certificate[] getPeerCertificateChain() throws SSLPeerUnverifiedException
+ {
+ if (session != null)
+ return session.getPeerCertificateChain();
+ return null;
+ }
+
+ /**
+ * Returns the SSL session object associated with this connection.
+ *
+ * @return The session object.
+ */
+ public SSLSession getSession()
+ {
+ return session;
+ }
+
+ /**
+ * Returns the socket over which this connection is being
+ * negotiated. This method is equivalent to the {@link
+ * java.util.EventObject#getSource()} method.
+ *
+ * @return The socket.
+ */
+ public SSLSocket getSocket()
+ {
+ return (SSLSocket) getSource();
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/HandshakeCompletedListener.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/HandshakeCompletedListener.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/HandshakeCompletedListener.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/HandshakeCompletedListener.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,57 @@
+/* HandshakeCompletedListener.java -- listens for handshake events.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.net.ssl;
+
+/**
+ * An event listener that waits to be notified of {@link
+ * HandshakeCompletedEvent} objects created when handshake phase of
+ * the SSL protocol is completed for a particular connection.
+ *
+ * @author Casey Marshall (rsdio at metastatic.org)
+ */
+public interface HandshakeCompletedListener extends java.util.EventListener
+{
+
+ /**
+ * Called when the handshake phase of the SSL protocol completes.
+ *
+ * @param event The event describing the new connection.
+ */
+ void handshakeCompleted(HandshakeCompletedEvent event);
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/HostnameVerifier.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/HostnameVerifier.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/HostnameVerifier.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/HostnameVerifier.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,64 @@
+/* HostnameVerifier.java -- verifies disparate hostnames.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.net.ssl;
+
+/**
+ * The interface for classes that perform hostname verification for cases
+ * when the hostname used to begin the connection (such as in a URL)
+ * does not match the hostname used in the SSL handshake.
+ * Implementations of this interface should provide an implementation
+ * of the {@link #verify(java.lang.String,javax.net.ssl.SSLSession)}
+ * method that accepts or rejects hostnames as appropriate.
+ *
+ * @author Casey Marshall (rsdio at metastatic.org)
+ */
+public interface HostnameVerifier
+{
+
+ /**
+ * Verifies a hostname given a particular SSL session. This method
+ * should return <code>true</code> if the hostname is an accepted
+ * alias for the hostname negotiated in the SSL handshake.
+ *
+ * @param hostname The hostname in question.
+ * @param session The current SSL session.
+ * @return <code>true</code> if the hostname is acceptable.
+ */
+ boolean verify(String hostname, SSLSession session);
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/HttpsURLConnection.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/HttpsURLConnection.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/HttpsURLConnection.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/HttpsURLConnection.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,280 @@
+/* HttpsURLConnection.java -- an HTTPS connection.
+ Copyright (C) 2004, 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.net.ssl;
+
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.security.cert.Certificate;
+
+/**
+ * A URL connection that connects via the <i>Secure Socket Layer</i>
+ * (<b>SSL</b>) for HTTPS connections.
+ *
+ * <p>This class may be used in the same way as {@link
+ * HttpURLConnection}, and it will transparently negotiate the SSL
+ * connection.
+ *
+ * @author Casey Marshall (rsdio at metastatic.org)
+ */
+public abstract class HttpsURLConnection extends HttpURLConnection
+{
+
+ // Fields.
+ // ------------------------------------------------------------------
+
+ /**
+ * The default verifier.
+ * This is lazily initialized as required.
+ * @see #getDefaultHostnameVerifier
+ */
+ private static HostnameVerifier defaultVerifier;
+
+ /**
+ * The default factory.
+ * This is lazily initialized as required.
+ * @see #getDefaultSSLSocketFactory
+ */
+ private static SSLSocketFactory defaultFactory;
+
+ /**
+ * The hostname verifier used for this connection.
+ */
+ protected HostnameVerifier hostnameVerifier;
+
+ /**
+ * This connection's socket factory.
+ */
+ private SSLSocketFactory factory;
+
+ // Constructor.
+ // ------------------------------------------------------------------
+
+ /**
+ * Creates a new HTTPS URL connection.
+ *
+ * @param url The URL of the connection being established.
+ * @specnote This was marked as throwing IOException in 1.4,
+ * but this was removed in 1.5.
+ */
+ protected HttpsURLConnection(URL url)
+ {
+ super(url);
+ }
+
+ // Class methods.
+ // ------------------------------------------------------------------
+
+ /**
+ * Returns the default hostname verifier used in all new
+ * connections.
+ * If the default verifier has not been set, a new default one will be
+ * provided by this method.
+ *
+ * @return The default hostname verifier.
+ */
+ public static synchronized HostnameVerifier getDefaultHostnameVerifier()
+ {
+ if (defaultVerifier == null)
+ {
+ defaultVerifier = new TrivialHostnameVerifier();
+ }
+ return defaultVerifier;
+ }
+
+ /**
+ * Sets the default hostname verifier to be used in all new
+ * connections.
+ *
+ * @param newDefault The new default hostname verifier.
+ * @throws IllegalArgumentException If <i>newDefault</i> is null.
+ * @throws SecurityException If there is a security manager
+ * currently installed and the caller does not have the {@link
+ * SSLPermission} "setHostnameVerifier".
+ */
+ public static void setDefaultHostnameVerifier(HostnameVerifier newDefault)
+ {
+ if (newDefault == null)
+ throw new IllegalArgumentException("default verifier cannot be null");
+ SecurityManager sm = System.getSecurityManager();
+ if (sm != null)
+ sm.checkPermission(new SSLPermission("setHostnameVerifier"));
+ synchronized (HttpsURLConnection.class)
+ {
+ defaultVerifier = newDefault;
+ }
+ }
+
+ /**
+ * Returns the default SSL socket factory used in all new
+ * connections.
+ * If the default SSL socket factory has not been set, a new default one
+ * will be provided by this method.
+ *
+ * @return The default SSL socket factory.
+ */
+ public static synchronized SSLSocketFactory getDefaultSSLSocketFactory()
+ {
+ if (defaultFactory == null)
+ {
+ try
+ {
+ defaultFactory = (SSLSocketFactory) SSLSocketFactory.getDefault();
+ }
+ catch (Throwable t)
+ {
+ t.printStackTrace();
+ }
+ }
+ return defaultFactory;
+ }
+
+ /**
+ * Sets the default SSL socket factory to be used in all new
+ * connections.
+ *
+ * @param newDefault The new socket factory.
+ * @throws IllegalArgumentException If <i>newDefault</i> is null.
+ * @throws SecurityException If there is a security manager
+ * installed and a call to {@link
+ * SecurityManager#checkSetFactory()} fails.
+ */
+ public static void setDefaultSSLSocketFactory(SSLSocketFactory newDefault)
+ {
+ if (newDefault == null)
+ throw new IllegalArgumentException("default factory cannot be null");
+ SecurityManager sm = System.getSecurityManager();
+ if (sm != null)
+ sm.checkSetFactory();
+ synchronized (HttpsURLConnection.class)
+ {
+ defaultFactory = newDefault;
+ }
+ }
+
+ // Instance methods.
+ // ------------------------------------------------------------------
+
+ /**
+ * Returns the current hostname verifier for this instance.
+ *
+ * @return The hostname verifier.
+ */
+ public HostnameVerifier getHostnameVerifier()
+ {
+ if (hostnameVerifier == null)
+ {
+ hostnameVerifier = getDefaultHostnameVerifier();
+ }
+ return hostnameVerifier;
+ }
+
+ /**
+ * Sets the hostname verifier for this instance.
+ *
+ * @param hostnameVerifier The new verifier.
+ * @throws IllegalArgumentException If <i>hostnameVerifier</i> is
+ * null.
+ */
+ public void setHostnameVerifier(HostnameVerifier hostnameVerifier)
+ {
+ if (hostnameVerifier == null)
+ throw new IllegalArgumentException("verifier cannot be null");
+ this.hostnameVerifier = hostnameVerifier;
+ }
+
+ /**
+ * Returns the current SSL socket factory for this instance.
+ *
+ * @return The current SSL socket factory.
+ */
+ public SSLSocketFactory getSSLSocketFactory()
+ {
+ if (factory == null)
+ {
+ factory = getDefaultSSLSocketFactory();
+ }
+ return factory;
+ }
+
+ /**
+ * Sets the SSL socket factory for this instance.
+ *
+ * @param factory The new factory.
+ * @throws IllegalArgumentException If <i>factory</i> is null.
+ */
+ public void setSSLSocketFactory(SSLSocketFactory factory)
+ {
+ if (factory == null)
+ throw new IllegalArgumentException("factory cannot be null");
+ this.factory = factory;
+ }
+
+ // Abstract methods.
+ // -------------------------------------------------------------------
+
+ /**
+ * Returns the cipher name negotiated for this connection.
+ *
+ * @return The cipher name.
+ * @throws IllegalStateException If the connection has not yet been
+ * established.
+ */
+ public abstract String getCipherSuite();
+
+ /**
+ * Returns the certificates used on the local side in this
+ * connection.
+ *
+ * @return The local certificates.
+ * @throws IllegalStateException If the connection has not yet been
+ * established.
+ */
+ public abstract Certificate[] getLocalCertificates();
+
+ /**
+ * Returns the certificates sent by the other party.
+ *
+ * @return The peer's certificates.
+ * @throws IllegalStateException If the connection has not yet been
+ * established.
+ * @throws SSLPeerUnverifiedException If the peer could not be
+ * verified.
+ */
+ public abstract Certificate[] getServerCertificates() throws SSLPeerUnverifiedException;
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/KeyManager.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/KeyManager.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/KeyManager.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/KeyManager.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,51 @@
+/* KeyManager.java -- marker interface for key manager classes.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.net.ssl;
+
+/**
+ * A marker interface for objects that serve as key managers in SSL
+ * communications. Key managers typically keep track of the public
+ * certificates and private keys when authenticating the local host to
+ * remote host, and thus is typically used in SSL servers.
+ *
+ * @author Casey Marshall (rsdio at metastatic.org)
+ */
+public interface KeyManager
+{
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/KeyManagerFactory.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/KeyManagerFactory.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/KeyManagerFactory.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/KeyManagerFactory.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,280 @@
+/* KeyManagerFactory.java -- factory for key managers.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.net.ssl;
+
+import gnu.java.security.Engine;
+
+import java.lang.reflect.InvocationTargetException;
+import java.security.AccessController;
+import java.security.InvalidAlgorithmParameterException;
+import java.security.KeyStore;
+import java.security.KeyStoreException;
+import java.security.NoSuchAlgorithmException;
+import java.security.NoSuchProviderException;
+import java.security.PrivilegedAction;
+import java.security.Provider;
+import java.security.Security;
+import java.security.UnrecoverableKeyException;
+
+/**
+ * A class that creates key manager implementations based on a
+ * requested algorithm.
+ *
+ * @author Casey Marshall (rsdio at metastatic.org)
+ */
+public class KeyManagerFactory
+{
+
+ // Constants and fields.
+ // ------------------------------------------------------------------
+
+ /** The service name for key manager factories. */
+ private static final String KEY_MANAGER_FACTORY = "KeyManagerFactory";
+
+ /** The system default trust manager algorithm. */
+ private static final String DEFAULT_ALGORITHM = "JessieX509";
+
+ /** The underlying engine. */
+ private final KeyManagerFactorySpi kmfSpi;
+
+ /** The provider of this implementation. */
+ private final Provider provider;
+
+ /** The name of this algorithm. */
+ private final String algorithm;
+
+ // Constructor.
+ // ------------------------------------------------------------------
+
+ /**
+ * Create a new key manager factory.
+ *
+ * @param kmfSpi The underlying engine.
+ * @param provider The engine's provider.
+ * @param algorithm The name of this algorithm.
+ */
+ protected KeyManagerFactory(KeyManagerFactorySpi kmfSpi,
+ Provider provider, String algorithm)
+ {
+ this.kmfSpi = kmfSpi;
+ this.provider = provider;
+ this.algorithm = algorithm;
+ }
+
+ // Class methods.
+ // ------------------------------------------------------------------
+
+ /**
+ * Get the default algorithm name. This value may be specified at
+ * run-time via the security property
+ * "ssl.KeyManagerFactory.algorithm". If this property is
+ * not specified, this method returns "JessieX509".
+ *
+ * @return The default key manager factory algorithm's name.
+ */
+ public static final String getDefaultAlgorithm()
+ {
+ String alg = null;
+ try
+ {
+ alg = (String) AccessController.doPrivileged(
+ new PrivilegedAction()
+ {
+ public Object run()
+ {
+ return Security.getProperty("ssl.KeyManagerFactory.algorithm");
+ }
+ }
+ );
+ }
+ catch (SecurityException se)
+ {
+ }
+ if (alg == null)
+ alg = DEFAULT_ALGORITHM;
+ return alg;
+ }
+
+ /**
+ * Get an instance of the named key manager factory, from the first
+ * provider that implements it.
+ *
+ * @param algorithm The type of key manager factory to get.
+ * @return An appropriate implementation of that algoritm.
+ * @throws NoSuchAlgorithmException If no provider implements the
+ * requested algorithm.
+ */
+ public static final KeyManagerFactory getInstance(String algorithm)
+ throws NoSuchAlgorithmException
+ {
+ Provider[] provs = Security.getProviders();
+ for (int i = 0; i < provs.length; i++)
+ {
+ try
+ {
+ return getInstance(algorithm, provs[i]);
+ }
+ catch (NoSuchAlgorithmException ignore)
+ {
+ }
+ }
+ throw new NoSuchAlgorithmException(algorithm);
+ }
+
+ /**
+ * Get an instance of the named key manager factory, from the named
+ * provider.
+ *
+ * @param algorithm The type of key manager factory to get.
+ * @param provider The name of the provider to get the
+ * implementation from.
+ * @return An appropriate implementation of that algorithm.
+ * @throws NoSuchAlgorithmException If the provider does not
+ * implement the requested algorithm.
+ * @throws NoSuchProviderException If the named provider does not
+ * exist.
+ */
+ public static final KeyManagerFactory getInstance(String algorithm, String provider)
+ throws NoSuchAlgorithmException, NoSuchProviderException
+ {
+ if (provider == null)
+ throw new IllegalArgumentException("provider is null");
+ Provider p = Security.getProvider(provider);
+ if (p == null)
+ throw new NoSuchProviderException(provider);
+ return getInstance(algorithm, p);
+ }
+
+ /**
+ * Get an instance of the named key manager factory, from the given
+ * provider.
+ *
+ * @param algorithm The type of key manager factory to get.
+ * @param provider The provider to get the implementation from.
+ * @return An appropriate implementation of that algorithm.
+ * @throws NoSuchAlgorithmException If the provider does not
+ * implement the requested algorithm.
+ * @throws IllegalArgumentException If <i>provider</i> is null.
+ */
+ public static final KeyManagerFactory getInstance(String algorithm, Provider provider)
+ throws NoSuchAlgorithmException
+ {
+ if (provider == null)
+ throw new IllegalArgumentException("provider is null");
+ try
+ {
+ return new KeyManagerFactory((KeyManagerFactorySpi)
+ Engine.getInstance(KEY_MANAGER_FACTORY, algorithm, provider),
+ provider, algorithm);
+ }
+ catch (InvocationTargetException ite)
+ {
+ throw new NoSuchAlgorithmException(algorithm);
+ }
+ catch (ClassCastException cce)
+ {
+ throw new NoSuchAlgorithmException(algorithm);
+ }
+ }
+
+ // Instance methods.
+ // -------------------------------------------------------------------
+
+ /**
+ * Returns the name of this key manager factory algorithm.
+ *
+ * @return The name of this key manager factory algorithm.
+ */
+ public final String getAlgorithm()
+ {
+ return algorithm;
+ }
+
+ /**
+ * Get an array of key managers appropriate for this algorithm, with
+ * the most preferred manager first.
+ *
+ * @return The array of key managers.
+ */
+ public final KeyManager[] getKeyManagers()
+ {
+ return kmfSpi.engineGetKeyManagers();
+ }
+
+ /**
+ * Returns the provider of this implementation.
+ *
+ * @return The provider of this implementation.
+ */
+ public final Provider getProvider()
+ {
+ return provider;
+ }
+
+ /**
+ * Initialize this instance with an implementation-dependent
+ * parameter object.
+ *
+ * @param params The parameters to initialize with.
+ * @throws InvalidAlgorithmParameterException If the specified
+ * parameters are inappropriate.
+ */
+ public final void init(ManagerFactoryParameters params)
+ throws InvalidAlgorithmParameterException
+ {
+ kmfSpi.engineInit(params);
+ }
+
+ /**
+ * Initialize this instance with a key store and a password for
+ * private key entries.
+ *
+ * @param store The key store to read.
+ * @param passwd The password protecting private keys in the store.
+ * @throws KeyStoreException If an error occurs reading the keys.
+ * @throws NoSuchAlgorithmException If an algorithm (such as a
+ * certificate algorithm) is not available.
+ * @throws UnrecoverableKeyException If the password is incorrect.
+ */
+ public final void init(KeyStore store, char[] passwd)
+ throws KeyStoreException, NoSuchAlgorithmException, UnrecoverableKeyException
+ {
+ kmfSpi.engineInit(store, passwd);
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/KeyManagerFactorySpi.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/KeyManagerFactorySpi.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/KeyManagerFactorySpi.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/KeyManagerFactorySpi.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,102 @@
+/* KeyManagerFactorySpi.java -- SPI for key manager factories.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.net.ssl;
+
+import java.security.InvalidAlgorithmParameterException;
+import java.security.KeyStore;
+import java.security.KeyStoreException;
+import java.security.NoSuchAlgorithmException;
+import java.security.UnrecoverableKeyException;
+
+/**
+ * The <i>Service Provider Interface</i> (<b>SPI</b>) for key manager
+ * factories.
+ *
+ * @author Casey Marshall (rsdio at metastatic.org)
+ */
+public abstract class KeyManagerFactorySpi
+{
+
+ // Constructor.
+ // ------------------------------------------------------------------
+
+ public KeyManagerFactorySpi()
+ {
+ super();
+ }
+
+ // Abstract methods.
+ // ------------------------------------------------------------------
+
+ /**
+ * Engine method for retrieving this factory's key managers.
+ *
+ * @return The key managers.
+ */
+ protected abstract KeyManager[] engineGetKeyManagers();
+
+ /**
+ * Engine method for initializing this factory with some
+ * algorithm-specific parameters.
+ *
+ * @param params The factory parameters.
+ * @throws InvalidAlgorithmParameterException If the supplied parameters
+ * are inappropriate for this instance.
+ */
+ protected abstract void engineInit(ManagerFactoryParameters params)
+ throws InvalidAlgorithmParameterException;
+
+ /**
+ * Engine method for initializing this factory with a key store and a
+ * password for private keys. Either parameter may be <code>null</code>,
+ * in which case some default parameters (possibly derived from system
+ * properties) should be used.
+ *
+ * @param store The key store.
+ * @param passwd The private key password.
+ * @throws KeyStoreException If the key store cannot be accessed.
+ * @throws NoSuchAlgorithmException If some of the data from the key
+ * store cannot be retrieved.
+ * @throws UnrecoverableKeyException If a private key cannot be retrieved,
+ * likely from a wrong password.
+ */
+ protected abstract void engineInit(KeyStore store, char[] passwd)
+ throws KeyStoreException, NoSuchAlgorithmException,
+ UnrecoverableKeyException;
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/ManagerFactoryParameters.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/ManagerFactoryParameters.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/ManagerFactoryParameters.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/ManagerFactoryParameters.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,50 @@
+/* ManagerFactoryParameters.java -- marker interface for manager parameters.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.net.ssl;
+
+/**
+ * A marker interface for classes that serve as key or trust manager
+ * parameters, used to initialize instances of {@link
+ * KeyManagerFactory} or {@link TrustManagerFactory}.
+ *
+ * @author Casey Marshall (rsdio at metastatic.org)
+ */
+public interface ManagerFactoryParameters
+{
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/SSLContext.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/SSLContext.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/SSLContext.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/SSLContext.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,267 @@
+/* SSLContext.java -- an SSL protocol context.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.net.ssl;
+
+import gnu.java.security.Engine;
+
+import java.lang.reflect.InvocationTargetException;
+import java.security.KeyManagementException;
+import java.security.NoSuchAlgorithmException;
+import java.security.NoSuchProviderException;
+import java.security.Provider;
+import java.security.SecureRandom;
+import java.security.Security;
+
+/**
+ * A "meta-factory" for protocol-specific socket and server socket
+ * factories. This class serves as a clearinghouse for socket
+ * factories and cached session contexts for a particular protocol,
+ * such as SSLv3.
+ *
+ * @author Casey Marshall (rsdio at metastatic.org)
+ */
+public class SSLContext
+{
+ // Constants and fields.
+ // ------------------------------------------------------------------
+
+ /** Service name for SSL contexts. */
+ private static final String SSL_CONTEXT = "SSLContext";
+
+ /** The underlying engine. */
+ private final SSLContextSpi ctxSpi;
+
+ /** The provider of the engine class. */
+ private final Provider provider;
+
+ /** The protocal name. */
+ private final String protocol;
+
+ // Constructor.
+ // ------------------------------------------------------------------
+
+ /**
+ * Create a new SSL context.
+ *
+ * @param ctxSpi The context engine.
+ * @param provider The provider of the implementation.
+ * @param protocol The name of the SSL protocol.
+ */
+ protected SSLContext(SSLContextSpi ctxSpi, Provider provider,
+ String protocol)
+ {
+ this.ctxSpi = ctxSpi;
+ this.provider = provider;
+ this.protocol = protocol;
+ }
+
+ // Class methods.
+ // ------------------------------------------------------------------
+
+ /**
+ * Get an instance of a context for the specified protocol from the
+ * first provider that implements it.
+ *
+ * @param protocol The name of the protocol to get a context for.
+ * @return The new context.
+ * @throws NoSuchAlgorithm If no provider implements the given
+ * protocol.
+ */
+ public static final SSLContext getInstance(String protocol)
+ throws NoSuchAlgorithmException
+ {
+ Provider[] provs = Security.getProviders();
+ for (int i = 0; i < provs.length; i++)
+ {
+ try
+ {
+ return getInstance(protocol, provs[i]);
+ }
+ catch (NoSuchAlgorithmException ignore)
+ {
+ }
+ }
+ throw new NoSuchAlgorithmException(protocol);
+ }
+
+ /**
+ * Get an instance of a context for the specified protocol from the
+ * named provider.
+ *
+ * @param protocol The name of the protocol to get a context for.
+ * @param provider The name of the provider to get the
+ * implementation from.
+ * @return The new context.
+ * @throws NoSuchAlgorithmException If the provider does not
+ * implement the given protocol.
+ * @throws NoSuchProviderException If the named provider does not
+ * exist.
+ * @throws IllegalArgumentException If <i>provider</i> is null.
+ */
+ public static final SSLContext getInstance(String protocol,
+ String provider)
+ throws NoSuchAlgorithmException, NoSuchProviderException
+ {
+ if (provider == null)
+ {
+ throw new IllegalArgumentException("null provider");
+ }
+ Provider p = Security.getProvider(provider);
+ if (p == null)
+ {
+ throw new NoSuchProviderException(provider);
+ }
+ return getInstance(protocol, p);
+ }
+
+ /**
+ * Get an instance of a context for the specified protocol from the
+ * specified provider.
+ *
+ * @param protocol The name of the protocol to get a context for.
+ * @param provider The name of the provider to get the
+ * implementation from.
+ * @return The new context.
+ * @throws NoSuchAlgorithmException If the provider does not
+ * implement the given protocol.
+ * @throws IllegalArgumentException If <i>provider</i> is null.
+ */
+ public static final SSLContext getInstance(String protocol,
+ Provider provider)
+ throws NoSuchAlgorithmException
+ {
+ try
+ {
+ return new SSLContext((SSLContextSpi)
+ Engine.getInstance(SSL_CONTEXT, protocol, provider),
+ provider, protocol);
+ }
+ catch (InvocationTargetException ite)
+ {
+ NoSuchAlgorithmException nsae = new NoSuchAlgorithmException(protocol);
+ throw (NoSuchAlgorithmException) nsae.initCause(ite);
+ }
+ catch (ClassCastException cce)
+ {
+ NoSuchAlgorithmException nsae = new NoSuchAlgorithmException(protocol);
+ throw (NoSuchAlgorithmException) nsae.initCause(cce);
+ }
+ }
+
+ // Instance methods.
+ // -----------------------------------------------------------------
+
+ /**
+ * Returns the set of SSL contexts available for client connections.
+ *
+ * @return The set of SSL contexts available for client connections.
+ */
+ public final SSLSessionContext getClientSessionContext()
+ {
+ return ctxSpi.engineGetClientSessionContext();
+ }
+
+ /**
+ * Returns the protocol name of this context.
+ *
+ * @return The protocol name of this context.
+ */
+ public final String getProtocol()
+ {
+ return protocol;
+ }
+
+ /**
+ * Returns the provider of this implementation.
+ *
+ * @return The provider of this implementation.
+ */
+ public final Provider getProvider()
+ {
+ return provider;
+ }
+
+ /**
+ * Returns the set of SSL contexts available for server connections.
+ *
+ * @return The set of SSL contexts available for server connections.
+ */
+ public final SSLSessionContext getServerSessionContext()
+ {
+ return ctxSpi.engineGetServerSessionContext();
+ }
+
+ /**
+ * Returns the factory for server SSL sockets.
+ *
+ * @return The factory for server SSL sockets.
+ */
+ public final SSLServerSocketFactory getServerSocketFactory()
+ {
+ return ctxSpi.engineGetServerSocketFactory();
+ }
+
+ /**
+ * Returns the factory for client SSL sockets.
+ *
+ * @return The factory for client SSL sockets.
+ */
+ public final SSLSocketFactory getSocketFactory()
+ {
+ return ctxSpi.engineGetSocketFactory();
+ }
+
+ /**
+ * Initializes this context and prepares it for producing socket
+ * factories. All of the parameters are optional; default values are
+ * used if left unspecified.
+ *
+ * @param keyManagers The set of key managers to use.
+ * @param trustManagers The set of trust managers to use.
+ * @param random A source of random bits to use.
+ * @throws KeyManagementException If initialization fails.
+ */
+ public final void init(KeyManager[] keyManagers,
+ TrustManager[] trustManagers,
+ SecureRandom random)
+ throws KeyManagementException
+ {
+ ctxSpi.engineInit(keyManagers, trustManagers, random);
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/SSLContextSpi.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/SSLContextSpi.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/SSLContextSpi.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/SSLContextSpi.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,109 @@
+/* SSLContextSpi.java -- SPI for SSL contexts.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.net.ssl;
+
+import java.security.KeyManagementException;
+import java.security.SecureRandom;
+
+/**
+ * The <i>Service Provider Interface</i> (<b>SPI</b>) for SSLContext
+ * objects.
+ *
+ * @author Casey Marshall (rsdio at metastatic.org)
+ */
+public abstract class SSLContextSpi
+{
+
+ // Constructor.
+ // -------------------------------------------------------------------
+
+ /**
+ * Create a new SSLContextSpi.
+ */
+ public SSLContextSpi()
+ {
+ super();
+ }
+
+ // Abstract methods.
+ // -------------------------------------------------------------------
+
+ /**
+ * Returns the set of SSL sessions available for client connections.
+ *
+ * @return The set of SSL sessions available for client connections.
+ */
+ protected abstract SSLSessionContext engineGetClientSessionContext();
+
+ /**
+ * Returns the set of SSL sessions available for server connections.
+ *
+ * @return The set of SSL sessions available for server connections.
+ */
+ protected abstract SSLSessionContext engineGetServerSessionContext();
+
+ /**
+ * Returns the SSL server socket factory.
+ *
+ * @return The SSL server socket factory.
+ */
+ protected abstract SSLServerSocketFactory engineGetServerSocketFactory();
+
+ /**
+ * Returns the SSL client socket factory.
+ *
+ * @return The SSL client socket factory.
+ */
+ protected abstract SSLSocketFactory engineGetSocketFactory();
+
+ /**
+ * Initialize this context with key and trust managers, and a source
+ * of randomness. All of the parameters are optional.
+ *
+ * @param keyManagers The set of key managers.
+ * @param trustManagers The set of trust managers.
+ * @param random The source of randomness.
+ * @throws KeyManagementException If this context cannot be
+ * initialized with these parameters.
+ */
+ protected abstract void engineInit(KeyManager[] keyManagers,
+ TrustManager[] trustManagers,
+ SecureRandom random)
+ throws KeyManagementException;
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/SSLException.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/SSLException.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/SSLException.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/SSLException.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,91 @@
+/* SSLException.java -- generic SSL exception.
+ Copyright (C) 2004, 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.net.ssl;
+
+import java.io.IOException;
+
+/**
+ * The superclass of all possible SSL exceptions. Usually, a specific
+ * exception is thrown instead of this exception.
+ *
+ * @author Casey Marshall (rsdio at metastatic.org)
+ *
+ * @since 1.4
+ */
+public class SSLException extends IOException
+{
+ private static final long serialVersionUID = 4511006460650708967L;
+
+ // Constructor.
+ // ------------------------------------------------------------------
+
+ /**
+ * Create a new instance with a descriptive error message.
+ *
+ * @param message the descriptive error message
+ */
+ public SSLException(String message)
+ {
+ super(message);
+ }
+
+ /**
+ * Create a new instance with a descriptive error message and
+ * a cause.
+ * @param message the descriptive error message
+ * @param cause the cause
+ * @since 1.5
+ */
+ public SSLException(String message, Throwable cause)
+ {
+ super(message);
+ initCause(cause);
+ }
+
+ /**
+ * Create a new instance with a cause.
+ * @param cause the cause
+ * @since 1.5
+ */
+ public SSLException(Throwable cause)
+ {
+ super(cause == null ? null : cause.toString());
+ initCause(cause);
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/SSLHandshakeException.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/SSLHandshakeException.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/SSLHandshakeException.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/SSLHandshakeException.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,51 @@
+/* SSLHandshakeException.java -- exception in SSL handshake.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.net.ssl;
+
+/**
+ * An exception that signals an error in the SSL handshake phase.
+ */
+public class SSLHandshakeException extends SSLException
+{
+
+ public SSLHandshakeException(String message)
+ {
+ super(message);
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/SSLKeyException.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/SSLKeyException.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/SSLKeyException.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/SSLKeyException.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,52 @@
+/* SSLKeyException.java -- exception in using a key in SSL.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.net.ssl;
+
+/**
+ * An exception signaling a problem using a public or private key in
+ * an SSL communication.
+ */
+public class SSLKeyException extends SSLException
+{
+
+ public SSLKeyException(String message)
+ {
+ super(message);
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/SSLPeerUnverifiedException.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/SSLPeerUnverifiedException.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/SSLPeerUnverifiedException.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/SSLPeerUnverifiedException.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,51 @@
+/* SSLPeerUnverifiedException.java -- unverified peer exception.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.net.ssl;
+
+/**
+ * An exception thrown when the remote peer could not be verified.
+ */
+public class SSLPeerUnverifiedException extends SSLException
+{
+
+ public SSLPeerUnverifiedException(String message)
+ {
+ super(message);
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/SSLPermission.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/SSLPermission.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/SSLPermission.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/SSLPermission.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,66 @@
+/* SSLPermission.java -- SSL permission class.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.net.ssl;
+
+import java.security.BasicPermission;
+
+/**
+ * A permission used for accessing SSL classes.
+ */
+public final class SSLPermission extends BasicPermission
+{
+
+ // Constant.
+ // -------------------------------------------------------------------------
+
+ private static final long serialVersionUID = -3456898025505876775L;
+
+ // Constructors.
+ // -------------------------------------------------------------------------
+
+ public SSLPermission(String name)
+ {
+ super(name);
+ }
+
+ public SSLPermission(String name, String actions)
+ {
+ super(name, actions);
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/SSLProtocolException.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/SSLProtocolException.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/SSLProtocolException.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/SSLProtocolException.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,53 @@
+/* SSLProtocolException.java -- exception in SSL protocol.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.net.ssl;
+
+/**
+ * An exception thrown when a fatal protocol error is encountered. This
+ * exception usually indicates some serious problem with the local or
+ * remote SSL implementation.
+ */
+public class SSLProtocolException extends SSLException
+{
+
+ public SSLProtocolException(String message)
+ {
+ super(message);
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/SSLServerSocket.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/SSLServerSocket.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/SSLServerSocket.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/SSLServerSocket.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,188 @@
+/* SSLServerSocket.java -- a server socket for SSL connections.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.net.ssl;
+
+import java.io.IOException;
+
+import java.net.InetAddress;
+import java.net.ServerSocket;
+
+/**
+ * A server socket that allows clients to connect via the SSL protocol.
+ */
+public abstract class SSLServerSocket extends ServerSocket
+{
+
+ // Constructors.
+ // -------------------------------------------------------------------------
+
+ protected SSLServerSocket() throws IOException
+ {
+ super();
+ //super(0);
+ //throw new UnsupportedOperationException("1.4 socket methods not enabled");
+ }
+
+ protected SSLServerSocket(int port) throws IOException
+ {
+ super(port);
+ }
+
+ protected SSLServerSocket(int port, int backlog) throws IOException
+ {
+ super(port, backlog);
+ }
+
+ protected SSLServerSocket(int port, int backlog, InetAddress bindAddress)
+ throws IOException
+ {
+ super(port, backlog, bindAddress);
+ }
+
+ // Abstract methods.
+ // -------------------------------------------------------------------------
+
+ /**
+ * Returns the list of cihper suites that are currently enabled in this
+ * server socket. Sockets accepted by this server socket will only have
+ * these suites enabled.
+ *
+ * @return The enabled cipher suites.
+ */
+ public abstract String[] getEnabledCipherSuites();
+
+ /**
+ * Sets the list enabled cipher suites.
+ *
+ * @param suites The cipher suites to enable.
+ */
+ public abstract void setEnabledCipherSuites(String[] suites);
+
+ /**
+ * Returns the list of enabled protocols, such as "SSLv3" and "TLSv1".
+ *
+ * @return The enabled protocols.
+ */
+ public abstract String[] getEnabledProtocols();
+
+ /**
+ * Sets the list of enabled protocols.
+ *
+ * @param protocols The list of protocols to enable.
+ */
+ public abstract void setEnabledProtocols(String[] protocols);
+
+ /**
+ * Returns whether or not sessions will be created, i.e., whether or not
+ * this server socket will allow SSL session resumption.
+ *
+ * @return True if sessions will be created.
+ */
+ public abstract boolean getEnableSessionCreation();
+
+ /**
+ * Sets whether or not sessions will be created.
+ *
+ * @param enabled The new enabled value.
+ */
+ public abstract void setEnableSessionCreation(boolean enabled);
+
+ /**
+ * Returns whether or not this server socket will require clients to
+ * authenticate themselves, such as through a certificate.
+ *
+ * @return True if clients must authenticate themselves.
+ */
+ public abstract boolean getNeedClientAuth();
+
+ /**
+ * Enabled or disables the requirement that clients authenticate themselves.
+ * When this is set to <code>true</code>, connections will be rejected if
+ * connecting clients do not provide proper authentication.
+ *
+ * @param needAuth The new need auth value.
+ */
+ public abstract void setNeedClientAuth(boolean needAuth);
+
+ /**
+ * Returns whether or not sockets accepted by this server socket will do
+ * their handshake as the client-side. The default is false.
+ *
+ * @return True if client mode will be used.
+ */
+ public abstract boolean getUseClientMode();
+
+ /**
+ * Sets whether or not sockets accepted by this server socket will be
+ * created in client mode.
+ *
+ * @param clientMode The new client mode value.
+ */
+ public abstract void setUseClientMode(boolean clientMode);
+
+ /**
+ * Returns whether or not this socket will ask for, but not require, that
+ * connecting clients authenticate themselves. Clients that do not
+ * provide authentication they will still be allowed to connect.
+ *
+ * @return True if this server socket wants client authentication.
+ */
+ public abstract boolean getWantClientAuth();
+
+ /**
+ * Sets whether or not this server socket will want client authentication.
+ *
+ * @param wantAuth The new want auth value.
+ */
+ public abstract void setWantClientAuth(boolean wantAuth);
+
+ /**
+ * Returns a list of cipher suites that this server socket supports.
+ *
+ * @return The list of supported suites.
+ */
+ public abstract String[] getSupportedCipherSuites();
+
+ /**
+ * Returns a list of SSL protocols supported by this server socket.
+ *
+ * @return The list of supported protocols.
+ */
+ public abstract String[] getSupportedProtocols();
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/SSLServerSocketFactory.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/SSLServerSocketFactory.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/SSLServerSocketFactory.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/SSLServerSocketFactory.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,172 @@
+/* SSLServerSocketFactory.java -- factory for SSL server sockets.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.net.ssl;
+
+import java.security.KeyStore;
+import java.security.Security;
+
+import javax.net.ServerSocketFactory;
+
+/**
+ * A server socket factory for <i>Secure Socket Layer</i> (<b>SSL</b>)
+ * server sockets.
+ */
+public abstract class SSLServerSocketFactory extends ServerSocketFactory
+{
+ // Field.
+ // -------------------------------------------------------------------------
+
+ private static SSLContext context;
+
+ // Constructor.
+ // -------------------------------------------------------------------------
+
+ protected SSLServerSocketFactory()
+ {
+ super();
+ }
+
+ // Class methods.
+ // -------------------------------------------------------------------------
+
+ /**
+ * Returns a default implementation of a SSL server socket factory.
+ *
+ * <p>To control the class that gets returned by this method, set the
+ * security property "ssl.ServerSocketFactory.provider" to the class
+ * name of a concrete implementation of this class. If not set, a
+ * system-dependent implementation will be used.</p>
+ *
+ * <p>The implementation returned is created by the first implementation
+ * of the {@link SSLContext} class found, which is initialized with
+ * default parameters. To control the key and trust manager factory
+ * algorithms used as defaults, set the security properties
+ * "ssl.keyManagerFactory.algorithm" and "ssl.trustManagerFactory.algorithm"
+ * to the appropriate names.</p>
+ *
+ * <p>Using this method is not recommended. Instead, use the methods of
+ * {@link SSLContext}, which provide much better control over the
+ * creation of server socket factories.</p>
+ *
+ * @return The default server socket factory.
+ * @throws RuntimeException If no default can be created.
+ */
+ public static synchronized ServerSocketFactory getDefault()
+ {
+ try
+ {
+ String s = Security.getProperty("ssl.ServerSocketFactory.provider");
+ ClassLoader cl = ClassLoader.getSystemClassLoader();
+ if (s != null && cl != null)
+ {
+ return (ServerSocketFactory) cl.loadClass(s).newInstance();
+ }
+ }
+ catch (Exception e)
+ {
+ }
+ if (context == null)
+ {
+ KeyManager[] km = null;
+ TrustManager[] tm = null;
+
+ // 1. Determine which algorithms to use for the key and trust
+ // manager factories.
+ String kmAlg = KeyManagerFactory.getDefaultAlgorithm();
+ String tmAlg = TrustManagerFactory.getDefaultAlgorithm();
+ // 2. Try to initialize the factories with default parameters.
+ try
+ {
+ KeyManagerFactory kmf = KeyManagerFactory.getInstance(kmAlg);
+ kmf.init(null, null);
+ km = kmf.getKeyManagers();
+ }
+ catch (Exception ex)
+ {
+ }
+ try
+ {
+ TrustManagerFactory tmf = TrustManagerFactory.getInstance(tmAlg);
+ tmf.init((KeyStore) null);
+ tm = tmf.getTrustManagers();
+ }
+ catch (Exception ex)
+ {
+ }
+
+ // 3. Create and initialize a context.
+ try
+ {
+ context = SSLContext.getInstance("SSLv3");
+ context.init(km, tm, null);
+ }
+ catch (Exception ex)
+ {
+ throw new RuntimeException("error instantiating default server socket factory: "
+ + ex.toString());
+ }
+ }
+ try
+ {
+ return context.getServerSocketFactory();
+ }
+ catch (Exception e)
+ {
+ }
+ throw new RuntimeException("no SSLSocketFactory implementation available");
+ }
+
+ // Abstract methods.
+ // -------------------------------------------------------------------------
+
+ /**
+ * Returns the list of cipher suites that will be enabled in server sockets
+ * created by this factory.
+ *
+ * @return The default cipher suites.
+ */
+ public abstract String[] getDefaultCipherSuites();
+
+ /**
+ * Returns the list of all cipher suites supported by this factory.
+ *
+ * @return The list of supported cipher suites.
+ */
+ public abstract String[] getSupportedCipherSuites();
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/SSLSession.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/SSLSession.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/SSLSession.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/SSLSession.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,168 @@
+/* SSLSession.java -- an SSL session.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.net.ssl;
+
+import java.security.cert.Certificate;
+
+import javax.security.cert.X509Certificate;
+
+/**
+ * An SSL session is a mechanism through which connections can be established
+ * by re-using previously negotiated handshakes.
+ */
+public interface SSLSession
+{
+ /**
+ * Returns this session's cihper suite.
+ *
+ * @return The cipher suite.
+ */
+ String getCipherSuite();
+
+ /**
+ * Returns the time in milliseconds since midnight GMT, 1 January 1970, that
+ * this session was created.
+ *
+ * @return The creation time.
+ */
+ long getCreationTime();
+
+ /**
+ * Returns this session's unique identifier, a arbitrary byte array of up
+ * to 32 bytes.
+ *
+ * @return The session identifier.
+ */
+ byte[] getId();
+
+ /**
+ * Returns the last time this session was accessed.
+ *
+ * @return The lest time this session was accessed.
+ */
+ long getLastAccessedTime();
+
+ /**
+ * Returns the chain of certificates that the local side used in the
+ * handshake, or null if none were used.
+ *
+ * @return The local certificate chain.
+ */
+ Certificate[] getLocalCertificates();
+
+ /**
+ * Returns the chain of certificates that the remote side used in
+ * the handshake, or null if none were used.
+ *
+ * @return The peer's certificate chain.
+ * @throws SSLPeerUnverifiedException If the identity of the peer has
+ * not been verified.
+ */
+ Certificate[] getPeerCertificates() throws SSLPeerUnverifiedException;
+
+ /**
+ * Returns the chain of certificates that the remote side used in
+ * the handshake, or null if none were used.
+ *
+ * @return The peer's certificate chain.
+ * @throws SSLPeerUnverifiedException If the identity of the peer has
+ * not been verified.
+ */
+ X509Certificate[] getPeerCertificateChain()
+ throws SSLPeerUnverifiedException;
+
+ /**
+ * Returns the remote host's name.
+ *
+ * @return The name of the remote host.
+ */
+ String getPeerHost();
+
+ /**
+ * Returns the protocol this session uses.
+ *
+ * @return The protocol.
+ */
+ String getProtocol();
+
+ /**
+ * Returns this session's session context object.
+ *
+ * @return The session context.
+ * @throws SecurityException If the caller does not have the
+ * {@link SSLPermission} "getSessionContext".
+ */
+ SSLSessionContext getSessionContext();
+
+ /**
+ * Returns the names of all values bound to this session.
+ *
+ * @return The list of bound names.
+ */
+ String[] getValueNames();
+
+ /**
+ * Returns the object bound to the given name.
+ *
+ * @param name The name of the value to get.
+ * @return The object bound by that name, or null.
+ */
+ Object getValue(String name);
+
+ /**
+ * Invalidates this session, ensuring that it will not be continued by
+ * another socket.
+ */
+ void invalidate();
+
+ /**
+ * Binds a value to this session, with the given name.
+ *
+ * @param name The name to bind the object with.
+ * @param value The value to bind.
+ */
+ void putValue(String name, Object value);
+
+ /**
+ * Un-binds a value.
+ *
+ * @param name The name of the value to un-bind.
+ */
+ void removeValue(String name);
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/SSLSessionBindingEvent.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/SSLSessionBindingEvent.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/SSLSessionBindingEvent.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/SSLSessionBindingEvent.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,94 @@
+/* SSLSessionBindingEvent.java -- SSL binding event.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.net.ssl;
+
+import java.util.EventObject;
+
+/**
+ * An event raised by {@link SSLSession} objects when objects are bound to
+ * them.
+ */
+public class SSLSessionBindingEvent extends EventObject
+{
+
+ // Fields.
+ // -------------------------------------------------------------------
+
+ private static final long serialVersionUID = 3989172637106345L;
+
+ private final String name;
+
+ // Constructor.
+ // -------------------------------------------------------------------
+
+ /**
+ * Creates a new binding event.
+ *
+ * @param session The session being bound to.
+ * @param name The name the object was bound under.
+ */
+ public SSLSessionBindingEvent(SSLSession session, String name)
+ {
+ super(session);
+ this.name = name;
+ }
+
+ // Instance methods.
+ // --------------------------------------------------------------------
+
+ /**
+ * Returns the name the object was bound under.
+ *
+ * @return The name.
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+ /**
+ * Returns the session that the object was bound to.
+ *
+ * @return The session.
+ */
+ public SSLSession getSession()
+ {
+ return (SSLSession) getSource();
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/SSLSessionBindingListener.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/SSLSessionBindingListener.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/SSLSessionBindingListener.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/SSLSessionBindingListener.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,65 @@
+/* SSLSessionBindingListener.java -- listener for SSL bindings.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.net.ssl;
+
+import java.util.EventListener;
+
+/**
+ * An event listener interface that should be notified when it is bound or
+ * unbound to a {@link SSLSession}.
+ */
+public interface SSLSessionBindingListener extends EventListener
+{
+
+ /**
+ * This method is called of all objects when they are bound to an SSL
+ * session.
+ *
+ * @param event The binding event.
+ */
+ void valueBound(SSLSessionBindingEvent event);
+
+ /**
+ * This method is called of all objects when they are unbound to an SSL
+ * session.
+ *
+ * @param event The binding event.
+ */
+ void valueUnbound(SSLSessionBindingEvent event);
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/SSLSessionContext.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/SSLSessionContext.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/SSLSessionContext.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/SSLSessionContext.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,103 @@
+/* SSLSessionContext.java -- collection of SSL sessions.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.net.ssl;
+
+import java.util.Enumeration;
+
+/**
+ * A collection of saved SSL sessions, with thier corresponding session
+ * IDs.
+ *
+ * @author Casey Marshall (rsdio at metastatic.org)
+ */
+public interface SSLSessionContext
+{
+
+ /**
+ * Returns an enumeration of all saved session IDs. Every element in
+ * the returned enumeration is a byte array.
+ *
+ * @return The session IDs.
+ */
+ Enumeration getIds();
+
+ /**
+ * Gets the session specified by its ID, or <code>null</code> if there
+ * is no session, or if it has expired.
+ *
+ * @param sessionId The ID of the session to get.
+ * @return The session, or <code>null</code>.
+ */
+ SSLSession getSession(byte[] sessionId);
+
+ /**
+ * Returns the maximum number of sessions that may be cached by this
+ * session context.
+ *
+ * @return The maximum number of sessions that may be cached.
+ */
+ int getSessionCacheSize();
+
+ /**
+ * Returns the period of time (in seconds) that a session may be cached
+ * for before becoming invalid.
+ *
+ * @return The time a session may be valid.
+ */
+ int getSessionTimeout();
+
+ /**
+ * Sets the maximum number of sessions that may be cached by this
+ * session context. A cache size of 0 means no limit.
+ *
+ * @param size The new cache size.
+ * @throws IllegalArgumentException If <code>size</code> is negative.
+ */
+ void setSessionCacheSize(int size);
+
+ /**
+ * Sets the period of time (in seconds) that a session may be cached
+ * for before becoming invalid. A timeout of 0 means that sessions
+ * never expire.
+ *
+ * @param seconds The new timeout.
+ * @throws IllegalArgumentException If <code>seconds</code> is negative.
+ */
+ void setSessionTimeout(int seconds);
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/SSLSocket.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/SSLSocket.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/SSLSocket.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/SSLSocket.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,229 @@
+/* SSLSocket.java -- an SSL client socket.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.net.ssl;
+
+import java.io.IOException;
+import java.net.InetAddress;
+import java.net.Socket;
+import java.net.UnknownHostException;
+
+/**
+ * A socket that communicates over the secure socket layer protocol.
+ */
+public abstract class SSLSocket extends Socket
+{
+
+ // Constructors.
+ // -------------------------------------------------------------------------
+
+ protected SSLSocket()
+ {
+ super();
+ }
+
+ protected SSLSocket(String host, int port)
+ throws IOException, UnknownHostException
+ {
+ super(host, port);
+ }
+
+ protected SSLSocket(InetAddress address, int port) throws IOException
+ {
+ super(address, port);
+ }
+
+ protected SSLSocket(String host, int port,
+ InetAddress localAddr, int localPort)
+ throws IOException, UnknownHostException
+ {
+ super(host, port, localAddr, localPort);
+ }
+
+ protected SSLSocket(InetAddress address, int port,
+ InetAddress localAddr, int localPort)
+ throws IOException
+ {
+ super(address, port, localAddr, localPort);
+ }
+
+ // Abstract methods.
+ // -------------------------------------------------------------------------
+
+ /**
+ * Adds a handshake completed listener that wants to be notified when the
+ * SSL handshake completes.
+ *
+ * @param listener The listener to add.
+ */
+ public abstract void
+ addHandshakeCompletedListener(HandshakeCompletedListener listener);
+
+ /**
+ * Removes a handshake listener from this socket.
+ *
+ * @param listener The listener to remove.
+ */
+ public abstract void
+ removeHandshakeCompletedListener(HandshakeCompletedListener listener);
+
+ /**
+ * Returns the list of currently enabled cipher suites.
+ *
+ * @return The list of enabled cipher suites.
+ */
+ public abstract String[] getEnabledCipherSuites();
+
+ /**
+ * Sets the list of enabled cipher suites.
+ *
+ * @param suites The list of suites to enable.
+ */
+ public abstract void setEnabledCipherSuites(String[] suites);
+
+ /**
+ * Returns the list of enabled SSL protocols.
+ *
+ * @return The list of enabled protocols.
+ */
+ public abstract String[] getEnabledProtocols();
+
+ /**
+ * Sets the list of enabled SSL protocols.
+ *
+ * @param protocols The list of protocols to enable.
+ */
+ public abstract void setEnabledProtocols(String[] protocols);
+
+ /**
+ * Returns whether or not sessions will be created by this socket, and thus
+ * allow sessions to be continued later.
+ *
+ * @return Whether or not sessions will be created.
+ */
+ public abstract boolean getEnableSessionCreation();
+
+ /**
+ * Sets whether or not sessions will be created by this socket.
+ *
+ * @param enable The new value.
+ */
+ public abstract void setEnableSessionCreation(boolean enable);
+
+ /**
+ * Returns whether or not this socket will require connecting clients to
+ * authenticate themselves. This value only applies to sockets in server
+ * mode.
+ *
+ * @return Whether or not this socket requires client authentication.
+ */
+ public abstract boolean getNeedClientAuth();
+
+ /**
+ * Sets whether or not this socket will require connecting clients to
+ * authenticate themselves. This value only applies to sockets in server
+ * mode.
+ *
+ * @param needAuth The new need auth value.
+ */
+ public abstract void setNeedClientAuth(boolean needAuth);
+
+ /**
+ * Returns this socket's session object.
+ *
+ * @return The session.
+ */
+ public abstract SSLSession getSession();
+
+ /**
+ * Returns the list of cipher suites supported by this socket.
+ *
+ * @return The list of supported cipher suites.
+ */
+ public abstract String[] getSupportedCipherSuites();
+
+ /**
+ * Returns the list of protocols supported by this socket.
+ *
+ * @return The list of supported protocols.
+ */
+ public abstract String[] getSupportedProtocols();
+
+ /**
+ * Returns whether or not this socket will connect in client mode.
+ *
+ * @return True if this is a client socket.
+ */
+ public abstract boolean getUseClientMode();
+
+ /**
+ * Sets whether or not this socket will connect in client mode.
+ *
+ * @param clientMode The new value.
+ */
+ public abstract void setUseClientMode(boolean clientMode);
+
+ /**
+ * Returns whether or not this socket will request that connecting clients
+ * authenticate themselves. This value only applies to sockets in server
+ * mode.
+ *
+ * @return The want client auth value.
+ */
+ public abstract boolean getWantClientAuth();
+
+ /**
+ * Sets whether or not this socket will request that connecting clients
+ * authenticate themselves. This value only applies to sockets in server
+ * mode.
+ *
+ * @param wantAuth The new want auth value.
+ */
+ public abstract void setWantClientAuth(boolean wantAuth);
+
+ /**
+ * Explicitly begins the handshake, or, if the handshake has already
+ * completed, requests that the handshake be repeated.
+ *
+ * <p>The handshake will begin implicitly when any attempt to read or
+ * write to the socket is made.</p>
+ *
+ * @throws IOException If an I/O or SSL error occurs.
+ */
+ public abstract void startHandshake() throws IOException;
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/SSLSocketFactory.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/SSLSocketFactory.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/SSLSocketFactory.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/SSLSocketFactory.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,190 @@
+/* SSLSocketFactory.java -- factory for SSL client sockets.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.net.ssl;
+
+import java.io.IOException;
+import java.net.Socket;
+import java.security.KeyStore;
+import java.security.Security;
+
+import javax.net.SocketFactory;
+
+/**
+ * A socket factory for creating <i>Secure Socket Layer</i> (<b>SSL</b>)
+ * sockets.
+ */
+public abstract class SSLSocketFactory extends SocketFactory
+{
+ // Constants.
+ // -------------------------------------------------------------------------
+
+ private static SSLContext context;
+
+ // Constructor.
+ // -------------------------------------------------------------------------
+
+ public SSLSocketFactory()
+ {
+ super();
+ }
+
+ // Class methods.
+ // -------------------------------------------------------------------------
+
+ /**
+ * Returns a default implementation of a SSL socket factory.
+ *
+ * <p>To control the class that gets returned by this method, set the
+ * security property "ssl.SocketFactory.provider" to the class
+ * name of a concrete implementation of this class. If not set, a
+ * system-dependent implementation will be used.</p>
+ *
+ * <p>The implementation returned is created by the first implementation
+ * of the {@link SSLContext} class found, which is initialized with
+ * default parameters. To control the key and trust manager factory
+ * algorithms used as defaults, set the security properties
+ * "ssl.keyManagerFactory.algorithm" and "ssl.trustManagerFactory.algorithm"
+ * to the appropriate names.</p>
+ *
+ * <p>Using this method is not recommended. Instead, use the methods of
+ * {@link SSLContext}, which provide much better control over the
+ * creation of socket factories.</p>
+ *
+ * @return The default socket factory.
+ * @throws RuntimeException If no default can be created.
+ */
+ public static synchronized SocketFactory getDefault()
+ {
+ try
+ {
+ String s = Security.getProperty("ssl.SocketFactory.provider");
+ ClassLoader cl = ClassLoader.getSystemClassLoader();
+ if (s != null && cl != null)
+ {
+ return (SocketFactory) cl.loadClass(s).newInstance();
+ }
+ }
+ catch (Exception e)
+ {
+ }
+ if (context == null)
+ {
+ KeyManager[] km = null;
+ TrustManager[] tm = null;
+
+ // 1. Determine which algorithms to use for the key and trust
+ // manager factories.
+ String kmAlg = KeyManagerFactory.getDefaultAlgorithm();
+ String tmAlg = TrustManagerFactory.getDefaultAlgorithm();
+
+ // 2. Try to initialize the factories with default parameters.
+ try
+ {
+ KeyManagerFactory kmf = KeyManagerFactory.getInstance(kmAlg);
+ kmf.init(null, null);
+ km = kmf.getKeyManagers();
+ }
+ catch (Exception ex)
+ {
+ }
+ try
+ {
+ TrustManagerFactory tmf = TrustManagerFactory.getInstance(tmAlg);
+ tmf.init((KeyStore) null);
+ tm = tmf.getTrustManagers();
+ }
+ catch (Exception ex)
+ {
+ }
+
+ // 3. Create and initialize a context.
+ try
+ {
+ context = SSLContext.getInstance("SSLv3");
+ context.init(km, tm, null);
+ }
+ catch (Exception ex)
+ {
+ throw new RuntimeException("error instantiating default socket factory: "
+ + ex.toString());
+ }
+ }
+ try
+ {
+ return context.getSocketFactory();
+ }
+ catch (Exception e)
+ {
+ }
+ throw new RuntimeException("no SSLSocketFactory implementation available");
+ }
+
+ // Abstract methods.
+ // -------------------------------------------------------------------------
+
+ /**
+ * Creates a SSL socket wrapped around an existing socket.
+ *
+ * @param socket The socket to wrap.
+ * @param host The host the socket is connected to.
+ * @param port The port the socket is connected to.
+ * @param autoClose Whether or not the wrapped socket should be closed
+ * automatically.
+ * @return The new SSL socket.
+ * @throws IOException If the socket could not be created.
+ */
+ public abstract Socket createSocket(Socket socket, String host,
+ int port, boolean autoClose)
+ throws IOException;
+
+ /**
+ * Returns the list of cipher suites that will be enabled in sockets
+ * created by this factory.
+ *
+ * @return The default cipher suites.
+ */
+ public abstract String[] getDefaultCipherSuites();
+
+ /**
+ * Returns the list of all cipher suites supported by this factory.
+ *
+ * @return The list of supported cipher suites.
+ */
+ public abstract String[] getSupportedCipherSuites();
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/TrivialHostnameVerifier.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/TrivialHostnameVerifier.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/TrivialHostnameVerifier.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/TrivialHostnameVerifier.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,51 @@
+/* TrivialHostnameVerifier.java -- non-verifing verifier.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.net.ssl;
+
+/**
+ * A hostname verifier that always rejects mismatched hostnames.
+ */
+class TrivialHostnameVerifier implements HostnameVerifier
+{
+
+ public boolean verify(String hostname, SSLSession session)
+ {
+ return false;
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/TrustManager.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/TrustManager.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/TrustManager.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/TrustManager.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,47 @@
+/* TrustManager.java -- marker interface for trust managers.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.net.ssl;
+
+/**
+ * A marker interface for classes that establish the trust of remote
+ * hosts.
+ */
+public interface TrustManager
+{
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/TrustManagerFactory.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/TrustManagerFactory.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/TrustManagerFactory.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/TrustManagerFactory.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,278 @@
+/* TrustManagerFactory.java -- factory for trust managers.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.net.ssl;
+
+import gnu.java.security.Engine;
+
+import java.lang.reflect.InvocationTargetException;
+import java.security.AccessController;
+import java.security.InvalidAlgorithmParameterException;
+import java.security.KeyStore;
+import java.security.KeyStoreException;
+import java.security.NoSuchAlgorithmException;
+import java.security.NoSuchProviderException;
+import java.security.PrivilegedAction;
+import java.security.Provider;
+import java.security.Security;
+
+/**
+ * A factory for creating trust manager objects.
+ */
+public class TrustManagerFactory
+{
+
+ // Constants and fields.
+ // -------------------------------------------------------------------------
+
+ /** The service name for trust manager factories. */
+ private static final String TRUST_MANAGER_FACTORY = "TrustManagerFactory";
+
+ /** The system default trust manager algorithm. */
+ private static final String DEFAULT_ALGORITHM = "JessieX509";
+
+ /** The underlying engine class. */
+ private final TrustManagerFactorySpi tmfSpi;
+
+ /** The provider of the engine class. */
+ private final Provider provider;
+
+ /** The name of this trust manager algorithm. */
+ private final String algorithm;
+
+ // Constructor.
+ // -------------------------------------------------------------------------
+
+ /**
+ * Creates a new trust manager factory.
+ *
+ * @param tmfSpi The underlying engine class.
+ * @param provider The provider of the engine class.
+ * @param algorithm The trust manager algorithm name.
+ */
+ protected TrustManagerFactory(TrustManagerFactorySpi tmfSpi,
+ Provider provider, String algorithm)
+ {
+ this.tmfSpi = tmfSpi;
+ this.provider = provider;
+ this.algorithm = algorithm;
+ }
+
+ // Class methods.
+ // -------------------------------------------------------------------------
+
+ /**
+ * Returns an instance of a trust manager factory for the given algorithm
+ * from the first provider that implements it.
+ *
+ * @param algorithm The name of the algorithm to get.
+ * @return The instance of the trust manager factory.
+ * @throws NoSuchAlgorithmException If no provider implements the given
+ * algorithm.
+ */
+ public static final TrustManagerFactory getInstance(String algorithm)
+ throws NoSuchAlgorithmException
+ {
+ Provider[] provs = Security.getProviders();
+ for (int i = 0; i < provs.length; i++)
+ {
+ try
+ {
+ return getInstance(algorithm, provs[i]);
+ }
+ catch (NoSuchAlgorithmException ignore)
+ {
+ }
+ }
+ throw new NoSuchAlgorithmException(algorithm);
+ }
+
+ /**
+ * Returns an instance of a trust manager factory for the given algorithm
+ * from the named provider.
+ *
+ * @param algorithm The name of the algorithm to get.
+ * @param provider The name of the provider to get the instance from.
+ * @return The instance of the trust manager factory.
+ * @throws NoSuchAlgorithmException If the provider does not implement the
+ * given algorithm.
+ * @throws NoSuchProviderException If there is no such named provider.
+ * @throws IllegalArgumentException If the provider argument is null.
+ */
+ public static final TrustManagerFactory getInstance(String algorithm,
+ String provider)
+ throws NoSuchAlgorithmException, NoSuchProviderException
+ {
+ if (provider == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ Provider p = Security.getProvider(provider);
+ if (p == null)
+ {
+ throw new NoSuchProviderException(provider);
+ }
+ return getInstance(algorithm, p);
+ }
+
+ /**
+ * Returns an instance of a trust manager factory for the given algorithm
+ * from the specified provider.
+ *
+ * @param algorithm The name of the algorithm to get.
+ * @param provider The provider to get the instance from.
+ * @return The instance of the trust manager factory.
+ * @throws NoSuchAlgorithmException If the provider does not implement the
+ * given algorithm.
+ * @throws IllegalArgumentException If the provider argument is null.
+ */
+ public static final TrustManagerFactory getInstance(String algorithm,
+ Provider provider)
+ throws NoSuchAlgorithmException
+ {
+ if (provider == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ try
+ {
+ return new TrustManagerFactory((TrustManagerFactorySpi)
+ Engine.getInstance(TRUST_MANAGER_FACTORY, algorithm, provider),
+ provider, algorithm);
+ }
+ catch (InvocationTargetException ite)
+ {
+ throw new NoSuchAlgorithmException(algorithm);
+ }
+ catch (ClassCastException cce)
+ {
+ throw new NoSuchAlgorithmException(algorithm);
+ }
+ }
+
+ /**
+ * Returns the default algorithm for trust manager factories. The value
+ * returned is either the value of the security property
+ * "ssl.TrustManagerFactory.algorithm" if it is set, or the value "JessieX509"
+ * if not.
+ *
+ * @return The default algorithm name.
+ * @see Security.getProperty(java.lang.String)
+ */
+ public static final String getDefaultAlgorithm()
+ {
+ String alg = null;
+ try
+ {
+ alg = (String) AccessController.doPrivileged(
+ new PrivilegedAction()
+ {
+ public Object run()
+ {
+ return Security.getProperty("ssl.TrustManagerFactory.algorithm");
+ }
+ }
+ );
+ }
+ catch (SecurityException se)
+ {
+ }
+ if (alg == null)
+ alg = DEFAULT_ALGORITHM;
+ return alg;
+ }
+
+ // Instance methods.
+ // -------------------------------------------------------------------------
+
+ /**
+ * Returns the name of this trust manager algorithm.
+ *
+ * @return The algorithm name.
+ */
+ public final String getAlgorithm()
+ {
+ return algorithm;
+ }
+
+ /**
+ * Returns the provider of the underlying implementation.
+ *
+ * @return The provider.
+ */
+ public final Provider getProvider()
+ {
+ return provider;
+ }
+
+ /**
+ * Returns the trust managers created by this factory.
+ *
+ * @return The trust managers.
+ */
+ public final TrustManager[] getTrustManagers()
+ {
+ return tmfSpi.engineGetTrustManagers();
+ }
+
+ /**
+ * Initialize this instance with some algorithm-specific parameters.
+ *
+ * @param params The parameters.
+ * @throws InvalidAlgorithmParameterException If the supplied parameters
+ * are inappropriate for this instance.
+ */
+ public final void init(ManagerFactoryParameters params)
+ throws InvalidAlgorithmParameterException
+ {
+ tmfSpi.engineInit(params);
+ }
+
+ /**
+ * Initialize this instance with a key store. The key store may be null,
+ * in which case a default will be used.
+ *
+ * @param store The key store.
+ * @throws KeyStoreException If there is a problem reading from the
+ * key store.
+ */
+ public final void init(KeyStore store) throws KeyStoreException
+ {
+ tmfSpi.engineInit(store);
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/TrustManagerFactorySpi.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/TrustManagerFactorySpi.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/TrustManagerFactorySpi.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/TrustManagerFactorySpi.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,88 @@
+/* TrustManagerFactorySpi.java -- SPI for trust manager factories.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.net.ssl;
+
+import java.security.InvalidAlgorithmParameterException;
+import java.security.KeyStore;
+import java.security.KeyStoreException;
+
+/**
+ * The <i>service provider interface</i> (<b>SPI</b>) for trust managers.
+ */
+public abstract class TrustManagerFactorySpi
+{
+
+ // Constructor.
+ // -------------------------------------------------------------------------
+
+ public TrustManagerFactorySpi()
+ {
+ super();
+ }
+
+ // Abstract methods.
+ // -------------------------------------------------------------------------
+
+ /**
+ * Engine method that returns the trust managers created by this factory.
+ *
+ * @return The trust managers.
+ */
+ protected abstract TrustManager[] engineGetTrustManagers();
+
+ /**
+ * Engine method that initializes this factory with some algorithm-specific
+ * parameters.
+ *
+ * @param params The parameters.
+ * @throws InvalidAlgorithmParameterException If the given parameters are
+ * inappropriate.
+ */
+ protected abstract void engineInit(ManagerFactoryParameters params)
+ throws InvalidAlgorithmParameterException;
+
+ /**
+ * Engine method that initializes this factory with a key store. The key
+ * store parameter may be null, in which case some default should be used.
+ *
+ * @param store The key store.
+ * @throws KeyStoreException If a problem occurs reading from the key store.
+ */
+ protected abstract void engineInit(KeyStore store) throws KeyStoreException;
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/X509KeyManager.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/X509KeyManager.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/X509KeyManager.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/X509KeyManager.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,108 @@
+/* X509KeyManager.java -- X.509 key manager interface.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.net.ssl;
+
+import java.net.Socket;
+
+import java.security.Principal;
+import java.security.PrivateKey;
+import java.security.cert.X509Certificate;
+
+/**
+ * A key manager for X.509 certificates and their associated private keys.
+ */
+public interface X509KeyManager extends KeyManager
+{
+
+ /**
+ * Choose an alias for client-side authentication.
+ *
+ * @param keyTypes A list of acceptable key types.
+ * @param issuers A list of acceptable certificate issuers.
+ * @param socket The connecting socket.
+ * @return The chosen alias.
+ */
+ String chooseClientAlias(String[] keyTypes, Principal[] issuers,
+ Socket socket);
+
+ /**
+ * Choose an alias for server-side authentication.
+ *
+ * @param keyType The desired certificate type.
+ * @param issuers A list of acceptable certificate issuers.
+ * @param socket The connecting socket.
+ * @return The chosen alias.
+ */
+ String chooseServerAlias(String keyType, Principal[] issuers,
+ Socket socket);
+
+ /**
+ * Gets the X.509 certificate chain associated with the given alias.
+ *
+ * @param alias The alias.
+ * @return The certificate chain.
+ */
+ X509Certificate[] getCertificateChain(String alias);
+
+ /**
+ * Returns all client aliases that support the given key type.
+ *
+ * @param keyType The desired key type.
+ * @param issuers A list of acceptable certificate issuers.
+ * @return The (possibly empty) list of aliases.
+ */
+ String[] getClientAliases(String keyType, Principal[] issuers);
+
+ /**
+ * Gets the private key associated with the given alias.
+ *
+ * @param alias The alias.
+ * @return The private key.
+ */
+ PrivateKey getPrivateKey(String alias);
+
+ /**
+ * Returns all server aliases that support the given key type.
+ *
+ * @param keyType The desired key type.
+ * @param issuers A list of acceptable certificate issuers.
+ * @return The (possibly empty) list of aliases.
+ */
+ String[] getServerAliases(String keyType, Principal[] issuers);
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/X509TrustManager.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/X509TrustManager.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/X509TrustManager.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/X509TrustManager.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,76 @@
+/* X509TrustManager.java -- X.509 trust manager interface.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.net.ssl;
+
+import java.security.cert.CertificateException;
+import java.security.cert.X509Certificate;
+
+/**
+ * A trust manager for dealing with X.509 certificates.
+ */
+public interface X509TrustManager extends TrustManager
+{
+
+ /**
+ * Checks if a certificate chain sent by the client is trusted.
+ *
+ * @param chain The certificate chain to check.
+ * @param authType The authentication type.
+ * @throws CertificateException If the client's certificates are not trusted.
+ */
+ void checkClientTrusted(X509Certificate[] chain, String authType)
+ throws CertificateException;
+
+ /**
+ * Checks if a certificate chain sent by the server is trusted.
+ *
+ * @param chain The certificate chain to check.
+ * @param authType The authentication type.
+ * @throws CertificateException If the server's certificates are not trusted.
+ */
+ void checkServerTrusted(X509Certificate[] chain, String authType)
+ throws CertificateException;
+
+ /**
+ * Returns the list of trusted issuer certificates currently in use.
+ *
+ * @return The list of trusted issuer certificates.
+ */
+ X509Certificate[] getAcceptedIssuers();
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/package.html
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/package.html?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/package.html (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/net/ssl/package.html Thu Nov 8 16:56:19 2007
@@ -0,0 +1,46 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<!-- package.html - describes classes in javax.net.ssl package.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. -->
+
+<html>
+<head><title>GNU Classpath - javax.net.ssl</title></head>
+
+<body>
+<p></p>
+
+</body>
+</html>
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/print/AttributeException.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/print/AttributeException.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/print/AttributeException.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/print/AttributeException.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,76 @@
+/* AttributeException.java --
+ Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.print;
+
+import javax.print.attribute.Attribute;
+
+/**
+ * <code>AttributeException</code> specifies two methods a specific
+ * subclass of {@link javax.print.PrintException} may implement to
+ * provide further information of printing errors if unsupported
+ * attribute classes or values of attributes are involved.
+ * <p>
+ * There exists no <code>PrintException</code> class implementing this
+ * interface. Providing these extensions in <code>PrintException</code>
+ * subclasses is left to the concrete print service implementation.
+ * </p>
+ *
+ * @author Michael Koch (konqueror at gmx.de)
+ */
+public interface AttributeException
+{
+ /**
+ * Returns the unsupported printing attribute classes for a print service
+ * that does not support the attribute category at all. The returned
+ * class instances are sublcasses of the base interface {@link Attribute}.
+ *
+ * @return The unsupported attribute classes, or <code>null</code> if there
+ * are no such attribute classes.
+ */
+ Class[] getUnsupportedAttributes();
+
+ /**
+ * Returns the unsupported attribute values of printing attributes a specific
+ * print service does support but not the particular provided value.
+ *
+ * @return The unsupported attribute values, or <code>null</code> if there
+ * are no such attributes values.
+ */
+ Attribute[] getUnsupportedValues();
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/print/CancelablePrintJob.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/print/CancelablePrintJob.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/print/CancelablePrintJob.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/print/CancelablePrintJob.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,67 @@
+/* CancelablePrintJob.java --
+ Copyright (C) 2004, 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.print;
+
+/**
+ * <code>CancelablePrintJob</code> represents a print job which can be
+ * canceled.
+ * <p>
+ * It is implemented by <code>DocPrintJob</code>s which support to cancel
+ * a print job during processing. Clients need to explicitly test if a given
+ * <code>DocPrintJob</code> object from a print service implementes this
+ * interface and therefore supports cancelling.
+ * </p><p>
+ * Implementor of java print services should implement this interface if
+ * cancelling is supported by the underlying print system. If implemented the
+ * corresponding print job event
+ * {@link javax.print.event.PrintJobEvent#JOB_CANCELED} should be delivered to
+ * registered clients. Implementations have to be thread-safe.
+ * </p>
+ *
+ * @author Michael Koch (konqueror at gmx.de)
+ */
+public interface CancelablePrintJob extends DocPrintJob
+{
+ /**
+ * Cancel the print job.
+ *
+ * @exception PrintException if an error during cancellation occurs.
+ */
+ void cancel() throws PrintException;
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/print/Doc.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/print/Doc.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/print/Doc.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/print/Doc.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,146 @@
+/* Doc.java --
+ Copyright (C) 2004, 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.print;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.Reader;
+
+import javax.print.attribute.DocAttributeSet;
+
+/**
+ * <code>Doc</code> specifies the interface for print services how to obtain
+ * the print data and document specific attributes for printing.
+ * <p>
+ * The print data is always passed to a {@link javax.print.DocPrintJob} object
+ * as a <code>Doc</code> object which allows the print services to:
+ * <ul>
+ * <li>Determine the actual document format of the supplied print data. This
+ * is supplied as a {@link javax.print.DocFlavor} object with the MIME type
+ * and the representation class of the print data.</li>
+ * <li>Obtain the print data either in its representation class or depending
+ * on the document format through convenience methods as a
+ * {@link java.io.Reader} or an {@link java.io.InputStream}.</li>
+ * <li>Obtain the document's attribute set specifying the attributes which
+ * apply to this document instance.</li>
+ * </ul>
+ * </p><p>
+ * Every method of a <code>Doc</code> implementation has to return always the
+ * same object on every method call. Therefore if the print job consumes the
+ * print data via a stream or a reader object it can read only once the
+ * supplied print data. Implementations of this interface have to be thread
+ * safe.
+ * </p>
+ *
+ * @author Michael Koch (konqueror at gmx.de)
+ */
+public interface Doc
+{
+ /**
+ * Returns the unmodifiable view of the attributes of this doc object.
+ * <p>
+ * The attributes of this doc's attributes set overrides attributes of
+ * the same category in the print job's attribute set. If an attribute
+ * is not available in this doc's attributes set or <code>null</code>
+ * is returned the attributes of the same category of the print job are
+ * used.
+ * </p>
+ *
+ * @return The unmodifiable attributes set, or <code>null</code>.
+ */
+ DocAttributeSet getAttributes();
+
+ /**
+ * Returns the flavor of this doc objects print data.
+ *
+ * @return The document flavor.
+ */
+ DocFlavor getDocFlavor();
+
+ /**
+ * Returns the print data of this doc object.
+ * <p>
+ * The returned object is an instance as described by the associated
+ * document flavor ({@link DocFlavor#getRepresentationClassName()})
+ * and can be cast to this representation class.
+ * </p>
+ *
+ * @return The print data in the representation class.
+ * @throws IOException if representation class is a stream and I/O
+ * exception occures.
+ */
+ Object getPrintData() throws IOException;
+
+ /**
+ * Returns a <code>Reader</code> object for extracting character print data
+ * from this document.
+ * <p>
+ * This method is supported if the document flavor is of type:
+ * <ul>
+ * <li><code>char[]</code></li>
+ * <li><code>java.lang.String</code></li>
+ * <li><code>java.io.Reader</code></li>
+ * </ul>
+ * otherwise this method returns <code>null</code>.
+ * </p>
+ *
+ * @return The <code>Reader</code> object, or <code>null</code>.
+ *
+ * @throws IOException if an error occurs.
+ */
+ Reader getReaderForText() throws IOException;
+
+ /**
+ * Returns an <code>InputStream</code> object for extracting byte print data
+ * from this document.
+ * <p>
+ * This method is supported if the document flavor is of type:
+ * <ul>
+ * <li><code>byte[]</code></li>
+ * <li><code>java.io.InputStream</code></li>
+ * </ul>
+ * otherwise this method returns <code>null</code>.
+ * </p>
+ *
+ * @return The <code>InputStream</code> object, or <code>null</code>.
+ *
+ * @throws IOException if an error occurs.
+ */
+ InputStream getStreamForBytes() throws IOException;
+}
\ No newline at end of file
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/print/DocFlavor.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/print/DocFlavor.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/print/DocFlavor.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/print/DocFlavor.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,915 @@
+/* DocFlavor.java --
+ Copyright (C) 2004, 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.print;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.Serializable;
+import java.io.StreamTokenizer;
+import java.io.StringReader;
+import java.nio.charset.Charset;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.TreeMap;
+
+/**
+ * <code>DocFlavor</code> provides a description of the format in which the
+ * print data will be supplied in a print job to the print service.
+ * <p>
+ * A doc flavor consists of two parts:
+ * <ul>
+ * <li>
+ * The MIME type (Multipurpose Internet Mail Extensions types as described
+ * in RFC 2045/2046) specifying the media format of the print data.
+ * </li><li>
+ * The representation class name which is the fully qualified name of the
+ * class providing the print data to the print job. For example if the print
+ * data is supplied as a byte array the representation class name will be
+ * <code>"[B"</code> or for an input stream <code>"java.io.InputStream"</code>.
+ * </li>
+ * </ul>
+ * The <code>DocFlavor</code> class is therefore used in several places in the
+ * Java Print Service API. A print service provides its supported document
+ * flavors as an array of DocFlavor objects and a print job gets the flavor of
+ * its data to print from the <code>Doc</code> object provided as a DocFlavor
+ * instance.
+ * </p>
+ * <p>
+ * It has to be differentiated between <b>client formatted</b> and <b>service
+ * formatted</b> print data. Client formatted print data is already provided
+ * formatted by the client e.g. in an image format or as postscript. For
+ * service formatted print data, the Java Print Service instance produces
+ * the formatted print data. Here the doc flavor's representation class name
+ * does specify an interface instead of the actual print data source. The
+ * print service will call the methods of the given implementation of this
+ * interface with a special Graphics object capable of producing formatted
+ * print data from the graphics routines inside the interface methods.
+ * </p>
+ * <p>
+ * <h3>Client formatted print data document flavors</h3>
+ * The print service uses the representation class of the doc flavor to know
+ * how to retrieve the print data. If the representation class is a
+ * <code>URL</code> it will open the URL to read the print data from it. If it is
+ * a <code>byte[]</code> it will directly use the array and send it to the
+ * printer. There are predefined doc flavor as inner class for the most common
+ * representation class types:
+ * <ul>
+ * <li>Character arrays (<code>char[]</code>): The characters of the array
+ * represent the print data.</li>
+ * <li>Character streams (<code>java.io.Reader</code>): The whole characters
+ * read from the stream represent the print data.</li>
+ * <li>String (<code>java.lang.String</code>): The characters of the String
+ * represent the print data.</li>
+ * <li>Byte arrays (<code>byte[]</code>): The bytes of the array represent the
+ * print data. Encoding if text content is given in the mime type.</li>
+ * <li>Byte streams (<code>java.io.InputStream</code>): The whole bytes read
+ * from the stream represent the print data. If text content the encoding is
+ * specified in the mime type.</li>
+ * <li>Uniform Resource Locator (<code>java.net.URL</code>): The bytes read
+ * from the stream through opening of the URL represent the print data.
+ * If text content the encoding is specified in the mime type.</li></li>
+ * </ul>
+ * </p>
+ * <p>
+ * <h3>Service formatted print data document flavors</h3>
+ * The print service uses the provided object implementing the interface
+ * specified by the representation class to produce the formatted print data.
+ * The mime type of service formatted data is always
+ * <code>"application/x-java-jvm-local-objectref"</code> to signal the local
+ * reference to the print data object implementing the interface. Predefined
+ * doc flavor classes exist as an inner class for the three available interface
+ * to produce print data:
+ * <ul>
+ * <li>Pageable object (<code>java.awt.print.Pageable</code>): A pageable object
+ * is supplied to the print service. The print service will call the methods of
+ * the interface with a Grahics object to produce the formatted print data.</li>
+ * <li>Printable object (<code>java.awt.print.Printable</code>): A printable object
+ * is supplied to the print service. The print service will call the methods of
+ * the interface with a Grahics object to produce the formatted print data.</li>
+ * <li>Renderable Image object
+ * (<code>java.awt.image.renderable.RenderableImage</code>): A renderable image
+ * object is supplied to the print service. The print service calls methods of
+ * this interface to obtain the image to be printed.</li>
+ * </ul>
+ * </p>
+ *
+ * @author Michael Koch (konqueror at gmx.de)
+ * @author Wolfgang Baer (WBaer at gmx.de)
+ */
+public class DocFlavor implements Cloneable, Serializable
+{
+ /**
+ * Predefined static <code>DocFlavor</code> objects for document
+ * types which use a byte array for the print data representation.
+ * <p>All the defined doc flavors have a print data representation
+ * classname of "[B" (byte array).</p>
+ *
+ * @author Michael Koch (konqueror at gmx.de)
+ */
+ public static class BYTE_ARRAY
+ extends DocFlavor
+ {
+ private static final long serialVersionUID = -9065578006593857475L;
+
+ /**
+ * Byte array doc flavor with a MIME Type of "application/octet-stream".
+ */
+ public static final BYTE_ARRAY AUTOSENSE = new BYTE_ARRAY("application/octet-stream");
+ /**
+ * Byte array doc flavor with a MIME Type of "image/gif".
+ */
+ public static final BYTE_ARRAY GIF = new BYTE_ARRAY("image/gif");
+ /**
+ * Byte array doc flavor with a MIME Type of "image/jpeg".
+ */
+ public static final BYTE_ARRAY JPEG = new BYTE_ARRAY("image/jpeg");
+ /**
+ * Byte array doc flavor with a MIME Type of "application/vnd.hp-PCL".
+ */
+ public static final BYTE_ARRAY PCL = new BYTE_ARRAY("application/vnd.hp-PCL");
+ /**
+ * Byte array doc flavor with a MIME Type of "application/pdf".
+ */
+ public static final BYTE_ARRAY PDF = new BYTE_ARRAY("application/pdf");
+ /**
+ * Byte array doc flavor with a MIME Type of "image/png".
+ */
+ public static final BYTE_ARRAY PNG = new BYTE_ARRAY("image/png");
+ /**
+ * Byte array doc flavor with a MIME Type of "application/postscript".
+ */
+ public static final BYTE_ARRAY POSTSCRIPT = new BYTE_ARRAY("application/postscript");
+ /**
+ * Byte array doc flavor with a MIME Type of "text/html" in the host encoding.
+ */
+ public static final BYTE_ARRAY TEXT_HTML_HOST = new BYTE_ARRAY("text/html; charset=" + hostEncoding);
+ /**
+ * Byte array doc flavor with a MIME Type of "text/html; charset=us-ascii".
+ */
+ public static final BYTE_ARRAY TEXT_HTML_US_ASCII = new BYTE_ARRAY("text/html; charset=us-ascii");
+ /**
+ * Byte array doc flavor with a MIME Type of "text/html; charset=utf-16".
+ */
+ public static final BYTE_ARRAY TEXT_HTML_UTF_16 = new BYTE_ARRAY("text/html; charset=utf-16");
+ /**
+ * Byte array doc flavor with a MIME Type of "text/html; charset=utf-16be".
+ */
+ public static final BYTE_ARRAY TEXT_HTML_UTF_16BE = new BYTE_ARRAY("text/html; charset=utf-16be");
+ /**
+ * Byte array doc flavor with a MIME Type of "text/html; charset=utf-16le".
+ */
+ public static final BYTE_ARRAY TEXT_HTML_UTF_16LE = new BYTE_ARRAY("text/html; charset=utf-16le");
+ /**
+ * Byte array doc flavor with a MIME Type of "text/html; charset=utf-8".
+ */
+ public static final BYTE_ARRAY TEXT_HTML_UTF_8 = new BYTE_ARRAY("text/html; charset=utf-8");
+ /**
+ * Byte array doc flavor with a MIME Type of "text/plain" in the host encoding.
+ */
+ public static final BYTE_ARRAY TEXT_PLAIN_HOST = new BYTE_ARRAY("text/plain; charset=" + hostEncoding);
+ /**
+ * Byte array doc flavor with a MIME Type of "text/plain; charset=us-ascii".
+ */
+ public static final BYTE_ARRAY TEXT_PLAIN_US_ASCII = new BYTE_ARRAY("text/plain; charset=us-ascii");
+ /**
+ * Byte array doc flavor with a MIME Type of "text/plain; charset=utf-16".
+ */
+ public static final BYTE_ARRAY TEXT_PLAIN_UTF_16 = new BYTE_ARRAY("text/plain; charset=utf-16");
+ /**
+ * Byte array doc flavor with a MIME Type of "text/plain; charset=utf-16be".
+ */
+ public static final BYTE_ARRAY TEXT_PLAIN_UTF_16BE = new BYTE_ARRAY("text/plain; charset=utf-16be");
+ /**
+ * Byte array doc flavor with a MIME Type of "text/plain; charset=utf-16le".
+ */
+ public static final BYTE_ARRAY TEXT_PLAIN_UTF_16LE = new BYTE_ARRAY("text/plain; charset=utf-16le");
+ /**
+ * Byte array doc flavor with a MIME Type of "text/plain; charset=utf-8".
+ */
+ public static final BYTE_ARRAY TEXT_PLAIN_UTF_8 = new BYTE_ARRAY("text/plain; charset=utf-8");
+
+ /**
+ * Constructor for doc flavor objects with the given MIME type
+ * and a print data representation class name of "[B".
+ *
+ * @param mimeType the mime type string
+ *
+ * @throws NullPointerException if mimeType is <code>null</code>.
+ * @throws IllegalArgumentException if mimeType has the wrong syntax.
+ */
+ public BYTE_ARRAY(String mimeType)
+ {
+ super(mimeType, "[B");
+ }
+ }
+
+ /**
+ * Predefined static <code>DocFlavor</code> objects for document
+ * types which use a char array for the print data representation.
+ * <p>All the defined doc flavors have a print data representation
+ * classname of "[C" (char array).</p>
+ *
+ * @author Michael Koch (konqueror at gmx.de)
+ */
+ public static class CHAR_ARRAY
+ extends DocFlavor
+ {
+ private static final long serialVersionUID = -8720590903724405128L;
+
+ /**
+ * Char array doc flavor with a MIME Type of "text/html; charset=utf-16".
+ */
+ public static final DocFlavor.CHAR_ARRAY TEXT_HTML = new CHAR_ARRAY("text/html; charset=utf-16");
+ /**
+ * Char array doc flavor with a MIME Type of "text/plain; charset=utf-16".
+ */
+ public static final DocFlavor.CHAR_ARRAY TEXT_PLAIN = new CHAR_ARRAY("text/plain; charset=utf-16");
+
+ /**
+ * Constructor for doc flavor objects with the given MIME type
+ * and a print data representation class name of "[C".
+ *
+ * @param mimeType the mime type string
+ *
+ * @throws NullPointerException if mimeType is <code>null</code>.
+ * @throws IllegalArgumentException if mimeType has the wrong syntax.
+ */
+ public CHAR_ARRAY(String mimeType)
+ {
+ super(mimeType, "[C");
+ }
+ }
+
+ /**
+ * Predefined static <code>DocFlavor</code> objects for document
+ * types which use an InputStream to retrieve the print data.
+ * <p>All the defined doc flavors have a print data representation
+ * classname of "java.io.InputStream".</p>
+ *
+ * @author Michael Koch (konqueror at gmx.de)
+ */
+ public static class INPUT_STREAM
+ extends DocFlavor
+ {
+ private static final long serialVersionUID = -7045842700749194127L;
+
+ /**
+ * InputStream doc flavor with a MIME Type of "application/octet-stream".
+ */
+ public static final INPUT_STREAM AUTOSENSE = new INPUT_STREAM("application/octet-stream");
+ /**
+ * InputStream doc flavor with a MIME Type of "image/gif".
+ */
+ public static final INPUT_STREAM GIF = new INPUT_STREAM("image/gif");
+ /**
+ * InputStream doc flavor with a MIME Type of "image/jpeg".
+ */
+ public static final INPUT_STREAM JPEG = new INPUT_STREAM("image/jpeg");
+ /**
+ * InputStream doc flavor with a MIME Type of "application/vnd.hp-PCL".
+ */
+ public static final INPUT_STREAM PCL = new INPUT_STREAM("application/vnd.hp-PCL");
+ /**
+ * InputStream doc flavor with a MIME Type of "application/pdf".
+ */
+ public static final INPUT_STREAM PDF = new INPUT_STREAM("application/pdf");
+ /**
+ * InputStream doc flavor with a MIME Type of "image/png".
+ */
+ public static final INPUT_STREAM PNG = new INPUT_STREAM("image/png");
+ /**
+ * InputStream doc flavor with a MIME Type of "application/postscript".
+ */
+ public static final INPUT_STREAM POSTSCRIPT = new INPUT_STREAM("application/postscript");
+ /**
+ * InputStream doc flavor with a MIME Type of "text/html" in the host encoding.
+ */
+ public static final INPUT_STREAM TEXT_HTML_HOST = new INPUT_STREAM("text/html; charset=" + hostEncoding);
+ /**
+ * InputStream doc flavor with a MIME Type of "text/html; charset=us-ascii".
+ */
+ public static final INPUT_STREAM TEXT_HTML_US_ASCII = new INPUT_STREAM("text/html; charset=us-ascii");
+ /**
+ * InputStream doc flavor with a MIME Type of "text/html; charset=utf-16".
+ */
+ public static final INPUT_STREAM TEXT_HTML_UTF_16 = new INPUT_STREAM("text/html; charset=utf-16");
+ /**
+ * InputStream doc flavor with a MIME Type of "text/html; charset=utf-16be".
+ */
+ public static final INPUT_STREAM TEXT_HTML_UTF_16BE = new INPUT_STREAM("text/html; charset=utf-16be");
+ /**
+ * InputStream doc flavor with a MIME Type of "text/html; charset=utf-16le".
+ */
+ public static final INPUT_STREAM TEXT_HTML_UTF_16LE = new INPUT_STREAM("text/html; charset=utf-16le");
+ /**
+ * InputStream doc flavor with a MIME Type of "text/html; charset=utf-8".
+ */
+ public static final INPUT_STREAM TEXT_HTML_UTF_8 = new INPUT_STREAM("text/html; charset=utf-8");
+ /**
+ * InputStream doc flavor with a MIME Type of "text/plain" in the host encoding.
+ */
+ public static final INPUT_STREAM TEXT_PLAIN_HOST = new INPUT_STREAM("text/plain; charset=" + hostEncoding);
+ /**
+ * InputStream doc flavor with a MIME Type of "text/plain; charset=us-ascii".
+ */
+ public static final INPUT_STREAM TEXT_PLAIN_US_ASCII = new INPUT_STREAM("text/plain; charset=us-ascii");
+ /**
+ * InputStream doc flavor with a MIME Type of "text/plain; charset=utf-16".
+ */
+ public static final INPUT_STREAM TEXT_PLAIN_UTF_16 = new INPUT_STREAM("text/plain; charset=utf-16");
+ /**
+ * InputStream doc flavor with a MIME Type of "text/plain; charset=utf-16be".
+ */
+ public static final INPUT_STREAM TEXT_PLAIN_UTF_16BE = new INPUT_STREAM("text/plain; charset=utf-16be");
+ /**
+ * InputStream doc flavor with a MIME Type of "text/plain; charset=utf-16le".
+ */
+ public static final INPUT_STREAM TEXT_PLAIN_UTF_16LE = new INPUT_STREAM("text/plain; charset=utf-16le");
+ /**
+ * InputStream doc flavor with a MIME Type of "text/plain; charset=utf-8".
+ */
+ public static final INPUT_STREAM TEXT_PLAIN_UTF_8 = new INPUT_STREAM("text/plain; charset=utf-8");
+
+ /**
+ * Constructor for doc flavor objects with the given MIME type
+ * and a print data representation class name of "java.io.InputStream".
+ *
+ * @param mimeType the mime type string
+ *
+ * @throws NullPointerException if mimeType is <code>null</code>.
+ * @throws IllegalArgumentException if mimeType has the wrong syntax.
+ */
+ public INPUT_STREAM(String mimeType)
+ {
+ super(mimeType, "java.io.InputStream");
+ }
+ }
+
+ /**
+ * Predefined static <code>DocFlavor</code> objects for document
+ * types which use an Reader to retrieve the print data.
+ * <p>All the defined doc flavors have a print data representation
+ * classname of "java.io.Reader".</p>
+ *
+ * @author Michael Koch (konqueror at gmx.de)
+ */
+ public static class READER
+ extends DocFlavor
+ {
+ private static final long serialVersionUID = 7100295812579351567L;
+
+ /**
+ * Reader doc flavor with a MIME Type of "text/html; charset=utf-16".
+ */
+ public static final DocFlavor.READER TEXT_HTML = new READER("text/html; charset=utf-16");
+ /**
+ * Reader doc flavor with a MIME Type of "text/plain; charset=utf-16".
+ */
+ public static final DocFlavor.READER TEXT_PLAIN = new READER("text/plain; charset=utf-16");
+
+ /**
+ * Constructor for doc flavor objects with the given MIME type
+ * and a print data representation class name of "java.io.Reader".
+ *
+ * @param mimeType the mime type string
+ *
+ * @throws NullPointerException if mimeType is <code>null</code>.
+ * @throws IllegalArgumentException if mimeType has the wrong syntax.
+ */
+ public READER(String mimeType)
+ {
+ super(mimeType, "java.io.Reader");
+ }
+ }
+
+ /**
+ * Predefined static <code>DocFlavor</code> objects for document
+ * types which use service formatted print data.
+ * <p>All the defined doc flavors have a MIME type of
+ * "application/x-java-jvm-local-objectref".</p>
+ *
+ * @author Michael Koch (konqueror at gmx.de)
+ */
+ public static class SERVICE_FORMATTED
+ extends DocFlavor
+ {
+ private static final long serialVersionUID = 6181337766266637256L;
+
+ /**
+ * Service formatted doc flavor with a representation class of
+ * "java.awt.print.Pageable".
+ */
+ public static final DocFlavor.SERVICE_FORMATTED PAGEABLE = new SERVICE_FORMATTED("java.awt.print.Pageable");
+ /**
+ * Service formatted doc flavor with a representation class of
+ * "java.awt.print.Printable".
+ */
+ public static final DocFlavor.SERVICE_FORMATTED PRINTABLE = new SERVICE_FORMATTED("java.awt.print.Printable");
+ /**
+ * Service formatted doc flavor with a representation class of
+ * "java.awt.image.renderable.RenderableImage".
+ */
+ public static final DocFlavor.SERVICE_FORMATTED RENDERABLE_IMAGE = new SERVICE_FORMATTED("java.awt.image.renderable.RenderableImage");
+
+ /**
+ * Constructor for doc flavor objects with a MIME type of
+ * "application/x-java-jvm-local-objectref" and the given
+ * print data representation classname.
+ *
+ * @param className the representation classname
+ *
+ * @throws NullPointerException if className is <code>null</code>.
+ */
+ public SERVICE_FORMATTED(String className)
+ {
+ super("application/x-java-jvm-local-objectref", className);
+ }
+ }
+
+ /**
+ * Predefined static <code>DocFlavor</code> objects for document
+ * types which use a String for the print data representation.
+ * <p>All the defined doc flavors have a print data representation
+ * classname of "java.lang.String".</p>
+ *
+ * @author Michael Koch (konqueror at gmx.de)
+ */
+ public static class STRING
+ extends DocFlavor
+ {
+ private static final long serialVersionUID = 4414407504887034035L;
+
+ /**
+ * String doc flavor with a MIME Type of "text/html; charset=utf-16".
+ */
+ public static final DocFlavor.STRING TEXT_HTML = new STRING("text/html; charset=utf-16");
+ /**
+ * String doc flavor with a MIME Type of "text/plain; charset=utf-16".
+ */
+ public static final DocFlavor.STRING TEXT_PLAIN = new STRING("text/plain; charset=utf-16");
+
+ /**
+ * Constructor for doc flavor objects with the given MIME type
+ * and a print data representation class name of "java.lang.String".
+ *
+ * @param mimeType the mime type string
+ *
+ * @throws NullPointerException if mimeType is <code>null</code>.
+ * @throws IllegalArgumentException if mimeType has the wrong syntax.
+ */
+ public STRING(String mimeType)
+ {
+ super(mimeType, "java.lang.String");
+ }
+ }
+
+ /**
+ * Predefined static <code>DocFlavor</code> objects for document
+ * types which have an URL where to retrieve the print data.
+ * <p>All the defined doc flavors have a print data representation
+ * classname of "java.net.URL".</p>
+ *
+ * @author Michael Koch (konqueror at gmx.de)
+ */
+ public static class URL
+ extends DocFlavor
+ {
+ private static final long serialVersionUID = 2936725788144902062L;
+
+ /**
+ * URL doc flavor with a MIME Type of "application/octet-stream".
+ */
+ public static final DocFlavor.URL AUTOSENSE = new URL("application/octet-stream");
+ /**
+ * URL doc flavor with a MIME Type of "image/gif".
+ */
+ public static final DocFlavor.URL GIF = new URL("image/gif");
+ /**
+ * URL doc flavor with a MIME Type of "image/jpeg".
+ */
+ public static final DocFlavor.URL JPEG = new URL("image/jpeg");
+ /**
+ * URL doc flavor with a MIME Type of "application/vnd.hp-PCL".
+ */
+ public static final DocFlavor.URL PCL = new URL("application/vnd.hp-PCL");
+ /**
+ * URL doc flavor with a MIME Type of "application/pdf".
+ */
+ public static final DocFlavor.URL PDF = new URL("application/pdf");
+ /**
+ * URL doc flavor with a MIME Type of "image/png".
+ */
+ public static final DocFlavor.URL PNG = new URL("image/png");
+ /**
+ * URL doc flavor with a MIME Type of "application/postscript".
+ */
+ public static final DocFlavor.URL POSTSCRIPT = new URL("application/postscript");
+ /**
+ * URL doc flavor with a MIME Type of "text/html" in the host encoding.
+ */
+ public static final DocFlavor.URL TEXT_HTML_HOST = new URL("text/html; charset=" + hostEncoding);
+ /**
+ * URL doc flavor with a MIME Type of "text/html; charset=us-ascii".
+ */
+ public static final DocFlavor.URL TEXT_HTML_US_ASCII = new URL("text/html; charset=us-ascii");
+ /**
+ * URL doc flavor with a MIME Type of "text/html; charset=utf-16".
+ */
+ public static final DocFlavor.URL TEXT_HTML_UTF_16 = new URL("text/html; charset=utf-16");
+ /**
+ * URL doc flavor with a MIME Type of "text/html; charset=utf-16be".
+ */
+ public static final DocFlavor.URL TEXT_HTML_UTF_16BE = new URL("text/html; charset=utf-16be");
+ /**
+ * URL doc flavor with a MIME Type of "text/html; charset=utf-16le".
+ */
+ public static final DocFlavor.URL TEXT_HTML_UTF_16LE = new URL("text/html; charset=utf-16le");
+ /**
+ * URL doc flavor with a MIME Type of "text/html; charset=utf-8".
+ */
+ public static final DocFlavor.URL TEXT_HTML_UTF_8 = new URL("text/html; charset=utf-8");
+ /**
+ * URL doc flavor with a MIME Type of "text/plain" in the host encoding.
+ */
+ public static final DocFlavor.URL TEXT_PLAIN_HOST = new URL("text/plain; charset=" + hostEncoding);
+ /**
+ * URL doc flavor with a MIME Type of "text/plain; charset=us-ascii".
+ */
+ public static final DocFlavor.URL TEXT_PLAIN_US_ASCII = new URL("text/plain; charset=us-ascii");
+ /**
+ * URL doc flavor with a MIME Type of "text/plain; charset=utf-16".
+ */
+ public static final DocFlavor.URL TEXT_PLAIN_UTF_16 = new URL("text/plain; charset=utf-16");
+ /**
+ * URL doc flavor with a MIME Type of "text/plain; charset=utf-16be".
+ */
+ public static final DocFlavor.URL TEXT_PLAIN_UTF_16BE = new URL("text/plain; charset=utf-16be");
+ /**
+ * URL doc flavor with a MIME Type of "text/plain; charset=utf-16le".
+ */
+ public static final DocFlavor.URL TEXT_PLAIN_UTF_16LE = new URL("text/plain; charset=utf-16le");
+ /**
+ * URL doc flavor with a MIME Type of "text/plain; charset=utf-8".
+ */
+ public static final DocFlavor.URL TEXT_PLAIN_UTF_8 = new URL("text/plain; charset=utf-8");
+
+ /**
+ * Constructor for doc flavor objects with the given MIME type
+ * and a print data representation class name of "java.net.URL".
+ *
+ * @param mimeType the mime type string
+ *
+ * @throws NullPointerException if mimeType is <code>null</code>.
+ * @throws IllegalArgumentException if mimeType has the wrong syntax.
+ */
+ public URL(String mimeType)
+ {
+ super(mimeType, "java.net.URL");
+ }
+ }
+
+ private static final long serialVersionUID = -4512080796965449721L;
+
+ /**
+ * The string representing the host encoding. This is the encoding
+ * used in the predefined HOST doc flavors
+ * (e.g. {@link BYTE_ARRAY#TEXT_HTML_HOST}).
+ */
+ public static final String hostEncoding = Charset.defaultCharset().name();
+
+ private transient String mediaSubtype;
+ private transient String mediaType;
+ private transient TreeMap params;
+
+ // name as defined in Serialized Form JDK 1.4
+ private String myClassName;
+
+ /**
+ * Constructs a <code>DocFlavor</code> object with the given MIME type and
+ * representation class name.
+ *
+ * @param mimeType the MIME type string.
+ * @param className the fully-qualified name of the representation class.
+ *
+ * @throws NullPointerException if mimeType or className are <code>null</code>.
+ * @throws IllegalArgumentException if given mimeType has syntax errors.
+ */
+ public DocFlavor(String mimeType, String className)
+ {
+ if (mimeType == null || className == null)
+ throw new NullPointerException();
+
+ params = new TreeMap();
+ parseMimeType(mimeType);
+
+ myClassName = className;
+ }
+
+ /**
+ * Parses the given string as MIME type.
+ * The mediatype, mediasubtype and all parameter/value
+ * combinations are extracted, comments are dropped.
+ *
+ * @param mimeType the string to parse
+ * @throws IllegalArgumentException if not conformant.
+ */
+ private void parseMimeType(String mimeType)
+ {
+ int MEDIA = 1;
+ int MEDIASUB = 2;
+ int PARAM_NAME = 3;
+ int PARAM_VALUE = 4;
+ int COMMENT_START = 5;
+
+ int state = 0;
+ int lastState = 0; // keeps track of state before comment
+ int tok;
+
+ try
+ {
+ String paramName = null;
+ StreamTokenizer in = new StreamTokenizer(new StringReader(mimeType));
+ in.resetSyntax();
+ // Allowed characters are anything except:
+ // SPACE, CTLs (= Unicode characters U+0000 - U+001F and U+007F)
+ // and tspecials ( ) < > @ , ; : \ " / [ ] ? =
+ in.whitespaceChars(0x00, 0x20);
+ in.whitespaceChars(0x7F, 0x7F);
+ in.wordChars('A', 'Z');
+ in.wordChars('a', 'z');
+ in.wordChars('0', '9');
+ in.wordChars(0xA0, 0xFF);
+ in.wordChars(0x21, 0x21);
+ in.wordChars(0x23, 0x27);
+ in.wordChars(0x2A, 0x2B);
+ in.wordChars(0x2D, 0x2E);
+ in.wordChars(0x5E, 0x60);
+ in.wordChars(0x7B, 0x7E);
+ in.quoteChar('"');
+
+ while ((tok = in.nextToken()) != StreamTokenizer.TT_EOF)
+ {
+ switch (tok)
+ {
+ case StreamTokenizer.TT_WORD:
+ if (state == 0)
+ {
+ mediaType = in.sval.toLowerCase();
+ state = MEDIA;
+ break;
+ }
+ if (state == MEDIA)
+ {
+ mediaSubtype = in.sval.toLowerCase();
+ state = MEDIASUB;
+ break;
+ }
+ // begin of parameters is either after mediasub or a parameter value
+ if (state == MEDIASUB || state == PARAM_VALUE)
+ {
+ paramName = in.sval.toLowerCase();
+ state = PARAM_NAME;
+ break;
+ }
+ // a parameter always needs to follow a value
+ if (state == PARAM_NAME)
+ {
+ String paramValue = in.sval;
+ // if a charset param the value needs to be stored lowercase
+ if (paramName.equals("charset"))
+ paramValue = paramValue.toLowerCase();
+
+ state = PARAM_VALUE;
+ params.put(paramName, paramValue);
+ break;
+ }
+ if (state == COMMENT_START)
+ {
+ // ignore;
+ break;
+ }
+ break;
+ case '/':
+ // may only occur after the mediatype
+ if (state != MEDIA)
+ throw new IllegalArgumentException();
+
+ break;
+ case '=':
+ // may only occur after a parameter
+ if (state != PARAM_NAME)
+ throw new IllegalArgumentException();
+
+ break;
+ case ';':
+ // differentiates mime type and parameters/value combinations
+ if (state != MEDIASUB && state != PARAM_VALUE)
+ throw new IllegalArgumentException();
+
+ break;
+ case '(': // begin comment
+ lastState = state;
+ state = COMMENT_START;
+ break;
+ case ')': // end comment
+ state = lastState;
+ break;
+ // a parameter always needs to follow a value / or quoted value
+ case '"':
+ if (state == PARAM_NAME)
+ {
+ String paramValue = in.sval;
+ // if a charset param the value needs to be stored lowercase
+ if (paramName.equals("charset"))
+ paramValue = paramValue.toLowerCase();
+
+ state = PARAM_VALUE;
+ params.put(paramName, paramValue);
+ break;
+ }
+
+ // only values may be quoted
+ throw new IllegalArgumentException();
+ default:
+ // if any other char is observed its not allowed
+ throw new IllegalArgumentException();
+ }
+ }
+ }
+ catch (IOException e)
+ {
+ // should not happen as mimetype str cannot be null
+ throw new InternalError("IOException during parsing String " + mimeType);
+ }
+ }
+
+ /**
+ * Checks if this doc flavor object is equal to the given object.
+ * <p>
+ * Two doc flavor objects are considered equal if the provided object is not
+ * <code>null</code> and an instance of <code>DocFlavor</code>. The MIME
+ * types has to be equal in their media type, media subtype, their
+ * paramter/value combinations and the representation classname.
+ * </p>
+ *
+ * @param obj the object to test.
+ * @return <code>true</code> if equal, <code>false</code> otherwise.
+ */
+ public boolean equals(Object obj)
+ {
+ if (! (obj instanceof DocFlavor))
+ return false;
+
+ DocFlavor tmp = (DocFlavor) obj;
+
+ return (getMimeType().equals(tmp.getMimeType())
+ && getRepresentationClassName().equals(tmp.getRepresentationClassName()));
+ }
+
+ /**
+ * Returns the media subtype of this flavor object.
+ * A mimetype of "text/html; charset=us-ascii" will
+ * return "html" as the media subtype.
+ *
+ * @return The media subtype.
+ */
+ public String getMediaSubtype()
+ {
+ return mediaSubtype;
+ }
+
+ /**
+ * Returns the media type of this flavor object.
+ * A mimetype of "text/html; charset=us-ascii" will
+ * return "text" as the media type.
+ *
+ * @return The media type.
+ */
+ public String getMediaType()
+ {
+ return mediaType;
+ }
+
+ /**
+ * Returns the mime type of this flavor object.
+ * The mimetype will have every parameter value
+ * enclosed in quotes.
+ *
+ * @return The mime type.
+ */
+ public String getMimeType()
+ {
+ String mimeType = getMediaType() + "/" + getMediaSubtype();
+ Iterator it = params.entrySet().iterator();
+
+ while (it.hasNext())
+ {
+ Map.Entry entry = (Map.Entry) it.next();
+ mimeType += "; " + entry.getKey() + "=\"" + entry.getValue() + "\"";
+ }
+
+ return mimeType;
+ }
+
+ /**
+ * Returns the value for an optional parameter of the mime type of this
+ * flavor object.
+ *
+ * @param paramName the name of the parameter
+ * @return The value for the parameter, or <code>null</code> if none bound.
+ * @throws NullPointerException if paramName is <code>null</code>.
+ */
+ public String getParameter(String paramName)
+ {
+ if (paramName == null)
+ throw new NullPointerException();
+
+ return (String) params.get(paramName.toLowerCase());
+ }
+
+ /**
+ * Returns the name of the representation class of this flavor object.
+ *
+ * @return The representation classname.
+ */
+ public String getRepresentationClassName()
+ {
+ return myClassName;
+ }
+
+ /**
+ * Returns a hash code for this doc flavor object.
+ *
+ * @return The hashcode.
+ */
+ public int hashCode()
+ {
+ return ((mediaType.hashCode()
+ * mediaSubtype.hashCode()
+ * myClassName.hashCode()) ^ params.hashCode());
+ }
+
+ /**
+ * Returns a string representation of this doc flavor object.
+ * The returned string is of the form
+ * getMimeType() + "; class=\"" + getRepresentationClassName() + "\"";
+ *
+ * @return The constructed string representation.
+ */
+ public String toString()
+ {
+ return getMimeType() + "; class=\"" + getRepresentationClassName() + "\"";
+ }
+
+ // needs special treatment for serialization
+ private void readObject(ObjectInputStream stream)
+ throws IOException, ClassNotFoundException
+ {
+ params = new TreeMap();
+ myClassName = (String) stream.readObject();
+ parseMimeType((String) stream.readObject());
+ }
+
+ private void writeObject(java.io.ObjectOutputStream stream)
+ throws IOException
+ {
+ stream.writeObject(myClassName);
+ stream.writeObject(getMimeType());
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/print/DocPrintJob.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/print/DocPrintJob.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/print/DocPrintJob.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/print/DocPrintJob.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,148 @@
+/* DocPrintJob.java --
+ Copyright (C) 2004, 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.print;
+
+import javax.print.attribute.PrintJobAttributeSet;
+import javax.print.attribute.PrintRequestAttributeSet;
+import javax.print.event.PrintJobAttributeListener;
+import javax.print.event.PrintJobListener;
+
+/**
+ * <code>DocPrintJob</code> represents a print job which supports printing
+ * of a single document.
+ * <p>
+ * An instance can be obtained from every <code>PrintService</code> available
+ * by calling the {@link javax.print.PrintService#createPrintJob()} method.
+ * A print job is bound to the print service it is created from.
+ * </p>
+ *
+ * @author Michael Koch (konqueror at gmx.de)
+ */
+public interface DocPrintJob
+{
+ /**
+ * Registers a listener for changes in the specified attribute set
+ * during processing of this print job.
+ * <p>
+ * If the given attribute set is empty no changes will be reported.
+ * If the set is <code>null</code> all attributes are monitored.
+ * </p>
+ *
+ * @param listener the listener to register.
+ * @param attributes the attributes to observe.
+ *
+ * @see #removePrintJobAttributeListener(PrintJobAttributeListener)
+ */
+ void addPrintJobAttributeListener(PrintJobAttributeListener listener,
+ PrintJobAttributeSet attributes);
+
+ /**
+ * Registers a listener for events occuring during processing
+ * of this print job.
+ *
+ * @param listener the listener to add, if <code>null</code> nothing is done.
+ *
+ * @see #removePrintJobListener(PrintJobListener)
+ */
+ void addPrintJobListener(PrintJobListener listener);
+
+ /**
+ * Returns the print job's attributes.
+ * <p>
+ * The returned set of attributes is a snapshot at the time of calling this
+ * method and will not be updated if changes to the print job's attributes
+ * happens. To monitor changes register a print job listener.
+ * </p>
+ *
+ * @return The attributes of this print job,
+ * may be empty but never <code>null</code>.
+ */
+ PrintJobAttributeSet getAttributes();
+
+ /**
+ * Returns the <code>PrintService</code> object this print job is bound to.
+ *
+ * @return The print service.
+ */
+ PrintService getPrintService();
+
+ /**
+ * Prints a document with the specified print job attributes.
+ *
+ * <p>
+ * If the doc flavor provided by the <code>Doc</code> implementation is
+ * not supported by this print service a <code>PrintException</code>
+ * implementing the <code>FlavorException</code> interface will be thrown.
+ * </p>
+ *
+ * @param doc the document to print
+ * @param attributes the job attributes to use. If <code>null</code> the
+ * default attribute values of the print service will be used.
+ *
+ * @throws PrintException if an error occurs. The thrown exception may
+ * implement refining print exception interface to provide more detail of
+ * the error.
+ *
+ * @see AttributeException
+ * @see FlavorException
+ */
+ void print(Doc doc, PrintRequestAttributeSet attributes) throws PrintException;
+
+ /**
+ * Removes the given listener from the listeners registered for changes
+ * in their provided attribute set during processing of this print job.
+ *
+ * @param listener the listener to remove, if <code>null</code> or not
+ * registered nothing will be done.
+ *
+ * @see #addPrintJobAttributeListener(PrintJobAttributeListener, PrintJobAttributeSet)
+ */
+ void removePrintJobAttributeListener(PrintJobAttributeListener listener);
+
+ /**
+ * Removes the given listener from the listeners registered for events
+ * occuring during processing of this print job.
+ *
+ * @param listener the listener to remove, if <code>null</code> or not
+ * registered nothing will be done.
+ *
+ * @see #addPrintJobListener(PrintJobListener)
+ */
+ void removePrintJobListener(PrintJobListener listener);
+}
\ No newline at end of file
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/print/FlavorException.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/print/FlavorException.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/print/FlavorException.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/print/FlavorException.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,62 @@
+/* FlavorException.java --
+ Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.print;
+
+/**
+ * <code>FlavorException</code> specifies a method a specific
+ * subclass of {@link javax.print.PrintException} may implement to
+ * provide further information of printing errors if unsupported
+ * document flavors are involved.
+ * <p>
+ * There exists no <code>PrintException</code> class implementing this
+ * interface. Providing this extension in <code>PrintException</code>
+ * subclasses is left to the concrete print service implementation.
+ * </p>
+ *
+ * @author Michael Koch (konqueror at gmx.de)
+ */
+public interface FlavorException
+{
+ /**
+ * Returns the unsupported document flavors.
+ *
+ * @return The unsupported document flavors.
+ */
+ DocFlavor[] getUnsupportedFlavors();
+}
\ No newline at end of file
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/print/MultiDoc.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/print/MultiDoc.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/print/MultiDoc.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/print/MultiDoc.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,87 @@
+/* MultiDoc.java --
+ Copyright (C) 2004, 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.print;
+
+import java.io.IOException;
+
+
+/**
+ * <code>MultiDoc</code> defines the interface for objects providing multiple
+ * documents for use in a print job.
+ * <p>
+ * Implementations of this interface are used to pass multiple documents, to be
+ * printed as one print job, to the <code>MultiDocPrintJob</code> instance.
+ * </p><p>
+ * There exists no implementation of this interface in the Java Print Service
+ * API. Implementors may assume the following usage in print jobs and the needed
+ * behaviour for implementations: The print job fetches the single documents via
+ * iteration by consecutive calls of the {@link #getDoc()} method to obtain the
+ * current document follwing calls of the {@link #next()} method to get the next
+ * multidoc object for the next <code>getDoc()</code> method call (if returned
+ * multidoc object is not <code>null</code>). The print service will fetch the
+ * document object and then retrieve the print data from the document before it
+ * proceeds with the next call for the next MultiDoc object in the sequence.
+ * </p><p>
+ * Implementations of this interface have to be multiple thread-safe.
+ * </p>
+ *
+ * @author Michael Koch (konqueror at gmx.de)
+ */
+public interface MultiDoc
+{
+ /**
+ * Returns the current document.
+ *
+ * @return The current document.
+ *
+ * @throws IOException if an error occurs
+ */
+ Doc getDoc() throws IOException;
+
+ /**
+ * Returns the next <code>MultiDoc</code> object that contains the
+ * next document for retrieval.
+ *
+ * @return The next <code>MultiDoc</code> object, or <code>null</code>
+ * if no more documents are available.
+ *
+ * @throws IOException if an error occurs
+ */
+ MultiDoc next() throws IOException;
+}
\ No newline at end of file
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/print/MultiDocPrintJob.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/print/MultiDocPrintJob.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/print/MultiDocPrintJob.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/print/MultiDocPrintJob.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,77 @@
+/* MultiDocPrintJob.java --
+ Copyright (C) 2004, 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.print;
+
+import javax.print.attribute.PrintRequestAttributeSet;
+
+
+/**
+ * <code>MultiDocPrintJob</code> represents a print job which supports
+ * printing of multiple documents as one print job.
+ * <p>
+ * An instance can be obtained from every <code>MultiDocPrintService</code>
+ * available by calling the
+ * {@link javax.print.MultiDocPrintService#createMultiDocPrintJob()} method.
+ * A print job is bound to the print service it is created from.
+ * </p>
+ *
+ * @author Michael Koch (konqueror at gmx.de)
+ */
+public interface MultiDocPrintJob extends DocPrintJob
+{
+ /**
+ * Prints the documents supplied in the given <code>MultiDoc</code> object
+ * as one print job with the given printing attributes.
+ *
+ * @param multiDoc the documents to print. Every document must have a
+ * flavor supported by the bound print service.
+ * @param attributes the printing attributes to apply to the print job. If
+ * <code>null</code> the default attribute values will be used.
+ *
+ * @throws PrintException if an error occurs. The thrown exception may
+ * implement refining print exception interface to provide more detail of
+ * the error.
+ *
+ * @see FlavorException
+ * @see AttributeException
+ */
+ void print(MultiDoc multiDoc, PrintRequestAttributeSet attributes)
+ throws PrintException;
+}
+
\ No newline at end of file
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/print/MultiDocPrintService.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/print/MultiDocPrintService.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/print/MultiDocPrintService.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/print/MultiDocPrintService.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,60 @@
+/* MultiDocPrintService.java --
+ Copyright (C) 2004, 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.print;
+
+
+/**
+ * <code>MultiDocPrintService</code> represents print services that are
+ * capable of printing multiple documents as one print job. It provides an
+ * additional method for the creation of a print job for multiple documents.
+ *
+ * @see javax.print.MultiDoc
+ * @see javax.print.MultiDocPrintJob
+ *
+ * @author Michael Koch (konqueror at gmx.de)
+ */
+public interface MultiDocPrintService extends PrintService
+{
+ /**
+ * Create a job that can print a <code>MultiDoc</code> object.
+ *
+ * @return The created print job.
+ */
+ MultiDocPrintJob createMultiDocPrintJob();
+}
\ No newline at end of file
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/print/PrintException.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/print/PrintException.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/print/PrintException.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/print/PrintException.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,98 @@
+/* PrintException.java --
+ Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.print;
+
+/**
+ * <code>PrintException</code> is used to report exceptions during the
+ * usage of a print service implementation.
+ * <p>
+ * This base class only provides the possibility to report a message as
+ * exception. A concrete print service implementation may provide
+ * specialised subclasses implementing one or more of the following
+ * exception interfaces:<br>
+ * <ul>
+ * <li>{@link javax.print.AttributeException}</li>
+ * <li>{@link javax.print.FlavorException}</li>
+ * <li>{@link javax.print.URIException}</li>
+ * </ul>
+ * </p>
+ *
+ * @author Michael Koch (konqueror at gmx.de)
+ */
+public class PrintException extends Exception
+{
+ /**
+ * Construct a print exception.
+ */
+ public PrintException()
+ {
+ super();
+ }
+
+ /**
+ * Construct a print exception.
+ *
+ * @param e chained exception
+ */
+ public PrintException(Exception e)
+ {
+ super(e);
+ }
+
+ /**
+ * Construct a print exception.
+ *
+ * @param s detailed message, or null for no message
+ */
+ public PrintException(String s)
+ {
+ super(s);
+ }
+
+ /**
+ * Construct a print exception.
+ *
+ * @param s detailed message, or null for no message
+ * @param e chained exception
+ */
+ public PrintException(String s, Exception e)
+ {
+ super(s, e);
+ }
+}
\ No newline at end of file
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/print/PrintService.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/print/PrintService.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/print/PrintService.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/print/PrintService.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,294 @@
+/* PrintService.java --
+ Copyright (C) 2004, 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.print;
+
+import javax.print.attribute.Attribute;
+import javax.print.attribute.AttributeSet;
+import javax.print.attribute.PrintServiceAttribute;
+import javax.print.attribute.PrintServiceAttributeSet;
+import javax.print.event.PrintServiceAttributeListener;
+
+/**
+ * A <code>PrintService</code> represents a printer available for printing.
+ * <p>
+ * The print service hereby may be a real physical printer device, a printer
+ * group with same capabilities or a logical print service (like for example
+ * a PDF writer). The print service is used to query the capabilities of the
+ * represented printer instance. If a suitable print service is found it is
+ * used to create a print job for the actual printing process.
+ * </p>
+ * @see javax.print.DocPrintJob
+ *
+ * @author Michael Koch (konqueror at gmx.de)
+ */
+public interface PrintService
+{
+ /**
+ * Creates and returns a new print job which is capable to handle all
+ * the document flavors supported by this print service.
+ *
+ * @return The created print job object.
+ */
+ DocPrintJob createPrintJob();
+
+ /**
+ * Determines if two services refer to the same underlying service.
+ *
+ * @param obj the service to check against
+ *
+ * @return <code>true</code> if both services refer to the same underlying
+ * service, <code>false</code> otherwise.
+ */
+ boolean equals(Object obj);
+
+ /**
+ * Returns the value of the single specified attribute.
+ *
+ * @param category the category of a <code>PrintServiceAttribute</code>
+ *
+ * @return The value of the attribute, or <code>null</code> if the attribute
+ * category is not supported by this print service implementation.
+ *
+ * @throws NullPointerException if category is <code>null</code>.
+ * @throws IllegalArgumentException if category is not a class that
+ * implements <code>PrintServiceAttribute</code>.
+ */
+ PrintServiceAttribute getAttribute(Class category);
+
+ /**
+ * Returns the attributes describing this print service. The returned
+ * attributes set is unmodifiable and represents the current state of
+ * the print service. As some print service attributes may change
+ * (depends on the print service implementation) a subsequent call to
+ * this method may return a different set. To monitor changes a
+ * <code>PrintServiceAttributeListener</code> may be registered.
+ *
+ * @return All the description attributes of this print service.
+ * @see #addPrintServiceAttributeListener(PrintServiceAttributeListener)
+ */
+ PrintServiceAttributeSet getAttributes();
+
+ /**
+ * Determines and returns the default value for a given attribute category
+ * of this print service.
+ * <p>
+ * A return value of <code>null</code> means either that the print service
+ * does not support the attribute category or there is no default value
+ * available for this category. To distinguish these two case one can test
+ * with {@link #isAttributeCategorySupported(Class)} if the category is
+ * supported.
+ * </p>
+ *
+ * @param category the category of the attribute
+ *
+ * @return The default value, or <code>null</code>.
+ *
+ * @throws NullPointerException if <code>category</code> is <code>null</code>
+ * @throws IllegalArgumentException if <code>category</code> is a class
+ * not implementing <code>Attribute</code>
+ */
+ Object getDefaultAttributeValue(Class category);
+
+ /**
+ * Returns the name of this print service.
+ * This may be the value of the <code>PrinterName</code> attribute.
+ *
+ * @return The print service name.
+ */
+ String getName();
+
+ /**
+ * Returns a factory for UI components if supported by the print service.
+ *
+ * @return A factory for UI components or <code>null</code>.
+ */
+ ServiceUIFactory getServiceUIFactory();
+
+ /**
+ * Returns all supported attribute categories.
+ *
+ * @return The class array of all supported attribute categories.
+ */
+ Class[] getSupportedAttributeCategories();
+
+ /**
+ * Determines and returns all supported attribute values of a given
+ * attribute category a client can use when setting up a print job
+ * for this print service.
+ * <p>
+ * The returned object may be one of the following types:
+ * <ul>
+ * <li>A single instance of the attribute category to indicate that any
+ * value will be supported.</li>
+ * <li>An array of the same type as the attribute category to test,
+ * containing all the supported values for this category.</li>
+ * <li>A single object (of any other type than the attribute category)
+ * which indicates bounds on the supported values.</li>
+ * </ul>
+ * </p>
+ *
+ * @param category the attribute category to test
+ * @param flavor the document flavor to use, or <code>null</code>
+ * @param attributes set of attributes for a supposed job,
+ * or <code>null</code>
+ *
+ * @return A object (as defined above) indicating the supported values
+ * for the given attribute category, or <code>null</code> if this print
+ * service doesn't support the given attribute category at all.
+ *
+ * @throws NullPointerException if <code>category</code> is null
+ * @throws IllegalArgumentException if <code>category</code> is a class not
+ * implementing <code>Attribute</code>, or if <code>flavor</code> is not
+ * supported
+ */
+ Object getSupportedAttributeValues(Class category, DocFlavor flavor, AttributeSet attributes);
+
+ /**
+ * Determines and returns an array of all supported document flavors which
+ * can be used to supply print data to this print service.
+ * <p>
+ * The supported attribute categories may differ between the supported
+ * document flavors. To test for supported attributes one can use the
+ * {@link #getUnsupportedAttributes(DocFlavor, AttributeSet)} method with
+ * the specific doc flavor and attributes set.
+ * </p>
+ *
+ * @return The supported document flavors.
+ */
+ DocFlavor[] getSupportedDocFlavors();
+
+ /**
+ * Identifies all the unsupported attributes of the given set of attributes
+ * in the context of the specified document flavor.
+ * <p>
+ * The given flavor has to be supported by the print service (use
+ * {@link #isDocFlavorSupported(DocFlavor)} to verify). The method will
+ * return <code>null</code> if all given attributes are supported. Otherwise
+ * a set of unsupported attributes are returned. The attributes in the
+ * returned set may be completely unsupported or only the specific requested
+ * value. If flavor is <code>null</code> the default document flavor of the
+ * print service is used in the identification process.
+ * </p>
+ *
+ * @param flavor document flavor to test, or <code>null</code>.
+ * @param attributes set of printing attributes for a supposed job
+ *
+ * @return <code>null</code> if this print service supports all the given
+ * attributes for the specified doc flavor. Otherwise the set of unsupported
+ * attributes are returned.
+ *
+ * @throws IllegalArgumentException if <code>flavor</code> is unsupported
+ */
+ AttributeSet getUnsupportedAttributes(DocFlavor flavor, AttributeSet attributes);
+
+
+ /**
+ * Returns a hashcode for this print service.
+ *
+ * @return The hashcode.
+ */
+ int hashCode();
+
+ /**
+ * Determines a given attribute category is supported by this
+ * print service implementation. This only tests for the category
+ * not for any specific values of this category nor in the context
+ * of a specific document flavor.
+ *
+ * @param category the category to check
+ *
+ * @return <code>true</code> if <code>category</code> is supported,
+ * <code>false</code> otherwise.
+ *
+ * @throws NullPointerException if <code>category</code> is <code>null</code>
+ * @throws IllegalArgumentException if <code>category</code> is a class not
+ * implementing <code>Attribute</code>.
+ */
+ boolean isAttributeCategorySupported(Class category);
+
+ /**
+ * Determines if a given attribute value is supported when creating a print
+ * job for this print service.
+ * <p>
+ * If either the document flavor or the provided attributes are
+ * <code>null</code> it is determined if the given attribute value is
+ * supported in some combination of the available document flavors and
+ * attributes of the print service. Otherwise it is checked for the
+ * specific context of the given document flavor/attributes set.
+ * </p>
+ *
+ * @param attrval the attribute value to check
+ * @param flavor the document flavor to use, or <code>null</code>.
+ * @param attributes set of attributes to use, or <code>null</code>.
+ *
+ * @return <code>true</code> if the attribute value is supported in the
+ * requested context, <code>false</code> otherwise.
+ *
+ * @throws NullPointerException if <code>attrval</code> is <code>null</code>.
+ * @throws IllegalArgumentException if <code>flavor</code> is not supported
+ * by this print service
+ */
+ boolean isAttributeValueSupported(Attribute attrval, DocFlavor flavor, AttributeSet attributes);
+
+ /**
+ * Determines if a given document flavor is supported or not.
+ *
+ * @param flavor the document flavor to check
+ *
+ * @return <code>true</code> if <code>flavor</code> is supported,
+ * <code>false</code> otherwise.
+ *
+ * @throws NullPointerException if <code>flavor</code> is null.
+ */
+ boolean isDocFlavorSupported(DocFlavor flavor);
+
+ /**
+ * Registers a print service attribute listener to this print service.
+ *
+ * @param listener the listener to add
+ */
+ void addPrintServiceAttributeListener(PrintServiceAttributeListener listener);
+
+ /**
+ * De-registers a print service attribute listener from this print service.
+ *
+ * @param listener the listener to remove
+ */
+ void removePrintServiceAttributeListener(PrintServiceAttributeListener listener);
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/print/PrintServiceLookup.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/print/PrintServiceLookup.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/print/PrintServiceLookup.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/print/PrintServiceLookup.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,303 @@
+/* PrintServiceLookup.java --
+ Copyright (C) 2004, 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.print;
+
+import gnu.classpath.ServiceFactory;
+import gnu.javax.print.CupsPrintServiceLookup;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Iterator;
+
+import javax.print.attribute.AttributeSet;
+
+
+/**
+ * <code>PrintServiceLookup</code> implementations provide a way to lookup
+ * print services based on different constraints.
+ * <p>
+ * Implementations are located and loaded automatically through the SPI JAR
+ * file specification. Therefore implementation classes must provide a default
+ * constructor for instantiation. Furthermore, applications are able to
+ * register further instances directly at runtime.
+ * </p><p>
+ * If an SecurityManager is installed implementors should call
+ * <code>checkPrintJobAccess()</code> to disable access for untrusted code.
+ * This check is to be made in every lookup service implementation for
+ * flexibility. Print services registered by applications through
+ * <code>registerService(PrintService)</code> are suppressed in the
+ * lookup results if a security manager is installed and disallows access.
+ * </p>
+ *
+ * @author Michael Koch (konqueror at gmx.de)
+ * @author Wolfgang Baer (WBaer at gmx.de)
+ */
+public abstract class PrintServiceLookup
+{
+
+ private static final CupsPrintServiceLookup systemProvider;
+ private static final HashSet printServices;
+ private static final HashSet printServiceLookups;
+
+ static
+ {
+ systemProvider = new CupsPrintServiceLookup();
+
+ printServices = new HashSet();
+ printServiceLookups = new HashSet();
+
+ // check for service providers
+ Iterator it = ServiceFactory.lookupProviders(PrintServiceLookup.class);
+
+ while (it.hasNext())
+ printServiceLookups.add(it.next());
+ }
+
+ /**
+ * Constructs a <code>PrintServiceLookup</code> object.
+ */
+ public PrintServiceLookup()
+ {
+ // nothing to do here
+ }
+
+ /**
+ * Explicitly registers the provided print service lookup implementation.
+ * <p>
+ * The registration will silently fail (returning <code>false</code>) if
+ * the lookup service is already registered or the registration somehow
+ * else fails.
+ * </p>
+ *
+ * @param sp the print service lookup implementation to register.
+ * @return <code>true</code> if registered, <code>false</code> otherwise.
+ */
+ public static boolean registerServiceProvider(PrintServiceLookup sp)
+ {
+ return printServiceLookups.add(sp);
+ }
+
+ /**
+ * Explicitly registers the provided print service instance.
+ * <p>
+ * The registration will silently fail (returning <code>false</code>) if
+ * the print service instance is already registered or the registration
+ * somehow else fails.
+ * </p>
+ * @param service the single print service to register.
+ * @return <code>true</code> if registered, <code>false</code> otherwise.
+ */
+ public static boolean registerService(PrintService service)
+ {
+ if (service instanceof StreamPrintService)
+ return false;
+
+ // security
+ try
+ {
+ SecurityManager sm = System.getSecurityManager();
+ if (sm != null)
+ sm.checkPrintJobAccess();
+
+ return printServices.add(service);
+ }
+ catch (SecurityException se)
+ {
+ return false;
+ }
+ }
+
+ /**
+ * Searches print services capable of printing in the given document flavor
+ * which supports the specified printing attributes.
+ *
+ * @param flavor the document flavor to support. If <code>null</code> this
+ * constraint is ignored during lookup.
+ * @param attributes the printing attributes to support. If
+ * <code>null</code> this constraint is ignored during lookup.
+ * @return The resulting available print services, or an array of length 0
+ * if none is found.
+ */
+ public static final PrintService[] lookupPrintServices(DocFlavor flavor,
+ AttributeSet attributes)
+ {
+ ArrayList result = new ArrayList();
+
+ PrintService[] services =
+ systemProvider.getPrintServices(flavor, attributes);
+ result.addAll(Arrays.asList(services));
+
+ for (Iterator it = printServiceLookups.iterator(); it.hasNext(); )
+ {
+ PrintServiceLookup lookup = (PrintServiceLookup) it.next();
+ services = lookup.getPrintServices(flavor, attributes);
+ result.addAll(Arrays.asList(services));
+ }
+
+ for (Iterator it = printServices.iterator(); it.hasNext(); )
+ {
+ PrintService service = (PrintService) it.next();
+ if (systemProvider.checkPrintService(flavor, attributes, service))
+ result.add(service);
+ }
+
+ return (PrintService[]) result.toArray(new PrintService[result.size()]);
+ }
+
+ /**
+ * Searches print services capable of multi document printing in all of the
+ * given document flavors and supporting the specified printing attributes.
+ *
+ * @param flavors the document flavors to support. If <code>null</code> this
+ * constraint is ignored during lookup.
+ * @param attributes the printing attributes to support. If
+ * <code>null</code> this constraint is ignored during lookup.
+ * @return The resulting available multi document print services, or an
+ * array of length 0 if none is found.
+ */
+ public static final MultiDocPrintService[] lookupMultiDocPrintServices(
+ DocFlavor[] flavors, AttributeSet attributes)
+ {
+ ArrayList result = new ArrayList();
+
+ MultiDocPrintService[] services =
+ systemProvider.getMultiDocPrintServices(flavors, attributes);
+ result.addAll(Arrays.asList(services));
+
+ for (Iterator it = printServiceLookups.iterator(); it.hasNext(); )
+ {
+ PrintServiceLookup lookup = (PrintServiceLookup) it.next();
+ services = lookup.getMultiDocPrintServices(flavors, attributes);
+ result.addAll(Arrays.asList(services));
+ }
+
+ for (Iterator it = printServices.iterator(); it.hasNext(); )
+ {
+ PrintService service = (PrintService) it.next();
+ if (systemProvider.checkMultiDocPrintService(flavors, attributes, service))
+ result.add(service);
+ }
+
+ return (MultiDocPrintService[]) result.toArray(
+ new MultiDocPrintService[result.size()]);
+ }
+
+
+ /**
+ * Searches the default print service in the current environment.
+ * <p>
+ * If multiple lookup services are registered and each has a default
+ * print service the result is not specified. Usually the default
+ * print service of the native platform lookup service is returned.
+ * </p><p>
+ * The GNU classpath implementation will return the CUPS default
+ * printing service as the default print service, if available.
+ * </p><p>
+ * The default print service may be overriden by users through
+ * the property <code>javax.print.defaultPrinter</code>. A service
+ * specified must be found to be returned as the default.
+ * </p>
+ *
+ * @return The default print service, or <code>null</code> if none found.
+ */
+ public static final PrintService lookupDefaultPrintService()
+ {
+ // TODO Find out what the property controls and use it
+ // String defaultPrinter = System.getProperty("javax.print.defaultPrinter");
+
+ // first test for platform specified default services
+ PrintService service = systemProvider.getDefaultPrintService();
+
+ if (service != null)
+ return service;
+
+ // none available by systemDefaultProvider
+ // search in other registered ones and take first
+ for (Iterator it = printServiceLookups.iterator(); it.hasNext(); )
+ {
+ service = ((PrintServiceLookup) it.next()).getDefaultPrintService();
+ if (service != null)
+ return service;
+ }
+
+ return null;
+ }
+
+ /**
+ * Not to be called directly by applications.
+ *
+ * @return The default lookup service of the implementing lookup service or
+ * <code>null</code> if there is no default one.
+ */
+ public abstract PrintService getDefaultPrintService();
+
+ /**
+ * Not to be called directly by applications.
+ *
+ * @param flavors the document flavors which have to be supported.
+ * @param attributes the attributes which have to be supported.
+ *
+ * @return The multidoc print services of the implementing lookup service
+ * for the given parameters, or an array of length 0 if none is available.
+ */
+ public abstract MultiDocPrintService[]
+ getMultiDocPrintServices(DocFlavor[] flavors, AttributeSet attributes);
+
+ /**
+ * Not to be called directly by applications.
+ *
+ * @return All known print services of the implementing lookup service
+ * regardless of supported features, or an array of length 0 if none is
+ * available.
+ */
+ public abstract PrintService[] getPrintServices();
+
+ /**
+ * Not to be called directly by applications.
+ *
+ * @param flavor the document flavor which has to be supported.
+ * @param attributes the attributes which have to be supported.
+ *
+ * @return The print services of the implementing lookup service
+ * for the given parameters, or an array of length 0 if none is available.
+ */
+ public abstract PrintService[]
+ getPrintServices(DocFlavor flavor, AttributeSet attributes);
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/print/ServiceUI.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/print/ServiceUI.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/print/ServiceUI.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/print/ServiceUI.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,137 @@
+/* ServiceUI.java --
+ Copyright (C) 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.print;
+
+import gnu.javax.print.PrinterDialog;
+
+import java.awt.GraphicsConfiguration;
+import java.awt.GraphicsEnvironment;
+import java.awt.HeadlessException;
+import java.util.Arrays;
+
+import javax.print.attribute.PrintRequestAttributeSet;
+
+/**
+ * <code>ServiceUI</code> provides a method to create a graphical
+ * print dialog.
+ * <p>
+ * The graphical print dialog enables the user to browse the available
+ * print services on the system. It provides user interfaces to interact
+ * with the most common printing attributes likes specifying the number of
+ * copies to print or the page ranges.
+ * </p><p>
+ * The initial appearance of the print dialog as shown to the user may be
+ * specified by providing the default selected print service as well as
+ * initial values for the printing attributes in the user interface.
+ * </p>
+ *
+ * @author Wolfgang Baer (WBaer at gmx.de)
+ */
+public class ServiceUI
+{
+
+ /**
+ * Default constructor.
+ */
+ public ServiceUI()
+ {
+ // nothing to do here - only one static method
+ }
+
+ /**
+ * Creates a modal graphical printing dialog at the specified location on
+ * the screen.
+ * <p>
+ * The dialog will return the user selected print service and the given
+ * attributes set will contain the modified printing attributes. If the
+ * user cancels the printing dialog <code>null</code> will be returned and
+ * the printing attributes set will be unmodified.
+ * </p><p>
+ * The values of the given attributes set (if not empty) will be displayed
+ * initially unless the are unsupported by the print service. If a print
+ * service does not support a particular value it is substituted with the
+ * default value of the print service.
+ * </p>
+ *
+ * @param gc the screen to use. <code>null</code> is default screen.
+ * @param x the coordinate of the upper left edge of the dialog in screen
+ * coordinates (not relative to the parent frame).
+ * @param y the coordinate of the upper left edge of the dialog in screen
+ * coordinates (not relative to the parent frame).
+ * @param services the print services to browse (not null).
+ * @param defaultService the default service. If <code>null</code>
+ * the first of the print services in the services array will be used.
+ * @param flavor the flavours to be printed.
+ * @param attributes the attributes requested. Will be updated
+ * by selections done by the user in the dialog.
+ *
+ * @return The selected print service or <code>null</code> if user
+ * has cancelled the printer dialog.
+ *
+ * @throws HeadlessException if GraphicsEnvironment is headless
+ * @throws IllegalArgumentException if services is <code>null</code> or an
+ * empty array, attributes are <code>null</code> or the given default
+ * <code>PrintService<code> is not part of the print service array.
+ */
+ public static PrintService printDialog(GraphicsConfiguration gc, int x,
+ int y, PrintService[] services, PrintService defaultService,
+ DocFlavor flavor, PrintRequestAttributeSet attributes)
+ throws HeadlessException
+ {
+ if (GraphicsEnvironment.isHeadless())
+ throw new HeadlessException("GraphicsEnvironment is headless.");
+
+ if (services == null || services.length == 0 || attributes == null)
+ throw new IllegalArgumentException("Given print service array / "
+ + "attributes may not be null");
+
+ if (defaultService != null &&
+ ! Arrays.asList(services).contains(defaultService))
+ throw new IllegalArgumentException("defaultService is not contained "
+ + " in the print service array");
+
+ PrinterDialog dialog = new PrinterDialog(gc, services, defaultService,
+ flavor, attributes);
+
+ dialog.setLocation(x, y);
+ dialog.show();
+
+ return dialog.getSelectedPrintService();
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/print/ServiceUIFactory.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/print/ServiceUIFactory.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/print/ServiceUIFactory.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/print/ServiceUIFactory.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,118 @@
+/* ServiceUIFactory.java --
+ Copyright (C) 2004, 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.print;
+
+/**
+ * <code>ServiceUIFactory</code> enables print services to provide additional
+ * user interface dialogs.
+ * <p>
+ * A print service may provide a <code>ServiceUIFactory</code> implementation
+ * if its <code>getServiceUIFactory()</code> method is called. If a factory
+ * object is returned it can be queried for provided user interface dialogs.
+ * Different roles are defined to denote dialogs providing informations about
+ * the print service, dialogs for administration of a print service and for
+ * end-user browsing dialogs.
+ * </p><p>
+ * The factory can support providing these UI roles in different dialog types
+ * (AWT, Swing, JComponent, Panel). The support and use of Swing interfaces is
+ * however preferred.
+ * </p>
+ *
+ * @author Michael Koch
+ */
+public abstract class ServiceUIFactory
+{
+ /** A user interface providing informations about the print service. */
+ public static final int ABOUT_UIROLE = 1;
+
+ /** A user interface to administer the print service. */
+ public static final int ADMIN_UIROLE = 2;
+
+ /** A user interface for end-user browsing of the print service. */
+ public static final int MAIN_UIROLE = 3;
+
+ /** Role IDs greater than this may be used for other private roles. */
+ public static final int RESERVED_UIROLE = 99;
+
+ /** Identifies a UI provided as an AWT dialog. */
+ public static final String DIALOG_UI = "java.awt.Dialog";
+
+ /** Identifies a UI provided as a Swing JComponent. */
+ public static final String JCOMPONENT_UI = "javax.swing.JComponent";
+
+ /** Identifies a UI provided as a Swing JDialog. */
+ public static final String JDIALOG_UI = "javax.swing.JDialog";
+
+ /** Identifies a UI provided as an AWT Panel. */
+ public static final String PANEL_UI = "java.awt.Panel";
+
+ /**
+ * Constructs a <code>ServiceUIFactory</code> object.
+ */
+ public ServiceUIFactory()
+ {
+ // Do nothing here.
+ }
+
+ /**
+ * Returns an UI object which may be cast to the requested UI type.
+ *
+ * @param role the role requested. Must be one of the standard roles
+ * or a private role supported by this factory
+ * @param ui type in which the role is requested
+ *
+ * @return the UI role or null of this role is not supported by this factory
+ *
+ * @throws IllegalArgumentException if <code>role</code> is neither one of
+ * the standard ones nor a private one supported by this factory
+ */
+ public abstract Object getUI(int role, String ui);
+
+ /**
+ * Returns the UI types supported by this factory for an UI role.
+ *
+ * @param role the role to be looked up
+ *
+ * @return an array of UI types
+ *
+ * @throws IllegalArgumentException if <code>role</code> is neither one of
+ * the standard ones nor a private one supported by this factory
+ */
+ public abstract String[] getUIClassNamesForRole(int role);
+}
\ No newline at end of file
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/print/SimpleDoc.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/print/SimpleDoc.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/print/SimpleDoc.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/print/SimpleDoc.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,223 @@
+/* SimpleDoc.java --
+ Copyright (C) 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.print;
+
+import java.io.ByteArrayInputStream;
+import java.io.CharArrayReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.Reader;
+import java.io.StringReader;
+
+import javax.print.attribute.AttributeSetUtilities;
+import javax.print.attribute.DocAttributeSet;
+
+/**
+ * Simple implementation of the <code>Doc</code> interface capable of handling
+ * the predefined document flavors of <code>DocFlavor</code>.
+ * <p>
+ * This implementation can construct a reader or stream for the service from
+ * the print data and ensures that always the same object is returned on each
+ * method call. It does simple checks that the supplied data matches the
+ * specified flavor of the doc object and supports thread safe access.
+ * </p>
+ *
+ * @author Wolfgang Baer (WBaer at gmx.de)
+ */
+public final class SimpleDoc implements Doc
+{
+ private final Object printData;
+ private final DocFlavor flavor;
+ private final DocAttributeSet attributes;
+
+ private InputStream stream;
+ private Reader reader;
+
+ /**
+ * Constructs a SimpleDoc with the specified print data, doc flavor and doc attribute set.
+ * @param printData the object with the data to print.
+ * @param flavor the document flavor of the print data.
+ * @param attributes the attributes of the doc (may be <code>null</code>).
+ *
+ * @throws IllegalArgumentException if either <code>printData</code> or
+ * <code>flavor</code> are <code>null</code>, or the print data is not
+ * supplied in the document format specified by the given flavor object.
+ */
+ public SimpleDoc(Object printData, DocFlavor flavor,
+ DocAttributeSet attributes)
+ {
+ if (printData == null || flavor == null)
+ throw new IllegalArgumentException("printData/flavor may not be null");
+
+ if (! (printData.getClass().getName().equals(
+ flavor.getRepresentationClassName())
+ || flavor.getRepresentationClassName().equals("java.io.Reader")
+ && printData instanceof Reader
+ || flavor.getRepresentationClassName().equals("java.io.InputStream")
+ && printData instanceof InputStream))
+ {
+ throw new IllegalArgumentException("data is not of declared flavor type");
+ }
+
+ this.printData = printData;
+ this.flavor = flavor;
+
+ if (attributes != null)
+ this.attributes = AttributeSetUtilities.unmodifiableView(attributes);
+ else
+ this.attributes = null;
+
+ stream = null;
+ reader = null;
+ }
+
+ /**
+ * Returns the unmodifiable view of the attributes of this doc object.
+ * <p>
+ * The attributes of this doc's attributes set overrides attributes of
+ * the same category in the print job's attribute set. If an attribute
+ * is not available in this doc's attributes set or <code>null</code>
+ * is returned the attributes of the same category of the print job are
+ * used.
+ * </p>
+ *
+ * @return The unmodifiable attributes set, or <code>null</code>.
+ */
+ public DocAttributeSet getAttributes()
+ {
+ return attributes;
+ }
+
+ /**
+ * Returns the flavor of this doc objects print data.
+ *
+ * @return The document flavor.
+ */
+ public DocFlavor getDocFlavor()
+ {
+ return flavor;
+ }
+
+ /**
+ * Returns the print data of this doc object.
+ * <p>
+ * The returned object is an instance as described by the associated
+ * document flavor ({@link DocFlavor#getRepresentationClassName()})
+ * and can be cast to this representation class.
+ * </p>
+ *
+ * @return The print data in the representation class.
+ * @throws IOException if representation class is a stream and I/O
+ * exception occures.
+ */
+ public Object getPrintData() throws IOException
+ {
+ return printData;
+ }
+
+ /**
+ * Returns a <code>Reader</code> object for extracting character print data
+ * from this document.
+ * <p>
+ * This method is supported if the document flavor is of type:
+ * <ul>
+ * <li><code>char[]</code></li>
+ * <li><code>java.lang.String</code></li>
+ * <li><code>java.io.Reader</code></li>
+ * </ul>
+ * otherwise this method returns <code>null</code>.
+ * </p>
+ *
+ * @return The <code>Reader</code> object, or <code>null</code>.
+ *
+ * @throws IOException if an error occurs.
+ */
+ public Reader getReaderForText() throws IOException
+ {
+ synchronized (this)
+ {
+ // construct the reader if applicable on request
+ if (reader == null)
+ {
+ if (flavor instanceof DocFlavor.CHAR_ARRAY)
+ reader = new CharArrayReader((char[]) printData);
+ else if (flavor instanceof DocFlavor.STRING)
+ reader = new StringReader((String) printData);
+ else if (flavor instanceof DocFlavor.READER)
+ reader = (Reader) printData;
+ }
+
+ return reader;
+ }
+ }
+
+ /**
+ * Returns an <code>InputStream</code> object for extracting byte print data
+ * from this document.
+ * <p>
+ * This method is supported if the document flavor is of type:
+ * <ul>
+ * <li><code>byte[]</code></li>
+ * <li><code>java.io.InputStream</code></li>
+ * </ul>
+ * otherwise this method returns <code>null</code>.
+ * </p>
+ *
+ * @return The <code>InputStream</code> object, or <code>null</code>.
+ *
+ * @throws IOException if an error occurs.
+ */
+ public InputStream getStreamForBytes() throws IOException
+ {
+ synchronized (this)
+ {
+ // construct the stream if applicable on request
+ if (stream == null)
+ {
+ if (flavor instanceof DocFlavor.BYTE_ARRAY)
+ stream = new ByteArrayInputStream((byte[]) printData);
+ else if (flavor instanceof DocFlavor.INPUT_STREAM)
+ stream = (InputStream) printData;
+ }
+
+ return stream;
+ }
+ }
+
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/print/StreamPrintService.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/print/StreamPrintService.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/print/StreamPrintService.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/print/StreamPrintService.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,108 @@
+/* StreamPrintService.java --
+ Copyright (C) 2004, 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.print;
+
+import java.io.OutputStream;
+
+
+/**
+ * <code>StreamPrintService</code> is a special print service capable of
+ * printing into a supplied output stream.
+ * <p>
+ * Beside providing the same functionality as a print service it additionally
+ * allows to specify the output stream for the print data. A stream print
+ * service is obtained via the {@link javax.print.StreamPrintServiceFactory}
+ * by looking for services supporting a given output format type.
+ * </p>
+ *
+ * @author Michael Koch (konqueror at gmx.de)
+ */
+public abstract class StreamPrintService implements PrintService
+{
+ private boolean disposed;
+ private OutputStream out;
+
+ /**
+ * Constructs a <code>StreamPrintService</code> object.
+ *
+ * @param out the <code>OutputStream</code> to use
+ */
+ protected StreamPrintService(OutputStream out)
+ {
+ this.out = out;
+ }
+
+ /**
+ * Dispose this <code>StreamPrintService</code> object.
+ */
+ public void dispose()
+ {
+ disposed = true;
+ }
+
+ /**
+ * Returns the document format emitted by this print service.
+ * The returned string is a MIME type compatible with the
+ * {@link DocFlavor} class.
+ *
+ * @return The document format of the output.
+ */
+ public abstract String getOutputFormat();
+
+ /**
+ * Returns the <code>OutputStream</code> of this object.
+ *
+ * @return The <code>OutputStream</code>
+ */
+ public OutputStream getOutputStream()
+ {
+ return out;
+ }
+
+ /**
+ * Determines if this <code>StreamPrintService</code> object is disposed.
+ *
+ * @return <code>true</code> if disposed already,
+ * otherwise <code>false</code>
+ */
+ public boolean isDisposed()
+ {
+ return disposed;
+ }
+}
\ No newline at end of file
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/print/StreamPrintServiceFactory.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/print/StreamPrintServiceFactory.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/print/StreamPrintServiceFactory.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/print/StreamPrintServiceFactory.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,130 @@
+/* StreamPrintServiceFactory.java --
+ Copyright (C) 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.print;
+
+import gnu.classpath.ServiceFactory;
+
+import java.io.OutputStream;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Iterator;
+
+/**
+ * <code>StreamPrintServiceFactory</code> provides a static method to lookup
+ * registered factories to construct <code>StreamPrintService</code> instances.
+ * <p>
+ * <code>StreamPrintService</code> are used to print into a provided output
+ * stream in the document format provided by the stream print service
+ * implementation.
+ * </p><p>
+ * Implementations are located and loaded automatically through the SPI JAR
+ * file specification. Therefore implementation classes must provide a default
+ * constructor for instantiation.
+ * </p>
+ *
+ * @author Wolfgang Baer (WBaer at gmx.de)
+ */
+public abstract class StreamPrintServiceFactory
+{
+ /**
+ * Default public constructor.
+ * Used for automatic loading and instantiation through
+ * the SPI jar file specification.
+ */
+ public StreamPrintServiceFactory()
+ {
+ // nothing to do
+ }
+
+ /**
+ * Searches for matching factories providing stream print services that
+ * support the printing of documents with the given document flavor into
+ * the given output mime type.
+ *
+ * @param flavor the document flavor needed, <code>null</code> doesn't
+ * constrain the lookup result.
+ * @param outputMimeType the mime type needed, <code>null</code> doesn't
+ * constrain the lookup result.
+ *
+ * @return The matching <code>StreamPrintServiceFactory</code> instances.
+ */
+ public static StreamPrintServiceFactory[] lookupStreamPrintServiceFactories(
+ DocFlavor flavor, String outputMimeType)
+ {
+ HashSet set = new HashSet();
+
+ Iterator it =
+ ServiceFactory.lookupProviders(StreamPrintServiceFactory.class);
+
+ while (it.hasNext())
+ {
+ StreamPrintServiceFactory tmp = (StreamPrintServiceFactory) it.next();
+ if (tmp.getOutputFormat().equals(outputMimeType)
+ && Arrays.asList(tmp.getSupportedDocFlavors()).contains(flavor))
+ set.add(tmp);
+ }
+
+ StreamPrintServiceFactory[] tmp = new StreamPrintServiceFactory[set.size()];
+ return (StreamPrintServiceFactory[]) set.toArray(tmp);
+ }
+
+ /**
+ * Returns the output format supported by this factory.
+ *
+ * @return The mime type of the output format as string representation.
+ */
+ public abstract String getOutputFormat();
+
+ /**
+ * Returns the document flavors this factory supports as flavors
+ * for the input documents.
+ *
+ * @return The array of supported document flavors.
+ */
+ public abstract DocFlavor[] getSupportedDocFlavors();
+
+ /**
+ * Constructs a <code>StreamPrintService</code> which directs its output
+ * the given output stream.
+ *
+ * @param out the output stream for the produced document.
+ * @return The constructed stream print service.
+ */
+ public abstract StreamPrintService getPrintService(OutputStream out);
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/print/URIException.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/print/URIException.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/print/URIException.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/print/URIException.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,88 @@
+/* URIException.java --
+ Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.print;
+
+import java.net.URI;
+
+/**
+ * <code>URIException</code> specifies methods a specific subclass of
+ * {@link javax.print.PrintException} may implement to provide further
+ * informations of printing errors if URI problems are involved.
+ * <p>
+ * There exists no <code>PrintException</code> class implementing this
+ * interface. Providing this extension in <code>PrintException</code>
+ * subclasses is left to the concrete print service implementation.
+ * </p>
+ *
+ * @author Michael Koch (konqueror at gmx.de)
+ */
+public interface URIException
+{
+ /**
+ * Indicates that the provided <code>URI</code> is not accessible.
+ */
+ int URIInaccessible = 1;
+
+ /**
+ * Indicates any other problem which is not defined by
+ * the other reason constants.
+ */
+ int URIOtherProblem = -1;
+
+ /**
+ * Indicates that the print service does not support a specific
+ * uri scheme (for example the ftp scheme).
+ */
+ int URISchemeNotSupported = 2;
+
+ /**
+ * Returns the reason for this exception as
+ * predefined constants in this interface.
+ *
+ * @return The reason.
+ */
+ int getReason();
+
+ /**
+ * Returns the unsupported <code>URI</code> which caused this exception.
+ *
+ * @return The unsupported <code>URI</code>.
+ */
+ URI getUnsupportedURI();
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/Attribute.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/Attribute.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/Attribute.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/Attribute.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,66 @@
+/* Attribute.java --
+ Copyright (C) 2002, 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.print.attribute;
+
+import java.io.Serializable;
+
+/**
+ * Base interface of every printing attribute of the Java Print Service API.
+ *
+ * @author Michael Koch (konqueror at gmx.de)
+ */
+public interface Attribute extends Serializable
+{
+ /**
+ * Returns the category of the printing attribute which is the specific
+ * attribute class implementing this interface.
+ *
+ * @return The concrete {@link Class} instance of the attribute class.
+ */
+ Class getCategory ();
+
+ /**
+ * Returns the descriptive name of the attribute category.
+ *
+ * Implementations of the <code>Attribute</code> interfaces providing equal
+ * category values have to return equal name values.
+ *
+ * @return The name of the attribute category.
+ */
+ String getName ();
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/AttributeSet.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/AttributeSet.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/AttributeSet.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/AttributeSet.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,196 @@
+/* AttributeSet.java --
+ Copyright (C) 2002, 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.print.attribute;
+
+/**
+ * <code>AttributeSet</code> is the top-level interface for sets of printing
+ * attributes in the Java Print Service API.
+ * <p>
+ * There are no duplicate values allowed in an attribute set and there is
+ * at most one attribute object contained per category type. Based on the
+ * {@link java.util.Map} interface the values of attribute sets are objects
+ * of type {@link javax.print.attribute.Attribute} and the entries are the
+ * categories as {@link java.lang.Class} instances.
+ * </p>
+ * <p>
+ * The following specialized types of <code>AttributeSet</code> are available:
+ * <ul>
+ * <li>{@link javax.print.attribute.DocAttributeSet}</li>
+ * <li>{@link javax.print.attribute.PrintRequestAttributeSet}</li>
+ * <li>{@link javax.print.attribute.PrintJobAttributeSet}</li>
+ * <li>{@link javax.print.attribute.PrintServiceAttributeSet}</li>
+ * </ul>
+ * </p>
+ * <p>
+ * Attribute sets may be unmodifiable depending on the context of usage. If
+ * used as read-only attribute set modifying operations throw an
+ * {@link javax.print.attribute.UnmodifiableSetException}.
+ * </p>
+ * <p>
+ * The Java Print Service API provides implementation classes for the existing
+ * attribute set interfaces but applications may use their own implementations.
+ * </p>
+ *
+ * @author Michael Koch (konqueror at gmx.de)
+ */
+public interface AttributeSet
+{
+ /**
+ * Adds the specified attribute value to this attribute set
+ * if it is not already present.
+ *
+ * This operation removes any existing attribute of the same category
+ * before adding the given attribute to the set.
+ *
+ * @param attribute the attribute to add.
+ * @return <code>true</code> if the set is changed, false otherwise.
+ * @throws NullPointerException if the attribute is <code>null</code>.
+ * @throws UnmodifiableSetException if the set does not support modification.
+ */
+ boolean add (Attribute attribute);
+
+ /**
+ * Adds all of the elements in the specified set to this attribute set.
+ *
+ * @param attributes the set of attributes to add.
+ * @return <code>true</code> if the set is changed, false otherwise.
+ * @throws UnmodifiableSetException if the set does not support modification.
+ *
+ * @see #add(Attribute)
+ */
+ boolean addAll (AttributeSet attributes);
+
+ /**
+ * Removes all attributes from this attribute set.
+ *
+ * @throws UnmodifiableSetException if the set does not support modification.
+ */
+ void clear ();
+
+ /**
+ * Checks if this attributes set contains an attribute with the given
+ * category.
+ *
+ * @param category the category to test for.
+ * @return <code>true</code> if an attribute of the category is contained
+ * in the set, <code>false</code> otherwise.
+ */
+ boolean containsKey (Class category);
+
+ /**
+ * Checks if this attribute set contains the given attribute.
+ *
+ * @param attribute the attribute to test for.
+ * @return <code>true</code> if the attribute is contained in the set,
+ * <code>false</code> otherwise.
+ */
+ boolean containsValue (Attribute attribute);
+
+ /**
+ * Tests this set for equality with the given object. <code>true</code> is
+ * returned, if the given object is also of type <code>AttributeSet</code>
+ * and the contained attributes are the same as in this set.
+ *
+ * @param obj the Object to test.
+ * @return <code>true</code> if equal, false otherwise.
+ */
+ boolean equals (Object obj);
+
+ /**
+ * Returns the attribute object contained in this set for the given attribute
+ * category.
+ *
+ * @param category the category of the attribute. A <code>Class</code>
+ * instance of a class implementing the <code>Attribute</code> interface.
+ * @return The attribute for this category or <code>null</code> if no
+ * attribute is contained for the given category.
+ * @throws NullPointerException if category is null.
+ * @throws ClassCastException if category is not implementing
+ * <code>Attribute</code>.
+ */
+ Attribute get (Class category);
+
+ /**
+ * Returns the hashcode value. The hashcode value is the sum of all hashcodes
+ * of the attributes contained in this set.
+ *
+ * @return The hashcode for this attribute set.
+ */
+ int hashCode ();
+
+ /**
+ * Checks if the attribute set is empty.
+ *
+ * @return <code>true</code> if the attribute set is empty, false otherwise.
+ */
+ boolean isEmpty ();
+
+ /**
+ * Removes the given attribute from the set. If the given attribute is <code>null</code>
+ * nothing is done and <code>false</code> is returned.
+ *
+ * @param attribute the attribute to remove.
+ * @return <code>true</code> if removed, false in all other cases.
+ * @throws UnmodifiableSetException if the set does not support modification.
+ */
+ boolean remove (Attribute attribute);
+
+ /**
+ * Removes the attribute entry of the given category from the set. If the given
+ * category is <code>null</code> nothing is done and <code>false</code> is returned.
+ *
+ * @param category the category of the entry to be removed.
+ * @return <code>true</code> if an attribute is removed, false in all other cases.
+ * @throws UnmodifiableSetException if the set does not support modification.
+ */
+ boolean remove (Class category);
+
+ /**
+ * Returns the number of elements in this attribute set.
+ *
+ * @return The number of elements.
+ */
+ int size ();
+
+ /**
+ * Returns the content of the attribute set as an array
+ *
+ * @return An array of attributes.
+ */
+ Attribute[] toArray ();
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/AttributeSetUtilities.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/AttributeSetUtilities.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/AttributeSetUtilities.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/AttributeSetUtilities.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,495 @@
+/* AttributeSetUtilities.java --
+ Copyright (C) 2003, 2004, 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.print.attribute;
+
+import java.io.Serializable;
+
+/**
+ * <code>AttributeSetUtilities</code> provides static methods for working
+ * with <code>AttributeSet</code>s.
+ * <p>
+ * For every type of an attribute set available in the Java Print Service API
+ * are methods provided to get an unmodifiable view of an attribute set.
+ * This unmodifiable view provides a read-only version of the attribute
+ * set which throws {@link javax.print.attribute.UnmodifiableSetException}s
+ * if state changing methods are invoked.
+ * </p>
+ * <p>
+ * Methods for getting a synchronized view of an attribute set are also
+ * available. This view provides synchronized (thread safe) access to the
+ * underlying wrapped attribute set.
+ * </P>
+ * <p>
+ * Three static methods for the implementation of own AttributeSets
+ * are provided, which verify that:
+ * <ul>
+ * <li>the given object is an attribute of the given interface.</li>
+ * <li>the category of given attribute is equals to a given category.</li>
+ * <li>the given object is a <code>Class</code> that implements the given
+ * interface name.</li>
+ * </ul>
+ *
+ */
+public final class AttributeSetUtilities
+{
+ /**
+ * This class isn't intended to be instantiated.
+ */
+ private AttributeSetUtilities()
+ {
+ // only static methods
+ }
+
+ private static class UnmodifiableAttributeSet
+ implements AttributeSet, Serializable
+ {
+ private AttributeSet attrset;
+
+ public UnmodifiableAttributeSet(AttributeSet attributeSet)
+ {
+ if (attributeSet == null)
+ throw new NullPointerException("attributeSet may not be null");
+
+ this.attrset = attributeSet;
+ }
+
+ public boolean add(Attribute attribute)
+ {
+ throw new UnmodifiableSetException();
+ }
+
+ public boolean addAll(AttributeSet attributes)
+ {
+ throw new UnmodifiableSetException();
+ }
+
+ public void clear()
+ {
+ throw new UnmodifiableSetException();
+ }
+
+ public boolean containsKey(Class category)
+ {
+ return attrset.containsKey(category);
+ }
+
+ public boolean containsValue(Attribute attribute)
+ {
+ return attrset.containsValue(attribute);
+ }
+
+ public boolean equals(Object obj)
+ {
+ return attrset.equals(obj);
+ }
+
+ public Attribute get(Class interfaceName)
+ {
+ return attrset.get(interfaceName);
+ }
+
+ public int hashCode()
+ {
+ return attrset.hashCode();
+ }
+
+ public boolean isEmpty()
+ {
+ return attrset.isEmpty();
+ }
+
+ public boolean remove(Class category)
+ {
+ throw new UnmodifiableSetException();
+ }
+
+ public boolean remove(Attribute attribute)
+ {
+ throw new UnmodifiableSetException();
+ }
+
+ public int size()
+ {
+ return attrset.size();
+ }
+
+ public Attribute[] toArray()
+ {
+ return attrset.toArray();
+ }
+ }
+
+ private static class UnmodifiableDocAttributeSet
+ extends UnmodifiableAttributeSet
+ implements DocAttributeSet, Serializable
+ {
+ public UnmodifiableDocAttributeSet(DocAttributeSet attributeSet)
+ {
+ super(attributeSet);
+ }
+ }
+
+ private static class UnmodifiablePrintJobAttributeSet
+ extends UnmodifiableAttributeSet
+ implements PrintJobAttributeSet, Serializable
+ {
+ public UnmodifiablePrintJobAttributeSet(PrintJobAttributeSet attributeSet)
+ {
+ super(attributeSet);
+ }
+ }
+
+ private static class UnmodifiablePrintRequestAttributeSet
+ extends UnmodifiableAttributeSet
+ implements PrintRequestAttributeSet, Serializable
+ {
+ public UnmodifiablePrintRequestAttributeSet(PrintRequestAttributeSet attributeSet)
+ {
+ super(attributeSet);
+ }
+ }
+
+ private static class UnmodifiablePrintServiceAttributeSet
+ extends UnmodifiableAttributeSet
+ implements PrintServiceAttributeSet, Serializable
+ {
+ public UnmodifiablePrintServiceAttributeSet(PrintServiceAttributeSet attributeSet)
+ {
+ super(attributeSet);
+ }
+ }
+
+ private static class SynchronizedAttributeSet
+ implements AttributeSet, Serializable
+ {
+ private AttributeSet attrset;
+
+ public SynchronizedAttributeSet(AttributeSet attributeSet)
+ {
+ if (attributeSet == null)
+ throw new NullPointerException("attributeSet may not be null");
+
+ attrset = attributeSet;
+ }
+
+ public synchronized boolean add(Attribute attribute)
+ {
+ return attrset.add(attribute);
+ }
+
+ public synchronized boolean addAll(AttributeSet attributes)
+ {
+ return attrset.addAll(attributes);
+ }
+
+ public synchronized void clear()
+ {
+ attrset.clear();
+ }
+
+ public synchronized boolean containsKey(Class category)
+ {
+ return attrset.containsKey(category);
+ }
+
+ public synchronized boolean containsValue(Attribute attribute)
+ {
+ return attrset.containsValue(attribute);
+ }
+
+ public synchronized boolean equals(Object obj)
+ {
+ return attrset.equals(obj);
+ }
+
+ public synchronized Attribute get(Class interfaceName)
+ {
+ return attrset.get(interfaceName);
+ }
+
+ public synchronized int hashCode()
+ {
+ return attrset.hashCode();
+ }
+
+ public synchronized boolean isEmpty()
+ {
+ return attrset.isEmpty();
+ }
+
+ public synchronized boolean remove(Class category)
+ {
+ return attrset.remove(category);
+ }
+
+ public synchronized boolean remove(Attribute attribute)
+ {
+ return attrset.remove(attribute);
+ }
+
+ public synchronized int size()
+ {
+ return attrset.size();
+ }
+
+ public synchronized Attribute[] toArray()
+ {
+ return attrset.toArray();
+ }
+ }
+
+ private static class SynchronizedDocAttributeSet
+ extends SynchronizedAttributeSet
+ implements DocAttributeSet, Serializable
+ {
+ public SynchronizedDocAttributeSet(DocAttributeSet attributeSet)
+ {
+ super(attributeSet);
+ }
+ }
+
+ private static class SynchronizedPrintJobAttributeSet
+ extends SynchronizedAttributeSet
+ implements PrintJobAttributeSet, Serializable
+ {
+ public SynchronizedPrintJobAttributeSet(PrintJobAttributeSet attributeSet)
+ {
+ super(attributeSet);
+ }
+ }
+
+ private static class SynchronizedPrintRequestAttributeSet
+ extends SynchronizedAttributeSet
+ implements PrintRequestAttributeSet, Serializable
+ {
+ public SynchronizedPrintRequestAttributeSet(PrintRequestAttributeSet attributeSet)
+ {
+ super(attributeSet);
+ }
+ }
+
+ private static class SynchronizedPrintServiceAttributeSet
+ extends SynchronizedAttributeSet
+ implements PrintServiceAttributeSet, Serializable
+ {
+ public SynchronizedPrintServiceAttributeSet(PrintServiceAttributeSet attributeSet)
+ {
+ super(attributeSet);
+ }
+ }
+
+ /**
+ * Returns a synchronized view of the given attribute set.
+ *
+ * @param attributeSet the set to synchronize.
+ * @return The sychronized attribute set.
+ */
+ public static AttributeSet synchronizedView(AttributeSet attributeSet)
+ {
+ return new SynchronizedAttributeSet(attributeSet);
+ }
+
+ /**
+ * Returns a synchronized view of the given attribute set.
+ *
+ * @param attributeSet the set to synchronize.
+ * @return The sychronized attribute set.
+ */
+ public static DocAttributeSet synchronizedView(DocAttributeSet attributeSet)
+ {
+ return new SynchronizedDocAttributeSet(attributeSet);
+ }
+
+ /**
+ * Returns a synchronized view of the given attribute set.
+ *
+ * @param attributeSet the set to synchronize.
+ * @return The sychronized attribute set.
+ */
+ public static PrintJobAttributeSet synchronizedView(PrintJobAttributeSet attributeSet)
+ {
+ return new SynchronizedPrintJobAttributeSet(attributeSet);
+ }
+
+ /**
+ * Returns a synchronized view of the given attribute set.
+ *
+ * @param attributeSet the set to synchronize.
+ * @return The sychronized attribute set.
+ */
+ public static PrintRequestAttributeSet synchronizedView(PrintRequestAttributeSet attributeSet)
+ {
+ return new SynchronizedPrintRequestAttributeSet(attributeSet);
+ }
+
+ /**
+ * Returns a synchronized view of the given attribute set.
+ *
+ * @param attributeSet the set to synchronize.
+ * @return The sychronized attribute set.
+ */
+ public static PrintServiceAttributeSet synchronizedView(PrintServiceAttributeSet attributeSet)
+ {
+ return new SynchronizedPrintServiceAttributeSet(attributeSet);
+ }
+
+ /**
+ * Returns an unmodifiable view of the given attribute set.
+ *
+ * @param attributeSet the set to make unmodifiable.
+ * @return The unmodifiable attribute set.
+ */
+ public static AttributeSet unmodifiableView(AttributeSet attributeSet)
+ {
+ return new UnmodifiableAttributeSet(attributeSet);
+ }
+
+ /**
+ * Returns an unmodifiable view of the given attribute set.
+ *
+ * @param attributeSet the set to make unmodifiable.
+ * @return The unmodifiable attribute set.
+ */
+ public static DocAttributeSet unmodifiableView(DocAttributeSet attributeSet)
+ {
+ return new UnmodifiableDocAttributeSet(attributeSet);
+ }
+
+ /**
+ * Returns an unmodifiable view of the given attribute set.
+ *
+ * @param attributeSet the set to make unmodifiable.
+ * @return The unmodifiable attribute set.
+ */
+ public static PrintJobAttributeSet unmodifiableView(PrintJobAttributeSet attributeSet)
+ {
+ return new UnmodifiablePrintJobAttributeSet(attributeSet);
+ }
+
+ /**
+ * Returns an unmodifiable view of the given attribute set.
+ *
+ * @param attributeSet the set to make unmodifiable.
+ * @return The unmodifiable attribute set.
+ */
+ public static PrintRequestAttributeSet unmodifiableView(PrintRequestAttributeSet attributeSet)
+ {
+ return new UnmodifiablePrintRequestAttributeSet(attributeSet);
+ }
+
+ /**
+ * Returns an unmodifiable view of the given attribute set.
+ *
+ * @param attributeSet the set to make unmodifiable.
+ * @return The unmodifiable attribute set.
+ */
+ public static PrintServiceAttributeSet unmodifiableView(PrintServiceAttributeSet attributeSet)
+ {
+ return new UnmodifiablePrintServiceAttributeSet(attributeSet);
+ }
+
+ /**
+ * Verifies that the given object is a <code>Class</code> that
+ * implements the given interface name and returns it casted.
+ *
+ * @param object the object to test.
+ * @param interfaceName the <code>Class</code> to verify against.
+ * @return object casted to <code>Class</code>
+ *
+ * @exception ClassCastException if object is not a <code>Class</code>
+ * that implements interfaceName
+ * @exception NullPointerException if object is null
+ */
+ public static Class verifyAttributeCategory(Object object,
+ Class interfaceName)
+ {
+ if (object == null)
+ throw new NullPointerException("object may not be null");
+
+ Class clazz = (Class) object;
+
+ if (interfaceName.isAssignableFrom(clazz))
+ return clazz;
+
+ throw new ClassCastException();
+ }
+
+ /**
+ * Verifies that the given object is an attribute of the given interface.
+ * and returns it casted to the interface type.
+ *
+ * @param object the object to test.
+ * @param interfaceName the <code>Class</code> to verify against.
+ * @return the object casted to <code>Attribute</code>
+ *
+ * @exception ClassCastException if object is no instance of interfaceName.
+ * @exception NullPointerException if object is null
+ */
+ public static Attribute verifyAttributeValue(Object object,
+ Class interfaceName)
+ {
+ if (object == null)
+ throw new NullPointerException("object may not be null");
+
+ if (interfaceName.isInstance(object))
+ return (Attribute) object;
+
+ throw new ClassCastException();
+ }
+
+ /**
+ * Verifies that the category of attribute is equals to the given category
+ * class.
+ *
+ * @param category the category to test.
+ * @param attribute the attribute to verify.
+ *
+ * @exception IllegalArgumentException if the categories are not equal
+ * @exception NullPointerException if category is null
+ */
+ public static void verifyCategoryForValue(Class category,
+ Attribute attribute)
+ {
+ if (category == null || attribute == null)
+ throw new NullPointerException("category or attribute may not be null");
+
+ if (!category.equals(attribute.getCategory()))
+ throw new IllegalArgumentException
+ ("category of attribute not equal to category");
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/DateTimeSyntax.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/DateTimeSyntax.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/DateTimeSyntax.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/DateTimeSyntax.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,115 @@
+/* DateTimeSyntax.java --
+ Copyright (C) 2003, 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.print.attribute;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * <code>DateTimeSyntax</code> is the abstract base class of all attribute
+ * classes having a date and a time as value.
+ *
+ * @author Michael Koch (konqueror at gmx.de)
+ */
+public abstract class DateTimeSyntax implements Cloneable, Serializable
+{
+ private static final long serialVersionUID = -1400819079791208582L;
+
+ private Date value;
+
+ /**
+ * Creates a <code>DateTimeSyntax</code> with a given value.
+ *
+ * @param value the date for this syntax
+ *
+ * @exception NullPointerException if value is null
+ */
+ protected DateTimeSyntax(Date value)
+ {
+ if (value == null)
+ throw new NullPointerException("value may not be null");
+
+ this.value = value;
+ }
+
+ /**
+ * Returns the date value of this object.
+ *
+ * @return The date value.
+ */
+ public Date getValue()
+ {
+ return value;
+ }
+
+ /**
+ * Tests if the given object is equal to this one.
+ *
+ * @param obj the object to test
+ *
+ * @return <code>true</code> if both objects are equal,
+ * <code>false</code> otherwise.
+ */
+ public boolean equals(Object obj)
+ {
+ if (! (obj instanceof DateTimeSyntax))
+ return false;
+
+ return value.equals(((DateTimeSyntax) obj).getValue());
+ }
+
+ /**
+ * Returns the hashcode for this object.
+ *
+ * @return The hashcode.
+ */
+ public int hashCode()
+ {
+ return value.hashCode();
+ }
+
+ /**
+ * Returns the string representation for this object.
+ *
+ * @return The string representation.
+ */
+ public String toString()
+ {
+ return value.toString();
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/DocAttribute.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/DocAttribute.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/DocAttribute.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/DocAttribute.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,60 @@
+/* DocAttribute.java --
+ Copyright (C) 2003, 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.print.attribute;
+
+/**
+ * Marker interface for all attribute classes describing attributes of
+ * a {@link javax.print.Doc} object.
+ * <p>
+ * Instances of implementing attribute classes may be collected in a
+ * {@link javax.print.attribute.DocAttributeSet}.
+ * </p><p>
+ * Attributes attached to a {@link javax.print.Doc} instance specify how the
+ * data should be printed.
+ * For example {@link javax.print.attribute.standard.Chromaticity} can be
+ * used to specify that a doc should be printed in color or monochrome.
+ * </p>
+ *
+ * @see javax.print.attribute.DocAttributeSet
+ *
+ * @author Michael Koch (konqueror at gmx.de)
+ */
+public interface DocAttribute extends Attribute
+{
+ // Marker interface
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/DocAttributeSet.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/DocAttributeSet.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/DocAttributeSet.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/DocAttributeSet.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,82 @@
+/* DocAttributeSet.java --
+ Copyright (C) 2003, 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.print.attribute;
+
+/**
+ * <code>DocAttributeSet</code> specifies an attribute set which only
+ * allows printing attributes of type
+ * {@link javax.print.attribute.DocAttribute}.
+ * <p>
+ * The methods {@link #add(Attribute)} and {@link #addAll(AttributeSet)} are
+ * respecified in this interface to indicate that only
+ * <code>DocAttribute</code> instances are allowed in this set.
+ * </p>
+ *
+ * @author Michael Koch (konqueror at gmx.de)
+ */
+public interface DocAttributeSet extends AttributeSet
+{
+ /**
+ * Adds the specified attribute value to this attribute set
+ * if it is not already present.
+ *
+ * This operation removes any existing attribute of the same category
+ * before adding the given attribute.
+ *
+ * @param attribute the attribute to add.
+ * @return <code>true</code> if the set is changed, false otherwise.
+ * @throws ClassCastException if attribute is not of type
+ * <code>DocAttribute</code>.
+ * @throws NullPointerException if the attribute is <code>null</code>.
+ * @throws UnmodifiableSetException if the set does not support modification.
+ */
+ boolean add (Attribute attribute);
+
+ /**
+ * Adds all of the elements in the specified set to this attribute set.
+ *
+ * @param attributes the set of attributes to add.
+ * @return <code>true</code> if the set is changed, false otherwise.
+ * @throws ClassCastException if one of the attributes is not of type
+ * <code>DocAttribute</code>.
+ * @throws UnmodifiableSetException if the set does not support modification.
+ *
+ * @see #add(Attribute)
+ */
+ boolean addAll (AttributeSet attributes);
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/EnumSyntax.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/EnumSyntax.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/EnumSyntax.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/EnumSyntax.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,242 @@
+/* EnumSyntax.java --
+ Copyright (C) 2003, 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.print.attribute;
+
+import java.io.InvalidObjectException;
+import java.io.ObjectStreamException;
+import java.io.Serializable;
+
+/**
+ * <code>EnumSyntax</code> is the abstract base class of all enumeration
+ * classes in the Java Print Service API.
+ * <p>
+ * Every enumeration class which extends from EnumSyntax provides several
+ * enumeration objects as singletons of its class.
+ * </p>
+ * <p>
+ * Notes for implementing subclasses:
+ * <ul>
+ * <li>
+ * The values of all enumeration singelton instances have to be in a
+ * sequence which may start at any value. See: {@link #getOffset()}
+ * </li>
+ * <li>
+ * Subclasses have to override {@link #getEnumValueTable()} and should
+ * override {@link #getStringTable()} for correct serialization.
+ * </li>
+ * </ul>
+ * </p>
+ * Example:
+ * <pre>
+ * public class PrinterState extends EnumSyntax
+ * {
+ * public static final PrinterState IDLE = new PrinterState(1);
+ * public static final PrinterState PROCESSING = new PrinterState(2);
+ * public static final PrinterState STOPPED = new PrinterState(3);
+ *
+ * protected PrinterState(int value)
+ * {
+ * super(value);
+ * }
+ *
+ * // Overridden because values start not at zero !
+ * protected int getOffset()
+ * {
+ * return 1;
+ * }
+ *
+ * private static final String[] stringTable = { "idle", "processing",
+ * "stopped" };
+ *
+ * protected String[] getStringTable()
+ * {
+ * return stringTable;
+ * }
+ *
+ * private static final PrinterState[] enumValueTable = { IDLE,
+ * PROCESSING, STOPPED};
+ *
+ * protected EnumSyntax[] getEnumValueTable()
+ * {
+ * return enumValueTable;
+ * }
+ * }
+ * </pre>
+ *
+ * @author Michael Koch (konqueror at gmx.de)
+ * @author Wolfgang Baer (WBaer at gmx.de)
+ */
+public abstract class EnumSyntax implements Cloneable, Serializable
+{
+ private static final long serialVersionUID = -2739521845085831642L;
+
+ private int value;
+
+ /**
+ * Creates a <code>EnumSyntax</code> object.
+ *
+ * @param value the value to set.
+ */
+ protected EnumSyntax(int value)
+ {
+ this.value = value;
+ }
+
+ /**
+ * Returns the value of this enumeration object.
+ *
+ * @return The value.
+ */
+ public int getValue()
+ {
+ return value;
+ }
+
+ /**
+ * Clones this object.
+ *
+ * @return A clone of this object.
+ */
+ public Object clone()
+ {
+ try
+ {
+ return super.clone();
+ }
+ catch (CloneNotSupportedException e)
+ {
+ // Cannot happen as we implement java.lang.Cloneable.
+ return null;
+ }
+ }
+
+ /**
+ * Returns the hashcode for this object.
+ * The hashcode is the value of this enumeration object.
+ *
+ * @return The hashcode.
+ */
+ public int hashCode()
+ {
+ return value;
+ }
+
+ /**
+ * Returns the string representation for this object.
+ * The string value from <code>getStringTable()</code> method is returned
+ * if subclasses override this method. Otherwise the value of this object
+ * as a string is returned.
+ *
+ * @return The string representation.
+ */
+ public String toString()
+ {
+ int index = value - getOffset();
+ String[] table = getStringTable();
+
+ if (table != null
+ && index >= 0
+ && index < table.length)
+ return table[index];
+
+ return "" + value;
+ }
+
+ /**
+ * Returns a table with the enumeration values represented as strings
+ * for this object.
+ *
+ * The default implementation just returns null. Subclasses should
+ * override this method.
+ *
+ * @return The enumeration values as strings.
+ */
+ protected String[] getStringTable()
+ {
+ return null;
+ }
+
+ /**
+ * Needed for singelton semantics during deserialisation.
+ *
+ * Subclasses must not override this class. Subclasses have to override
+ * <code>getEnumValueTable()</code> and should override
+ * <code>getStringTable()</code> for correct serialization.
+ *
+ * @return The Object at index <code>value - getOffset()</code>
+ * in getEnumValueTable.
+ * @throws ObjectStreamException if getEnumValueTable() returns null.
+ */
+ protected Object readResolve() throws ObjectStreamException
+ {
+ EnumSyntax[] table = getEnumValueTable();
+ if (table == null)
+ throw new InvalidObjectException("Null enumeration value table "
+ + "for class "
+ + this.getClass().toString());
+
+ return table[value - getOffset()];
+ }
+
+ /**
+ * Returns a table with the enumeration values for this object.
+ *
+ * The default implementation just returns null. Subclasses have to
+ * to override this method for serialization.
+ *
+ * @return The enumeration values.
+ */
+ protected EnumSyntax[] getEnumValueTable()
+ {
+ return null;
+ }
+
+ /**
+ * Returns the lowest used value by the enumerations of this class.
+ *
+ * The default implementation returns 0. This is enough if enumerations
+ * start with a zero value. Otherwise subclasses need to override this
+ * method for serialization and return the lowest value they use.
+ * .
+ * @return The lowest used value used.
+ */
+ protected int getOffset()
+ {
+ return 0;
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/HashAttributeSet.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/HashAttributeSet.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/HashAttributeSet.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/HashAttributeSet.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,419 @@
+/* HashAttributeSet.java --
+ Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.print.attribute;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Iterator;
+
+/**
+ * <code>HashAttributeSet</code> provides an implementation of
+ * {@link javax.print.attribute.AttributeSet}.
+ */
+public class HashAttributeSet implements AttributeSet, Serializable
+{
+ private static final long serialVersionUID = 5311560590283707917L;
+
+ private Class myInterface;
+ private transient HashMap attributeMap = new HashMap();
+
+ /**
+ * Creates an empty <code>HashAttributeSet</code> object.
+ */
+ public HashAttributeSet()
+ {
+ this(Attribute.class);
+ }
+
+ /**
+ * Creates a <code>HashAttributeSet</code> object with the given
+ * attribute in it.
+ *
+ * @param attribute the attribute to put into the set
+ *
+ * @exception NullPointerException if attribute is null
+ */
+ public HashAttributeSet(Attribute attribute)
+ {
+ this(attribute, Attribute.class);
+ }
+
+ /**
+ * Creates a <code>HashAttributeSet</code> object with the given
+ * attributes in it.
+ *
+ * @param attributes the array of attributes to put into the set. If
+ * <code>null</code> an empty set is created.
+ *
+ * @exception NullPointerException if one of the attributes of the given
+ * array is null.
+ */
+ public HashAttributeSet(Attribute[] attributes)
+ {
+ this(attributes, Attribute.class);
+ }
+
+ /**
+ * Creates a <code>HashAttributeSet</code> object with attributes
+ * of the given attributes set in it.
+ *
+ * @param attributes the attributes set to put into the set. If
+ * <code>null</code> an empty set is created.
+ */
+ public HashAttributeSet(AttributeSet attributes)
+ {
+ this(attributes, Attribute.class);
+ }
+
+ /**
+ * Creates an empty <code>HashAttributeSet</code> object.
+ *
+ * @param interfaceName the interface that all members must implement
+ *
+ * @exception NullPointerException if interfaceName is null
+ */
+ protected HashAttributeSet(Class interfaceName)
+ {
+ if (interfaceName == null)
+ throw new NullPointerException("interfaceName may not be null");
+
+ myInterface = interfaceName;
+ }
+
+ /**
+ * Creates a <code>HashAttributeSet</code> object with the given
+ * attribute in it.
+ *
+ * @param attribute the attribute to put into the set.
+ * @param interfaceName the interface that all members must implement.
+ *
+ * @exception ClassCastException if attribute is not an interface of
+ * interfaceName
+ * @exception NullPointerException if attribute or interfaceName is null
+ */
+ protected HashAttributeSet(Attribute attribute, Class interfaceName)
+ {
+ this(interfaceName);
+
+ if (attribute == null)
+ throw new NullPointerException();
+
+ addInternal(attribute, interfaceName);
+ }
+
+ /**
+ * Creates a <code>HashAttributeSet</code> object with the given
+ * attributes in it.
+ *
+ * @param attributes the array of attributes to put into the set. If
+ * <code>null</code> an empty set is created.
+ * @param interfaceName the interface that all members must implement.
+ *
+ * @exception ClassCastException if any element of attributes is not an
+ * interface of interfaceName
+ * @exception NullPointerException if attributes or interfaceName is null
+ */
+ protected HashAttributeSet(Attribute[] attributes, Class interfaceName)
+ {
+ this(interfaceName);
+
+ if (attributes != null)
+ {
+ for (int index = 0; index < attributes.length; index++)
+ addInternal(attributes[index], interfaceName);
+ }
+ }
+
+ /**
+ * Creates a <code>HashAttributeSet</code> object with attributes
+ * of the given attributes set in it.
+ *
+ * @param attributes the attributes set to put into the set. If
+ * <code>null</code> an empty set is created.
+ * @param interfaceName the interface that all members must implement.
+ *
+ * @exception ClassCastException if any element of attributes is not an
+ * interface of interfaceName
+ */
+ protected HashAttributeSet(AttributeSet attributes, Class interfaceName)
+ {
+ this(interfaceName);
+
+ if (attributes != null)
+ addAllInternal(attributes, interfaceName);
+ }
+
+ /**
+ * Adds the specified attribute value to this attribute set
+ * if it is not already present.
+ *
+ * This operation removes any existing attribute of the same category
+ * before adding the given attribute to the set.
+ *
+ * @param attribute the attribute to add.
+ * @return <code>true</code> if the set is changed, false otherwise.
+ * @throws NullPointerException if the attribute is <code>null</code>.
+ * @throws UnmodifiableSetException if the set does not support modification.
+ */
+ public boolean add(Attribute attribute)
+ {
+ return addInternal(attribute, myInterface);
+ }
+
+ private boolean addInternal(Attribute attribute, Class interfaceName)
+ {
+ if (attribute == null)
+ throw new NullPointerException("attribute may not be null");
+
+ AttributeSetUtilities.verifyAttributeCategory(interfaceName,
+ myInterface);
+
+ Object old = attributeMap.put
+ (attribute.getCategory(), AttributeSetUtilities.verifyAttributeValue
+ (attribute, interfaceName));
+ return !attribute.equals(old);
+ }
+
+ /**
+ * Adds all of the elements in the specified set to this attribute set.
+ *
+ * @param attributes the set of attributes to add.
+ * @return <code>true</code> if the set is changed, false otherwise.
+ * @throws UnmodifiableSetException if the set does not support modification.
+ *
+ * @see #add(Attribute)
+ */
+ public boolean addAll(AttributeSet attributes)
+ {
+ return addAllInternal(attributes, myInterface);
+ }
+
+ private boolean addAllInternal(AttributeSet attributes, Class interfaceName)
+ {
+ boolean modified = false;
+ Attribute[] array = attributes.toArray();
+
+ for (int index = 0; index < array.length; index++)
+ if (addInternal(array[index], interfaceName))
+ modified = true;
+
+ return modified;
+ }
+
+ /**
+ * Removes all attributes from this attribute set.
+ *
+ * @throws UnmodifiableSetException if the set does not support modification.
+ */
+ public void clear()
+ {
+ attributeMap.clear();
+ }
+
+ /**
+ * Checks if this attributes set contains an attribute with the given
+ * category.
+ *
+ * @param category the category to test for.
+ * @return <code>true</code> if an attribute of the category is contained
+ * in the set, <code>false</code> otherwise.
+ */
+ public boolean containsKey(Class category)
+ {
+ return attributeMap.containsKey(category);
+ }
+
+ /**
+ * Checks if this attribute set contains the given attribute.
+ *
+ * @param attribute the attribute to test for.
+ * @return <code>true</code> if the attribute is contained in the set,
+ * <code>false</code> otherwise.
+ */
+ public boolean containsValue(Attribute attribute)
+ {
+ return attributeMap.containsValue(attribute);
+ }
+
+ /**
+ * Tests this set for equality with the given object. <code>true</code> is
+ * returned, if the given object is also of type <code>AttributeSet</code>
+ * and the contained attributes are the same as in this set.
+ *
+ * @param obj the Object to test.
+ * @return <code>true</code> if equal, false otherwise.
+ */
+ public boolean equals(Object obj)
+ {
+ if (! (obj instanceof HashAttributeSet))
+ return false;
+
+ return attributeMap.equals(((HashAttributeSet) obj).attributeMap);
+ }
+
+ /**
+ * Returns the attribute object contained in this set for the given attribute
+ * category.
+ *
+ * @param category the category of the attribute. A <code>Class</code>
+ * instance of a class implementing the <code>Attribute</code> interface.
+ * @return The attribute for this category or <code>null</code> if no
+ * attribute is contained for the given category.
+ * @throws NullPointerException if category is null.
+ * @throws ClassCastException if category is not implementing
+ * <code>Attribute</code>.
+ */
+ public Attribute get(Class category)
+ {
+ if (category == null)
+ throw new NullPointerException("category may not be null");
+
+ return (Attribute) attributeMap.get(category);
+ }
+
+ /**
+ * Returns the hashcode value. The hashcode value is the sum of all hashcodes
+ * of the attributes contained in this set.
+ *
+ * @return The hashcode for this attribute set.
+ */
+ public int hashCode()
+ {
+ int hashcode = 0;
+ Iterator it = attributeMap.values().iterator();
+ while (it.hasNext())
+ hashcode = hashcode + it.next().hashCode();
+
+ return hashcode;
+ }
+
+ /**
+ * Checks if the attribute set is empty.
+ *
+ * @return <code>true</code> if the attribute set is empty, false otherwise.
+ */
+ public boolean isEmpty()
+ {
+ return attributeMap.isEmpty();
+ }
+
+ /**
+ * Removes the given attribute from the set. If the given attribute is <code>null</code>
+ * nothing is done and <code>false</code> is returned.
+ *
+ * @param attribute the attribute to remove.
+ * @return <code>true</code> if removed, false in all other cases.
+ * @throws UnmodifiableSetException if the set does not support modification.
+ */
+ public boolean remove(Attribute attribute)
+ {
+ if (attribute == null)
+ return false;
+
+ return attributeMap.remove(attribute.getCategory()) != null;
+ }
+
+ /**
+ * Removes the attribute entry of the given category from the set. If the given
+ * category is <code>null</code> nothing is done and <code>false</code> is returned.
+ *
+ * @param category the category of the entry to be removed.
+ * @return <code>true</code> if an attribute is removed, false in all other cases.
+ * @throws UnmodifiableSetException if the set does not support modification.
+ */
+ public boolean remove(Class category)
+ {
+ if (category == null)
+ return false;
+
+ return attributeMap.remove(category) != null;
+ }
+
+ /**
+ * Returns the number of elements in this attribute set.
+ *
+ * @return The number of elements.
+ */
+ public int size()
+ {
+ return attributeMap.size();
+ }
+
+ /**
+ * Returns the content of the attribute set as an array
+ *
+ * @return An array of attributes.
+ */
+ public Attribute[] toArray()
+ {
+ int index = 0;
+ Iterator it = attributeMap.values().iterator();
+ Attribute[] array = new Attribute[size()];
+
+ while (it.hasNext())
+ {
+ array[index] = (Attribute) it.next();
+ index++;
+ }
+
+ return array;
+ }
+
+ // Implemented as specified in serialized form
+ private void readObject(ObjectInputStream s)
+ throws ClassNotFoundException, IOException
+ {
+ myInterface = (Class) s.readObject();
+ int size = s.readInt();
+ attributeMap = new HashMap(size);
+ for (int i=0; i < size; i++)
+ add((Attribute) s.readObject());
+ }
+
+ private void writeObject(ObjectOutputStream s) throws IOException
+ {
+ s.writeObject(myInterface);
+ s.writeInt(size());
+ Iterator it = attributeMap.values().iterator();
+ while (it.hasNext())
+ s.writeObject(it.next());
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/HashDocAttributeSet.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/HashDocAttributeSet.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/HashDocAttributeSet.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/HashDocAttributeSet.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,100 @@
+/* HashDocAttributeSet.java --
+ Copyright (C) 2003, 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.print.attribute;
+
+import java.io.Serializable;
+
+/**
+ * <code>HashDocAttributeSet</code> provides an implementation of
+ * {@link javax.print.attribute.DocAttributeSet}.
+ */
+public class HashDocAttributeSet extends HashAttributeSet
+ implements DocAttributeSet, Serializable
+{
+ private static final long serialVersionUID = -1128534486061432528L;
+
+ /**
+ * Creates an empty <code>HashDocAttributeSet</code> object.
+ */
+ public HashDocAttributeSet()
+ {
+ super(DocAttribute.class);
+ }
+
+ /**
+ * Creates a <code>HashDocAttributeSet</code> object with the given
+ * attribute in it.
+ *
+ * @param attribute the attribute to put into the attribute set
+ *
+ * @exception NullPointerException if attribute is null
+ */
+ public HashDocAttributeSet(DocAttribute attribute)
+ {
+ super(attribute, DocAttribute.class);
+ }
+
+ /**
+ * Creates a <code>HashDocAttributeSet</code> object with the given
+ * attributes in it.
+ *
+ * @param attributes the array of attributes to put into the set. If
+ * <code>null</code> an empty set is created.
+ *
+ * @exception NullPointerException if one of the attributes of the given
+ * array is null.
+ */
+ public HashDocAttributeSet(DocAttribute[] attributes)
+ {
+ super(attributes, DocAttribute.class);
+ }
+
+ /**
+ * Creates a <code>HashDocAttributeSet</code> object with the attributes
+ * of the given attributes set in it.
+ *
+ * @param attributes the attributes set to put into the set. If
+ * <code>null</code> an empty set is created.
+ * @exception ClassCastException if any element of attributes is not
+ * an instance of <code>DocAttribute</code>
+ */
+ public HashDocAttributeSet(DocAttributeSet attributes)
+ {
+ super(attributes, DocAttribute.class);
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/HashPrintJobAttributeSet.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/HashPrintJobAttributeSet.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/HashPrintJobAttributeSet.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/HashPrintJobAttributeSet.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,100 @@
+/* HashPrintJobAttributeSet.java --
+ Copyright (C) 2003, 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.print.attribute;
+
+import java.io.Serializable;
+
+/**
+ * <code>HashPrintJobAttributeSet</code> provides an implementation of
+ * {@link javax.print.attribute.PrintJobAttributeSet}.
+ */
+public class HashPrintJobAttributeSet extends HashAttributeSet
+ implements Serializable, PrintJobAttributeSet
+{
+ private static final long serialVersionUID = -4204473656070350348L;
+
+ /**
+ * Creates an empty <code>HashPrintJobAttributeSet</code> object.
+ */
+ public HashPrintJobAttributeSet()
+ {
+ super(PrintJobAttribute.class);
+ }
+
+ /**
+ * Creates a <code>HashPrintJobAttributeSet</code> object with the given
+ * attribute in it.
+ *
+ * @param attribute the attribute to put into the attribute set
+ *
+ * @exception NullPointerException if attribute is null
+ */
+ public HashPrintJobAttributeSet(PrintJobAttribute attribute)
+ {
+ super(attribute, PrintJobAttribute.class);
+ }
+
+ /**
+ * Creates a <code>HashPrintJobAttributeSet</code> object with the given
+ * attributes in it.
+ *
+ * @param attributes the array of attributes to put into the set. If
+ * <code>null</code> an empty set is created.
+ *
+ * @exception NullPointerException if one of the attributes of the given
+ * array is null.
+ */
+ public HashPrintJobAttributeSet(PrintJobAttribute[] attributes)
+ {
+ super(attributes, PrintJobAttribute.class);
+ }
+
+ /**
+ * Creates a <code>HashPrintJobAttributeSet</code> object with the attributes
+ * of the given attributes set in it.
+ *
+ * @param attributes the attributes set to put into the set. If
+ * <code>null</code> an empty set is created.
+ * @exception ClassCastException if any element of attributes is not
+ * an instance of <code>PrintJobAttribute</code>
+ */
+ public HashPrintJobAttributeSet(PrintJobAttributeSet attributes)
+ {
+ super(attributes, PrintJobAttribute.class);
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/HashPrintRequestAttributeSet.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/HashPrintRequestAttributeSet.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/HashPrintRequestAttributeSet.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/HashPrintRequestAttributeSet.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,100 @@
+/* HashPrintRequestAttributeSet.java --
+ Copyright (C) 2003, 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.print.attribute;
+
+import java.io.Serializable;
+
+/**
+ * <code>HashPrintRequestAttributeSet</code> provides an implementation of
+ * {@link javax.print.attribute.PrintRequestAttributeSet}.
+ */
+public class HashPrintRequestAttributeSet extends HashAttributeSet
+ implements Serializable, PrintRequestAttributeSet
+{
+ private static final long serialVersionUID = 2364756266107751933L;
+
+ /**
+ * Creates an empty <code>HashPrintRequestAttributeSet</code> object.
+ */
+ public HashPrintRequestAttributeSet()
+ {
+ super(PrintRequestAttribute.class);
+ }
+
+ /**
+ * Creates a <code>HashPrintRequestAttributeSet</code> object with the given
+ * attribute in it.
+ *
+ * @param attribute the attribute to put into the attribute set
+ *
+ * @exception NullPointerException if attribute is null
+ */
+ public HashPrintRequestAttributeSet(PrintRequestAttribute attribute)
+ {
+ super(attribute, PrintRequestAttribute.class);
+ }
+
+ /**
+ * Creates a <code>HashPrintRequestAttributeSet</code> object with the given
+ * attributes in it.
+ *
+ * @param attributes the array of attributes to put into the set. If
+ * <code>null</code> an empty set is created.
+ *
+ * @exception NullPointerException if one of the attributes of the given
+ * array is null.
+ */
+ public HashPrintRequestAttributeSet(PrintRequestAttribute[] attributes)
+ {
+ super(attributes, PrintRequestAttribute.class);
+ }
+
+ /**
+ * Creates a <code>HashPrintRequestAttributeSet</code> object with the attributes
+ * of the given attributes set in it.
+ *
+ * @param attributes the attributes set to put into the set. If
+ * <code>null</code> an empty set is created.
+ * @exception ClassCastException if any element of attributes is not
+ * an instance of <code>PrintRequestAttribute</code>
+ */
+ public HashPrintRequestAttributeSet(PrintRequestAttributeSet attributes)
+ {
+ super(attributes, PrintRequestAttribute.class);
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/HashPrintServiceAttributeSet.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/HashPrintServiceAttributeSet.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/HashPrintServiceAttributeSet.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/HashPrintServiceAttributeSet.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,100 @@
+/* HashPrintServiceAttributeSet.java --
+ Copyright (C) 2003, 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.print.attribute;
+
+import java.io.Serializable;
+
+/**
+ * <code>HashPrintServiceAttributeSet</code> provides an implementation of
+ * {@link javax.print.attribute.PrintServiceAttributeSet}.
+ */
+public class HashPrintServiceAttributeSet extends HashAttributeSet
+ implements Serializable, PrintServiceAttributeSet
+{
+ private static final long serialVersionUID = 6642904616179203070L;
+
+ /**
+ * Creates an empty <code>HashPrintServiceAttributeSet</code> object.
+ */
+ public HashPrintServiceAttributeSet()
+ {
+ super(PrintServiceAttribute.class);
+ }
+
+ /**
+ * Creates a <code>HashPrintServiceAttributeSet</code> object with the given
+ * attribute in it.
+ *
+ * @param attribute the attribute to put into the attribute set
+ *
+ * @exception NullPointerException if attribute is null
+ */
+ public HashPrintServiceAttributeSet(PrintServiceAttribute attribute)
+ {
+ super(attribute, PrintServiceAttribute.class);
+ }
+
+ /**
+ * Creates a <code>HashPrintServiceAttributeSet</code> object with the given
+ * attributes in it.
+ *
+ * @param attributes the array of attributes to put into the set. If
+ * <code>null</code> an empty set is created.
+ *
+ * @exception NullPointerException if one of the attributes of the given
+ * array is null.
+ */
+ public HashPrintServiceAttributeSet(PrintServiceAttribute[] attributes)
+ {
+ super(attributes, PrintServiceAttribute.class);
+ }
+
+ /**
+ * Creates a <code>HashPrintServiceAttributeSet</code> object with the attributes
+ * of the given attributes set in it.
+ *
+ * @param attributes the attributes set to put into the set. If
+ * <code>null</code> an empty set is created.
+ * @exception ClassCastException if any element of attributes is not
+ * an instance of <code>PrintServiceAttribute</code>
+ */
+ public HashPrintServiceAttributeSet(PrintServiceAttributeSet attributes)
+ {
+ super(attributes, PrintServiceAttribute.class);
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/IntegerSyntax.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/IntegerSyntax.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/IntegerSyntax.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/IntegerSyntax.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,127 @@
+/* IntegerSyntax.java --
+ Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.print.attribute;
+
+import java.io.Serializable;
+
+/**
+ * <code>IntegerSyntax</code> is the abstract base class of all attribute
+ * classes having an integer as value.
+ *
+ * @author Michael Koch (konqueror at gmx.de)
+ */
+public abstract class IntegerSyntax implements Cloneable, Serializable
+{
+ private int value;
+
+ /**
+ * Creates a <code>IntegerSyntax</code> with the given value.
+ *
+ * @param value the integer to set
+ */
+ protected IntegerSyntax(int value)
+ {
+ this.value = value;
+ }
+
+ /**
+ * Creates a <code>IntegerSyntax</code> with the given integer value
+ * and checks if the value lies inside the given bounds..
+ *
+ * @param value the integer to set
+ * @param lowerBound the lower bound for the value
+ * @param upperBound the upper bound for the value
+ *
+ * @exception IllegalArgumentException if value < lowerBound
+ * or value > upperBound
+ */
+ protected IntegerSyntax(int value, int lowerBound, int upperBound)
+ {
+ if (value < lowerBound
+ || value > upperBound)
+ throw new IllegalArgumentException("value not in range");
+
+ this.value = value;
+ }
+
+ /**
+ * Returns the value of this object.
+ *
+ * @return The integer value.
+ */
+ public int getValue()
+ {
+ return value;
+ }
+
+ /**
+ * Tests if the given object is equal to this object.
+ *
+ * @param obj the object to test
+ *
+ * @return <code>true</code> if both objects are equal,
+ * <code>false</code> otherwise.
+ */
+ public boolean equals(Object obj)
+ {
+ if(! (obj instanceof IntegerSyntax))
+ return false;
+
+ return value == ((IntegerSyntax) obj).getValue();
+ }
+
+ /**
+ * Returns the hashcode for this object.
+ *
+ * @return The hashcode.
+ */
+ public int hashCode()
+ {
+ return value;
+ }
+
+ /**
+ * Returns the string representation for this object.
+ *
+ * @return The string representation.
+ */
+ public String toString()
+ {
+ return "" + value;
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/PrintJobAttribute.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/PrintJobAttribute.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/PrintJobAttribute.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/PrintJobAttribute.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,60 @@
+/* PrintJobAttribute.java --
+ Copyright (C) 2003, 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.print.attribute;
+
+/**
+ * Marker interface for all attribute classes describing attributes or the
+ * status of a ({@link javax.print.DocPrintJob} object.
+ * <p>
+ * Instances of implementing attribute classes may be collected in a
+ * {@link javax.print.attribute.PrintJobAttributeSet}.
+ * </p><p>
+ * A print service uses attributes of this type to inform about the status
+ * of a print job.
+ * For example {@link javax.print.attribute.standard.DateTimeAtProcessing}
+ * is used to report at which date and time a job has started processing.
+ * </p>
+ *
+ * @see javax.print.attribute.PrintJobAttributeSet
+ *
+ * @author Michael Koch (konqueror at gmx.de)
+ */
+public interface PrintJobAttribute extends Attribute
+{
+ // Marker interface
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/PrintJobAttributeSet.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/PrintJobAttributeSet.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/PrintJobAttributeSet.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/PrintJobAttributeSet.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,82 @@
+/* PrintJobAttributeSet.java --
+ Copyright (C) 2003, 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.print.attribute;
+
+/**
+ * <code>PrintJobAttributeSet</code> specifies an attribute set which only
+ * allows printing attributes of type
+ * {@link javax.print.attribute.PrintJobAttribute}.
+ * <p>
+ * The methods {@link #add(Attribute)} and {@link #addAll(AttributeSet)} are
+ * respecified in this interface to indicate that only
+ * <code>PrintJobAttribute</code> instances are allowed in this set.
+ * </p>
+ *
+ * @author Michael Koch (konqueror at gmx.de)
+ */
+public interface PrintJobAttributeSet extends AttributeSet
+{
+ /**
+ * Adds the specified attribute value to this attribute set
+ * if it is not already present.
+ *
+ * This operation removes any existing attribute of the same category
+ * before adding the given attribute.
+ *
+ * @param attribute the attribute to add.
+ * @return <code>true</code> if the set is changed, false otherwise.
+ * @throws ClassCastException if attribute is not of type
+ * <code>PrintJobAttribute</code>.
+ * @throws NullPointerException if the attribute is <code>null</code>.
+ * @throws UnmodifiableSetException if the set does not support modification.
+ */
+ boolean add (Attribute attribute);
+
+ /**
+ * Adds all of the elements in the specified set to this attribute set.
+ *
+ * @param attributes the set of attributes to add.
+ * @return <code>true</code> if the set is changed, false otherwise.
+ * @throws ClassCastException if one of the attributes is not of type
+ * <code>PrintJobAttribute</code>.
+ * @throws UnmodifiableSetException if the set does not support modification.
+ *
+ * @see #add(Attribute)
+ */
+ boolean addAll (AttributeSet attributes);
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/PrintRequestAttribute.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/PrintRequestAttribute.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/PrintRequestAttribute.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/PrintRequestAttribute.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,55 @@
+/* PrintRequestAttribute.java --
+ Copyright (C) 2003, 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.print.attribute;
+
+/**
+ * Marker interface for all attribute classes which specify a requested
+ * attribute of {@link javax.print.DocPrintJob} object.
+ * <p>
+ * Instances of implementing attribute classes may be collected in a
+ * {@link javax.print.attribute.PrintRequestAttributeSet}.
+ * </p>
+ *
+ * @see javax.print.attribute.PrintRequestAttributeSet
+ *
+ * @author Michael Koch (konqueror at gmx.de)
+ */
+public interface PrintRequestAttribute extends Attribute
+{
+ // Marker interface
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/PrintRequestAttributeSet.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/PrintRequestAttributeSet.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/PrintRequestAttributeSet.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/PrintRequestAttributeSet.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,82 @@
+/* PrintRequestAttributeSet.java --
+ Copyright (C) 2002, 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.print.attribute;
+
+/**
+ * <code>PrintRequestAttributeSet</code> specifies an attribute set which only
+ * allows printing attributes of type
+ * {@link javax.print.attribute.PrintRequestAttribute}.
+ * <p>
+ * The methods {@link #add(Attribute)} and {@link #addAll(AttributeSet)} are
+ * respecified in this interface to indicate that only
+ * <code>PrintRequestAttribute</code> instances are allowed in this set.
+ * </p>
+ *
+ * @author Michael Koch (konqueror at gmx.de)
+ */
+public interface PrintRequestAttributeSet extends AttributeSet
+{
+ /**
+ * Adds the specified attribute value to this attribute set
+ * if it is not already present.
+ *
+ * This operation removes any existing attribute of the same category
+ * before adding the given attribute.
+ *
+ * @param attribute the attribute to add.
+ * @return <code>true</code> if the set is changed, false otherwise.
+ * @throws ClassCastException if attribute is not of type
+ * <code>PrintRequestAttribute</code>.
+ * @throws NullPointerException if the attribute is <code>null</code>.
+ * @throws UnmodifiableSetException if the set does not support modification.
+ */
+ boolean add (Attribute attribute);
+
+ /**
+ * Adds all of the elements in the specified set to this attribute set.
+ *
+ * @param attributes the set of attributes to add.
+ * @return <code>true</code> if the set is changed, false otherwise.
+ * @throws ClassCastException if one of the attributes is not of type
+ * <code>PrintRequestAttribute</code>.
+ * @throws UnmodifiableSetException if the set does not support modification.
+ *
+ * @see #add(Attribute)
+ */
+ boolean addAll (AttributeSet attributes);
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/PrintServiceAttribute.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/PrintServiceAttribute.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/PrintServiceAttribute.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/PrintServiceAttribute.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,60 @@
+/* PrintServiceAttribute.java --
+ Copyright (C) 2003, 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.print.attribute;
+
+/**
+ * Marker interface for all attribute classes describing parameters
+ * or the status of a {@link javax.print.PrintService}.
+ * <p>
+ * Instances of implementing attribute classes may be collected in a
+ * {@link javax.print.attribute.PrintServiceAttributeSet}.
+ * </p><p>
+ * A print service uses attributes of this type to inform about the status
+ * or the specific capabilities of itself.
+ * For example {@link javax.print.attribute.standard.PagesPerMinute} is used
+ * to specify the average printable pages per minute of the print service.
+ * </p>
+ *
+ * @see javax.print.attribute.PrintServiceAttributeSet
+ *
+ * @author Michael Koch (konqueror at gmx.de)
+ */
+public interface PrintServiceAttribute extends Attribute
+{
+ // Marker interface
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/PrintServiceAttributeSet.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/PrintServiceAttributeSet.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/PrintServiceAttributeSet.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/PrintServiceAttributeSet.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,82 @@
+/* PrintServiceAttributeSet.java --
+ Copyright (C) 2003, 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.print.attribute;
+
+/**
+ * <code>PrintServiceAttributeSet</code> specifies an attribute set which only
+ * allows printing attributes of type
+ * {@link javax.print.attribute.PrintServiceAttribute}.
+ * <p>
+ * The methods {@link #add(Attribute)} and {@link #addAll(AttributeSet)} are
+ * respecified in this interface to indicate that only
+ * <code>PrintServiceAttribute</code> instances are allowed in this set.
+ * </p>
+ *
+ * @author Michael Koch (konqueror at gmx.de)
+ */
+public interface PrintServiceAttributeSet extends AttributeSet
+{
+ /**
+ * Adds the specified attribute value to this attribute set
+ * if it is not already present.
+ *
+ * This operation removes any existing attribute of the same category
+ * before adding the given attribute.
+ *
+ * @param attribute the attribute to add.
+ * @return <code>true</code> if the set is changed, false otherwise.
+ * @throws ClassCastException if attribute is not of type
+ * <code>PrintServiceAttribute</code>.
+ * @throws NullPointerException if the attribute is <code>null</code>.
+ * @throws UnmodifiableSetException if the set does not support modification.
+ */
+ boolean add (Attribute attribute);
+
+ /**
+ * Adds all of the elements in the specified set to this attribute set.
+ *
+ * @param attributes the set of attributes to add.
+ * @return <code>true</code> if the set is changed, false otherwise.
+ * @throws ClassCastException if one of the attributes is not of type
+ * <code>PrintServiceAttribute</code>.
+ * @throws UnmodifiableSetException if the set does not support modification.
+ *
+ * @see #add(Attribute)
+ */
+ boolean addAll (AttributeSet attributes);
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/ResolutionSyntax.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/ResolutionSyntax.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/ResolutionSyntax.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/ResolutionSyntax.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,271 @@
+/* ResolutionSyntax.java --
+ Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.print.attribute;
+
+import java.io.Serializable;
+
+/**
+ * <code>ResolutionSyntax</code> is the abstract base class of all attribute
+ * classes which provide a resolution as value (e.g. printer resolution).
+ * <p>
+ * A <code>ResolutionSyntax</code> instance consists of two integer values
+ * describing the resolution in feed and cross feed direction. The units of
+ * the given values is determined by two defined constants:
+ * <ul>
+ * <li>DPCM - dots per centimeter</li>
+ * <li>DPI - dots per inch</li>
+ * </ul>
+ * </p>
+ * <p>
+ * A resolutions attribute is constructed by two values for the resolution and
+ * one of the two constants defining the actual units of the given values.
+ * </p>
+ * <p>
+ * There are different methods provided to return the resolution values in
+ * either of the both units and to compare if a resolution is less than or
+ * equal to a given other resolution attribute.
+ * </p>
+ * <p>
+ * <b>Internal storage:</b><br>
+ * The resolutions are stored internally as dots per 100 inches (dphi). The
+ * values of the provided constants for dots per inch (value 100) and dots
+ * per centimeter (value 254) are used as conversion factors to the internal
+ * storage units. To get the internal dphi values a multiplication of a given
+ * resolution value with its units constant value is needed. Retrieving the
+ * resolution for specific units is done by dividing the internal stored
+ * value through the units constant value. Clients are therefore able to
+ * provide their own resolution units by supplying other conversion factors.
+ * Subclasses of <code>ResolutionSyntax</code> have access to the internal
+ * resolution values through the protected methods
+ * {@link #getCrossFeedResolutionDphi()} and {@link #getFeedResolutionDphi()}.
+ * </p>
+ *
+ * @author Michael Koch (konqueror at gmx.de)
+ */
+public abstract class ResolutionSyntax
+ implements Cloneable, Serializable
+{
+ private static final long serialVersionUID = 2706743076526672017L;
+
+ /**
+ * Constant for units of dots per centimeter.
+ */
+ public static final int DPCM = 254;
+
+ /**
+ * Constant for units of dots per inch
+ */
+ public static final int DPI = 100;
+
+ private int crossFeedResolution;
+ private int feedResolution;
+
+ /**
+ * Creates a <code>ResolutionSyntax</code> object with the given arguments.
+ *
+ * @param crossFeedResolution the cross feed resolution
+ * @param feedResolution the feed resolution
+ * @param units the unit to use (e.g. {@link #DPCM} or {@link #DPI})
+ *
+ * @exception IllegalArgumentException if preconditions fail
+ */
+ public ResolutionSyntax(int crossFeedResolution, int feedResolution,
+ int units)
+ {
+ if (crossFeedResolution < 1
+ || feedResolution < 1
+ || units < 1)
+ throw new IllegalArgumentException("no argument may be less than 1");
+
+ this.crossFeedResolution = crossFeedResolution * units;
+ this.feedResolution = feedResolution * units;
+ }
+
+ /**
+ * Tests if the given object is equal to this object.
+ *
+ * @param obj the object to test
+ *
+ * @return <code>true</code> if both objects are equal,
+ * <code>false</code> otherwise.
+ */
+ public boolean equals(Object obj)
+ {
+ if(! (obj instanceof ResolutionSyntax))
+ return false;
+
+ ResolutionSyntax tmp = (ResolutionSyntax) obj;
+
+ return (crossFeedResolution == tmp.getCrossFeedResolutionDphi()
+ && feedResolution == tmp.getFeedResolutionDphi());
+ }
+
+ /**
+ * Returns the cross feed resolution for the given units.
+ *
+ * @param units the unit to use (e.g. {@link #DPCM} or {@link #DPI})
+ * @return The resolution for the given units.
+ *
+ * @exception IllegalArgumentException if units < 1
+ */
+ public int getCrossFeedResolution(int units)
+ {
+ if (units < 1)
+ throw new IllegalArgumentException("units may not be less then 1");
+
+ return crossFeedResolution / units;
+ }
+
+ /**
+ * Returns the raw cross feed resolution in dots per 100 inches.
+ *
+ * @return The raw resolution.
+ */
+ protected int getCrossFeedResolutionDphi()
+ {
+ return crossFeedResolution;
+ }
+
+ /**
+ * Returns the feed resolution for the given units.
+ *
+ * @param units the unit to use (e.g. {@link #DPCM} or {@link #DPI})
+ * @return The resolution for the given units.
+ *
+ * @exception IllegalArgumentException if units < 1
+ */
+ public int getFeedResolution(int units)
+ {
+ if (units < 1)
+ throw new IllegalArgumentException("units may not be less then 1");
+
+ return feedResolution / units;
+ }
+
+ /**
+ * Returns the raw feed resolution in dots per 100 inches.
+ *
+ * @return The raw resolution.
+ */
+ protected int getFeedResolutionDphi()
+ {
+ return feedResolution;
+ }
+
+ /**
+ * Returns the resolution as two field array. Index 0 is the cross feed
+ * resolution, index 1 the feed resolution.
+ *
+ * @param units the units to use
+ *
+ * @return The array with the resolutions.
+ */
+ public int[] getResolution(int units)
+ {
+ int[] resolution = new int[2];
+ resolution[0] = getCrossFeedResolution(units);
+ resolution[1] = getFeedResolution(units);
+ return resolution;
+ }
+
+ /**
+ * Returns the hashcode for this object.
+ *
+ * @return The hashcode.
+ */
+ public int hashCode()
+ {
+ return crossFeedResolution + feedResolution;
+ }
+
+ /**
+ * Checks if the given resolution attribute is a lower or equal
+ * to this resolution object.
+ *
+ * @param other the resolution to check against
+ *
+ * @return <code>true</code> if other resolution attribute describes
+ * a lower or equal resolution, <code>false</code> otherwise.
+ */
+ public boolean lessThanOrEquals(ResolutionSyntax other)
+ {
+ if (other == null)
+ throw new NullPointerException("other may not be null");
+
+ return (crossFeedResolution <= other.getCrossFeedResolutionDphi()
+ && feedResolution <= other.getFeedResolutionDphi());
+ }
+
+ /**
+ * Returns the string representation for this object.
+ * <p>
+ * The returned string is in the form "CxF dphi" with C standing
+ * for the cross feed and F for the feed direction resolution.
+ * Units used are dots per 100 inches (dphi).
+ * </p>
+ * @return The string representation.
+ */
+ public String toString()
+ {
+ return toString(1, "dphi");
+ }
+
+ /**
+ * Returns the string representation for this object.
+ * <p>
+ * The returned string is in the form "CxF U" with C standing
+ * for the cross feed and F for the feed direction resolution.
+ * U denotes the units name if one is supplied.
+ * </p>
+ *
+ * @param units the units to use
+ * @param unitsName the name of the units. If <code>null</code>
+ * it is ommitted from the string representation.
+ *
+ * @return The string representation.
+ */
+ public String toString(int units, String unitsName)
+ {
+ if (unitsName == null)
+ return getCrossFeedResolution(units) + "x" + getFeedResolution(units);
+
+ return ("" + getCrossFeedResolution(units)
+ + "x" + getFeedResolution(units)
+ + " " + unitsName);
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/SetOfIntegerSyntax.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/SetOfIntegerSyntax.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/SetOfIntegerSyntax.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/SetOfIntegerSyntax.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,436 @@
+/* SetOfIntegerSyntax.java --
+ Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.print.attribute;
+
+import java.io.Serializable;
+import java.text.CharacterIterator;
+import java.text.StringCharacterIterator;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Comparator;
+
+/**
+ * <code>SetOfIntegerSyntax</code> is the abstract base class of all attribute
+ * classes which provide a set of non-negative integers as value (e.g. the
+ * page ranges to print) represented as single values or ranges of values.
+ * <p>
+ * A <code>SetOfIntegerSyntax</code> instance consists of an integer array of
+ * ranges. Ranges may have the same lower and upper bound representing a single
+ * integer value. Ranges with a lower bound greater than the upper bound are
+ * null ranges and discarded. Ranges may overlap in their values. In no case
+ * negative integers are allowed.
+ * </p>
+ * <p>
+ * There are several constructors available:
+ * <ul>
+ * <li><code>SetOfIntegerSyntax(int member)</code><br>
+ * Constructor for an instance with only one integer value.
+ * </li><br>
+ * <li><code>SetOfIntegerSyntax(int lowerBound, int upperBound)</code><br>
+ * Constructor for an instance with one range of integer values.
+ * </li><br>
+ * <li><code>SetOfIntegerSyntax(int[][] members)</code><br>
+ * Flexible constructor for an instance with several single integer values
+ * and/or several ranges of integer values. The allowed array form is an
+ * array of integer arrays of length one or two. Examples are:
+ * <code>int[0][]</code> for empty set of integers, <code>int[][] {{1}}</code>
+ * , <code>int[][] {{1,5}}</code>, <code>int[][] {{1,5},{7,9}}</code>,
+ * <code>int[][] {{3,7},{19}}</code>.
+ * </li><br>
+ * <li><code>SetOfIntegerSyntax(String s)</code><br>
+ * Flexible constructor for an instance with several single integer values
+ * and/or several ranges of integer values. The allowed String instance have
+ * to be a String with comma separated ranges of integer values or single
+ * values. Ranges are represented by two integer with a hypen (-) or colon (:)
+ * between the lower and upper bound value. Whitespace characters are ignored.
+ * Examples are: <code>""</code> for an empty set of integers,
+ * <code>"1"</code>, <code>"1-5"</code>, <code>"1-5,7-9"</code>,
+ * <code>"3-7,19"</code> and <code>"1:2,4"</code>.
+ * </li>
+ * </ul>
+ * </p>
+ * <p>
+ * <b>Internal storage:</b><br>
+ * The set of integers are stored internally in a normalized array form.
+ * In the normalized array form the set of integer ranges are represented
+ * in as few ranges as possible and overlapping ranges are merged. The ranges
+ * are always represented as an integer array of length two with ranges
+ * stored in {lower bound, upper bound} form. The ranges are stored in
+ * ascending order, without any null ranges.
+ * </p>
+ * @author Michael Koch (konqueror at gmx.de)
+ */
+public abstract class SetOfIntegerSyntax
+ implements Cloneable, Serializable
+{
+ private static final long serialVersionUID = 3666874174847632203L;
+
+ private int[][] members;
+
+ private static int[][] normalize(int[][] values, int size)
+ {
+ // Sort into increasing order. First the first index is
+ // compared, then the second.
+ Arrays.sort(values, 0, size, new Comparator()
+ {
+ public int compare(Object o1, Object o2)
+ {
+ int[] v1 = (int[]) o1;
+ int[] v2 = (int[]) o2;
+ if (v1[0] == v2[0])
+ return v1[1] - v2[1];
+ return v1[0] - v2[0];
+ }
+ });
+
+ // Now coalesce overlapping ranges.
+ int outIndex = 0;
+ for (int i = 0; i < size; ++i)
+ {
+ // Note that we compare with values[i][1]+1, since
+ // we can coalesce {0,1} with {2,x}.
+ int save = i;
+ while (i + 1 < size && values[i + 1][0] <= values[i][1] + 1)
+ {
+ values[i][1] = Math.max(values[i][1], values[i + 1][1]);
+ ++i;
+ }
+ values[outIndex++] = values[save];
+ }
+
+ int[][] result = new int[outIndex][];
+ System.arraycopy(values, 0, result, 0, outIndex);
+
+ return result;
+ }
+
+ /**
+ * Creates a <code>SetOfIntegerSyntax</code> object.
+ *
+ * @param member the member value
+ *
+ * @exception IllegalArgumentException if member is < 0
+ */
+ protected SetOfIntegerSyntax(int member)
+ {
+ if (member < 0)
+ throw new IllegalArgumentException("member may not be less than 0");
+
+ this.members = new int[][]{{member, member}};
+ }
+
+ /**
+ * Creates a <code>SetOfIntegerSyntax</code> object.
+ *
+ * @param members the members to use in this set. If
+ * <code>null</code> an empty set is created.
+ *
+ * @exception IllegalArgumentException if any element is invalid
+ * @exception NullPointerException if any element of members is null
+ */
+ protected SetOfIntegerSyntax(int[][] members)
+ {
+ int[][] newMembers;
+ int outIndex = 0;
+ if (members == null)
+ newMembers = new int[0][];
+ else
+ {
+ newMembers = new int[members.length][];
+ for (int index = 0; index < members.length; index++)
+ {
+ int lower;
+ int upper;
+
+ if (members[index].length == 1)
+ {
+ lower = members[index][0];
+ upper = members[index][0];
+ }
+ else if (members[index].length == 2)
+ {
+ lower = members[index][0];
+ upper = members[index][1];
+ }
+ else
+ throw new IllegalArgumentException("invalid member element");
+
+ // We only want to reject non-null ranges where lower<0.
+ if (lower <= upper && lower < 0)
+ throw new IllegalArgumentException("invalid member element");
+
+ if (lower <= upper)
+ {
+ int[] range = new int[2];
+ range[0] = lower;
+ range[1] = upper;
+ newMembers[outIndex++] = range;
+ }
+ }
+ }
+
+ this.members = normalize(newMembers, outIndex);
+ }
+
+ private boolean skipWhitespace(StringCharacterIterator i)
+ {
+ while (Character.isWhitespace(i.current()))
+ i.next();
+ return i.current() == CharacterIterator.DONE;
+ }
+
+ private boolean skipNumber(StringCharacterIterator i)
+ {
+ boolean readAny = false;
+ while (Character.isDigit(i.current()))
+ {
+ readAny = true;
+ i.next();
+ }
+ return readAny;
+ }
+
+ /**
+ * Creates a <code>SetOfIntegerSyntax</code> object.
+ *
+ * @param s the members to use in this set in string form. If
+ * <code>null</code> an empty set is created.
+ *
+ * @exception IllegalArgumentException if any element is invalid
+ */
+ protected SetOfIntegerSyntax(String s)
+ {
+ if (s == null)
+ this.members = normalize(new int[0][], 0);
+ else
+ {
+ ArrayList vals = new ArrayList();
+
+ StringCharacterIterator it = new StringCharacterIterator(s);
+
+ while (true)
+ {
+ // Skip whitespace.
+ if (skipWhitespace(it))
+ break;
+
+ // Parse integer.
+ int index = it.getIndex();
+ if (! skipNumber(it))
+ throw new IllegalArgumentException();
+ int[] item = new int[2];
+ item[0] = Integer.parseInt(s.substring(index, it.getIndex()));
+
+ if (! skipWhitespace(it))
+ {
+ char c = it.current();
+ if (c == ':' || c == '-')
+ {
+ it.next();
+ if (skipWhitespace(it))
+ throw new IllegalArgumentException();
+ index = it.getIndex();
+ if (! skipNumber(it))
+ throw new IllegalArgumentException();
+ item[1] = Integer.parseInt(s.substring(index, it.getIndex()));
+ }
+ else
+ item[1] = item[0];
+ }
+ else
+ item[1] = item[0];
+
+ if (item[0] <= item[1])
+ vals.add(item);
+
+ if (skipWhitespace(it))
+ break;
+ if (it.current() != ',')
+ throw new IllegalArgumentException();
+ it.next();
+ }
+
+ members = normalize((int[][]) vals.toArray(new int[0][]), vals.size());
+ }
+ }
+
+ /**
+ * Creates a <code>SetOfIntegerSyntax</code> object.
+ *
+ * @param lowerBound the lower bound value
+ * @param upperBound the upper bound value
+ *
+ * @exception IllegalArgumentException if lowerBound <= upperbound
+ * and lowerBound < 0
+ */
+ protected SetOfIntegerSyntax(int lowerBound, int upperBound)
+ {
+ // We only want to reject non-null ranges where lower<0.
+ if (lowerBound <= upperBound
+ && lowerBound < 0)
+ throw new IllegalArgumentException();
+
+ members = (lowerBound <= upperBound ? new int[][]{{lowerBound, upperBound}}
+ : new int[0][]);
+ }
+
+ /**
+ * Checks if this set contains the given value.
+ *
+ * @param value the value to test for
+ *
+ * @return true if this set contains value, false otherwise
+ */
+ public boolean contains(int value)
+ {
+ // This only works on a normalized member array.
+ for (int index = 0; index < members.length; index++)
+ {
+ if (value < members[index][0])
+ return false;
+ else if (value <= members[index][1])
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * Checks if this set contains the given value.
+ *
+ * @param value the value to test for
+ *
+ * @return true if this set contains value, false otherwise
+ */
+ public boolean contains(IntegerSyntax value)
+ {
+ return contains(value.getValue());
+ }
+
+ /**
+ * Tests if the given object is equal to this object.
+ *
+ * @param obj the object to test
+ *
+ * @return true if both objects are equal, false otherwise.
+ */
+ public boolean equals(Object obj)
+ {
+ if (! (obj instanceof SetOfIntegerSyntax))
+ return false;
+ SetOfIntegerSyntax other = (SetOfIntegerSyntax) obj;
+ if (other.members.length != members.length)
+ return false;
+ for (int i = 0; i < members.length; ++i)
+ {
+ if (members[i][0] != other.members[i][0]
+ || members[i][1] != other.members[i][1])
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * Returns an array describing the members included in this set.
+ *
+ * @return The members in normalized array form.
+ */
+ public int[][] getMembers()
+ {
+ return (int[][]) members.clone();
+ }
+
+ /**
+ * Returns the hashcode for this object.
+ *
+ * @return The hashcode.
+ */
+ public int hashCode()
+ {
+ int result = 0;
+ for (int i = 0; i < members.length; ++i)
+ result += members[i][0] + members[i][1];
+ return result;
+ }
+
+ /**
+ * Returns the smallest value that is greater than x which is in this set.
+ *
+ * @param x an integer value
+ *
+ * @return The next smallest integer value, or <code>-1</code> if there
+ * is no greater integer in the set.
+ */
+ public int next(int x)
+ {
+ for (int i = 0; i < members.length; ++i)
+ {
+ if (x >= members[i][1])
+ continue;
+ if (x < members[i][0])
+ return members[i][0];
+ // X is in this range.
+ return x + 1;
+ }
+ return -1;
+ }
+
+ /**
+ * Returns the string representation for this object.
+ * The value is a zero length string for an empty set, or a comma seperated
+ * list of ranges and single values in the form <code>"1-2,5-7,10"</code>.
+ *
+ * @return The string representation.
+ */
+ public String toString()
+ {
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0; i < members.length; ++i)
+ {
+ if (i > 0)
+ sb.append(',');
+ sb.append(members[i][0]);
+ if (members[i][0] != members[i][1])
+ {
+ sb.append('-');
+ sb.append(members[i][1]);
+ }
+ }
+ return sb.toString();
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/Size2DSyntax.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/Size2DSyntax.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/Size2DSyntax.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/Size2DSyntax.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,283 @@
+/* Size2DSyntax.java --
+ Copyright (C) 2003, 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.print.attribute;
+
+import java.io.Serializable;
+
+/**
+ * <code>Size2DSyntax</code> is the abstract base class of all attribute
+ * classes which provide a two dimensional size as value (e.g. the size of
+ * a media like Letter or A4).
+ * <p>
+ * A <code>Size2DSyntax</code> instance consists of two integer values
+ * describing the size in the x and y dimension. The units of
+ * the given values is determined by two defined constants:
+ * <ul>
+ * <li>INCH - defines an inch</li>
+ * <li>MM - defines a millimeter</li>
+ * </ul>
+ * </p>
+ * <p>
+ * A size 2D attribute is constructed by two values for the size of the x and
+ * y dimension and the actual units of the given values as defined by the
+ * constants.
+ * </p>
+ * <p>
+ * There are different methods provided to return the size values for the
+ * dimensions in either of the two predefined units or with a given client
+ * supplied units conversion factor.
+ * </p>
+ * <p>
+ * <b>Internal storage:</b><br>
+ * The size of the x,y dimensions are stored internally in micrometers. The
+ * values of the provided constants for inch (value 25400) and millimeters
+ * (value 1000) are used as conversion factors to the internal storage units.
+ * To get the internal micrometers values a multiplication of a given
+ * size value with its units constant value is done. Retrieving the size value
+ * for specific units is done by dividing the internal stored value by the
+ * units constant value. Clients are therefore able to provide their own
+ * size units by supplying other conversion factors.
+ * Subclasses of <code>Size2DSyntax</code> have access to the internal
+ * size values through the protected methods
+ * {@link #getXMicrometers()} and {@link #getYMicrometers()}.
+ * </p>
+ *
+ * @author Michael Koch (konqueror at gmx.de)
+ */
+public abstract class Size2DSyntax implements Cloneable, Serializable
+{
+ /**
+ * Constant for the units of inches.
+ * The actual value is the conversion factor to micrometers.
+ */
+ public static final int INCH = 25400;
+
+ /**
+ * Constant for the units of millimeters.
+ * The actual value is the conversion factor to micrometers.
+ */
+ public static final int MM = 1000;
+
+ /** x size in micrometers. */
+ private int x;
+ /** y size in micrometers. */
+ private int y;
+
+ /**
+ * Creates a <code>Size2DSyntax</code> object with the given arguments.
+ *
+ * @param x the size in x direction
+ * @param y the size in y direction
+ * @param units the units to use for the sizes
+ *
+ * @exception IllegalArgumentException if x or y < 0 or units < 1
+ */
+ protected Size2DSyntax(float x, float y, int units)
+ {
+ if (x < 0.0f || y < 0.0f)
+ throw new IllegalArgumentException("x and/or y may not be less than 0");
+
+ if (units < 1)
+ throw new IllegalArgumentException("units may not be less then 1");
+
+ this.x = (int) (x * units + 0.5f);
+ this.y = (int) (y * units + 0.5f);
+ }
+
+ /**
+ * Creates a <code>Size2DSyntax</code> object with the given arguments.
+ *
+ * @param x the size in x direction
+ * @param y the size in y direction
+ * @param units the units to use for the sizes
+ *
+ * @exception IllegalArgumentException if x or y < 0 or units < 1
+ */
+ protected Size2DSyntax(int x, int y, int units)
+ {
+ if (x < 0 || y < 0)
+ throw new IllegalArgumentException("x and/or y may not be less then 0");
+
+ if (units < 1)
+ throw new IllegalArgumentException("units may not be less then 1");
+
+ this.x = x * units;
+ this.y = y * units;
+ }
+
+ /**
+ * Tests if the given object is equal to this object.
+ *
+ * @param obj the object to test
+ *
+ * @return <code>true</code> if both objects are equal, <code>false</code> otherwise.
+ */
+ public boolean equals(Object obj)
+ {
+ if (! (obj instanceof Size2DSyntax))
+ return false;
+
+ Size2DSyntax tmp = (Size2DSyntax) obj;
+
+ return (x == tmp.getXMicrometers()
+ && y == tmp.getYMicrometers());
+ }
+
+ /**
+ * Returns the size described in this object as a two field array.
+ * Index 0 contains the size in x direction, index 1 the size in
+ * y direction.
+ *
+ * @param units the units to use
+ *
+ * @return The array with the size dimensions.
+ *
+ * @exception IllegalArgumentException if units < 1
+ */
+ public float[] getSize(int units)
+ {
+ float[] size = new float[2];
+ size[0] = getX(units);
+ size[1] = getY(units);
+ return size;
+ }
+
+ /**
+ * Returns the size in x direction.
+ *
+ * @param units the units to use
+ *
+ * @return The size in x direction.
+ *
+ * @exception IllegalArgumentException if units < 1
+ */
+ public float getX(int units)
+ {
+ if (units < 1)
+ throw new IllegalArgumentException("units may not be less then 1");
+
+ return ((float) x) / ((float) units);
+ }
+
+ /**
+ * Returns the size in x direction in mircometers.
+ * To be used by sublcasses that need access to the internal storage value.
+ *
+ * @return The size in x direction in micrometers.
+ */
+ protected int getXMicrometers()
+ {
+ return x;
+ }
+
+ /**
+ * Return the size in y direction.
+ *
+ * @param units the units to use
+ *
+ * @return The size in y direction.
+ *
+ * @exception IllegalArgumentException if units < 1
+ */
+ public float getY(int units)
+ {
+ if (units < 1)
+ throw new IllegalArgumentException("units may not be less then 1");
+
+ return ((float) y) / ((float) units);
+ }
+
+ /**
+ * Returns the size in y direction in mircometers.
+ * To be used by sublcasses that need access to the internal storage value.
+ *
+ * @return The size in y direction in micrometers.
+ */
+ protected int getYMicrometers()
+ {
+ return y;
+ }
+
+ /**
+ * Returns the hashcode for this object.
+ *
+ * @return The hashcode.
+ */
+ public int hashCode()
+ {
+ return x + y;
+ }
+
+ /**
+ * Returns the string representation for this object.
+ * <p>
+ * The returned string is in the form "XxY um" with X standing
+ * for size in x and Y for the size in y direction. The used
+ * micrometers units is indicated by the appended "um" notation.
+ * </p>
+ *
+ * @return The string representation in micrometers.
+ */
+ public String toString()
+ {
+ return getXMicrometers() + "x" + getYMicrometers() + " um";
+ }
+
+ /**
+ * Returns the string representation for this object.
+ * <p>
+ * The returned string is in the form "XxY U" with X standing
+ * for size in x and Y for the size in y direction. U denotes
+ * the units name if one is supplied. The values are given as
+ * floating point values.
+ * </p>
+ *
+ * @param units the units to use
+ * @param unitsName the name of the units. If <code>null</code>
+ * it is ommitted from the string representation.
+ *
+ * @return The string representation.
+ */
+ public String toString(int units, String unitsName)
+ {
+ if (unitsName == null)
+ return getX(units) + "x" + getY(units);
+
+ return getX(units) + "x" + getY(units) + " " + unitsName;
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/SupportedValuesAttribute.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/SupportedValuesAttribute.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/SupportedValuesAttribute.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/SupportedValuesAttribute.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,59 @@
+/* SupportedValuesAttribute.java --
+ Copyright (C) 2003, 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.print.attribute;
+
+/**
+ * Marker interface for all attribute classes specifying the
+ * supported/allowed values for another printing attribute class.
+ * <p>
+ * A {@link javax.print.PrintService} instance for example provides
+ * printing attribute classes implementing this interface to indicate
+ * that a specific attribute type is supported and if the supported values.
+ * </p><p>
+ * E.g. a {@link javax.print.attribute.standard.JobPrioritySupported}
+ * instance indicates that the attribute class
+ * {@link javax.print.attribute.standard.JobPriority} is supported and
+ * provides the number of the possible priority levels.
+ * </p>
+ *
+ * @author Michael Koch (konqueror at gmx.de)
+ */
+public interface SupportedValuesAttribute extends Attribute
+{
+ // Marker interface
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/TextSyntax.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/TextSyntax.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/TextSyntax.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/TextSyntax.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,137 @@
+/* TextSyntax.java --
+ Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.print.attribute;
+
+import java.io.Serializable;
+import java.util.Locale;
+
+/**
+ * <code>TextSyntax</code> is the abstract base class of all attribute
+ * classes which provide a string as value (e.g. the location of the printer).
+ * <p>
+ * A <code>TextSyntax</code> instance consists of a string value and a
+ * locale which indicates the language of the locale of the string.
+ * </p>
+ *
+ * @author Michael Koch (konqueror at gmx.de)
+ */
+public abstract class TextSyntax implements Cloneable, Serializable
+{
+ private static final long serialVersionUID = -8130648736378144102L;
+
+ private String value;
+ private Locale locale;
+
+ /**
+ * Creates a <code>TextSyntax</code> object with the given value
+ * and locale.
+ *
+ * @param value the value for this syntax
+ * @param locale the locale to use, if <code>null</code> the default
+ * locale is used.
+ *
+ * @exception NullPointerException if value is null
+ */
+ protected TextSyntax(String value, Locale locale)
+ {
+ if (value == null)
+ throw new NullPointerException("value may not be null");
+
+ this.value = value;
+ this.locale = (locale == null ? Locale.getDefault() : locale);
+ }
+
+ /**
+ * Returns the value of this syntax object.
+ *
+ * @return The value.
+ */
+ public String getValue()
+ {
+ return value;
+ }
+
+ /**
+ * Returns the locale of this syntax object.
+ *
+ * @return The locale.
+ */
+ public Locale getLocale()
+ {
+ return locale;
+ }
+
+ /**
+ * Returns the hashcode for this object.
+ *
+ * @return The hashcode.
+ */
+ public int hashCode()
+ {
+ return value.hashCode() ^ locale.hashCode();
+ }
+
+ /**
+ * Tests if the given object is equal to this object.
+ *
+ * @param obj the object to test
+ *
+ * @return true if both objects are equal, false otherwise.
+ */
+ public boolean equals(Object obj)
+ {
+ if (! (obj instanceof TextSyntax))
+ return false;
+
+ TextSyntax tmp = (TextSyntax) obj;
+
+ return (value.equals(tmp.getValue())
+ && locale.equals(tmp.getLocale()));
+ }
+
+ /**
+ * Returns a string representing the object. The returned
+ * string is the underlying text value of this object.
+ *
+ * @return The string representation.
+ */
+ public String toString()
+ {
+ return getValue();
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/URISyntax.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/URISyntax.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/URISyntax.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/URISyntax.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,116 @@
+/* URISyntax.java --
+ Copyright (C) 2003, 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.print.attribute;
+
+import java.io.Serializable;
+import java.net.URI;
+
+/**
+ * <code>URISyntax</code> is the abstract base class of all attribute
+ * classes having an Uniform Resource Identifier URI as value.
+ *
+ * @author Michael Koch (konqueror at gmx.de)
+ */
+public abstract class URISyntax
+ implements Cloneable, Serializable
+{
+ private static final long serialVersionUID = -7842661210486401678L;
+
+ private URI uri;
+
+ /**
+ * Creates a <code>URISyntax</code> object.
+ *
+ * @param uri the URI value for the syntax
+ *
+ * @exception NullPointerException if uri is null
+ */
+ protected URISyntax(URI uri)
+ {
+ if (uri == null)
+ throw new NullPointerException("uri may not be null");
+
+ this.uri = uri;
+ }
+
+ /**
+ * Tests if the given object is equal to this object.
+ *
+ * @param obj the object to test
+ *
+ * @return <code>true</code> if both objects are equal,
+ * <code>false</code> otherwise.
+ */
+ public boolean equals(Object obj)
+ {
+ if (! (obj instanceof URISyntax))
+ return false;
+
+ return uri.equals(((URISyntax) obj).getURI());
+ }
+
+ /**
+ * Returns the URI value of this syntax object.
+ *
+ * @return The URI.
+ */
+ public URI getURI()
+ {
+ return uri;
+ }
+
+ /**
+ * Returns the hashcode for this object.
+ *
+ * @return The hashcode.
+ */
+ public int hashCode()
+ {
+ return uri.hashCode();
+ }
+
+ /**
+ * Returns the string representation for this object.
+ *
+ * @return The string representation.
+ */
+ public String toString()
+ {
+ return uri.toString();
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/UnmodifiableSetException.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/UnmodifiableSetException.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/UnmodifiableSetException.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/UnmodifiableSetException.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,69 @@
+/* UnmodifiableSetException.java --
+ Copyright (C) 2003, 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.print.attribute;
+
+/**
+ * Exception which is thrown if an operation on an unmodifiable set
+ * is invoked.
+ *
+ * @author Michael Koch (konqueror at gmx.de)
+ *
+ * @since 1.4
+ */
+public class UnmodifiableSetException extends RuntimeException
+{
+ /**
+ * Creates a <code>UnmodifiableSetException</code>.
+ */
+ public UnmodifiableSetException()
+ {
+ super();
+ }
+
+ /**
+ * Creates a <code>UnmodifiableSetException</code>
+ * with the given message.
+ *
+ * @param message the message of the exception
+ */
+ public UnmodifiableSetException(String message)
+ {
+ super(message);
+ }
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/package.html
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/package.html?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/package.html (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/package.html Thu Nov 8 16:56:19 2007
@@ -0,0 +1,78 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<!-- package.html - describes classes in javax.print.attribute package.
+ Copyright (C) 2003, 2005, 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. -->
+
+<html>
+<head><title>GNU Classpath - javax.print.attribute</title></head>
+
+<body>
+<p>Provides classes and interfaces describing the roles and
+syntax of attribute objects in the Java Print Service API.</p>
+<p>
+The package contains the base attribute interface and several subinterfaces
+describing the different attribute roles of printing attributes. Furthermore,
+abstract classes defining the syntax of attributes are provided. For
+collections of attributes based on their roles different set interfaces and
+implementing classes are available.
+</p><p>
+Existing attribute roles are:
+<ul>
+<li><a href="PrintServiceAttribute.html">PrintServiceAttribute</a>s
+describing the state and other informations of a PrintService.</li>
+<li><a href="PrintJobAttribute.html">PrintJobAttribute</a>s describing
+the state of the print job.</li>
+<li><a href="PrintRequestAttribute.html">PrintRequestAttribute</a>s specifying
+how a print job should be printed and are applied to a complete print job.</li>
+<li><a href="PrintJobAttribute.html">PrintJobAttribute</a> s specifying
+how a single document in the print job should be printed.</li>
+</ul>
+</p><p>
+Every attribute is of a certain syntax which defines its type and the
+representation of its value. The different syntax types are provided as
+abstract syntax classes (e.g. <code>IntegerSyntax</code>). Concrete attribute
+implementations are subclasses of these abstract syntax classes.
+</p><p>
+Attributes may be collected as sets of attributes. Different interfaces for
+attribute collections per role and implementations based on a HashMap are
+provided (for example <a href="HashPrintJobAttributeSet.html">
+HashPrintJobAttributeSet</a> for the print job attributes).
+</p>
+<p>
+<b>Since:</b> 1.4
+</p>
+</body>
+</html>
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/standard/Chromaticity.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/standard/Chromaticity.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/standard/Chromaticity.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/standard/Chromaticity.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,133 @@
+/* Chromaticity.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.print.attribute.standard;
+
+import javax.print.attribute.DocAttribute;
+import javax.print.attribute.EnumSyntax;
+import javax.print.attribute.PrintJobAttribute;
+import javax.print.attribute.PrintRequestAttribute;
+
+/**
+ * The <code>Chromaticity</code> printing attribute specifies if print data
+ * should be printed in monochrome or color.
+ * <p>
+ * The attribute interacts with the document to be printed. If the document
+ * to be printed is a monochrome document it will be printed monochrome
+ * regardless of the value of this attribute category. However if it is a
+ * color document supplying the attribute value <code>MONOCHROME</code>
+ * will prepare the document to be printed in monochrome instead of color.
+ * </p>
+ * <p>
+ * This printing attribute has nothing to do with the capabilities of the
+ * printer device. To check if a specific printer service supports printing
+ * in color you have to use the attribute
+ * {@link javax.print.attribute.standard.ColorSupported}
+ * </p>
+ * <p>
+ * <b>IPP Compatibility:</b> Chromaticity is not an IPP 1.1 attribute.
+ * </p>
+ *
+ * @author Michael Koch (konqueror at gmx.de)
+ */
+public final class Chromaticity extends EnumSyntax
+ implements DocAttribute, PrintRequestAttribute, PrintJobAttribute
+{
+ private static final long serialVersionUID = 4660543931355214012L;
+
+ /** Specifies monochrome printing. */
+ public static final Chromaticity MONOCHROME = new Chromaticity(0);
+
+ /** Specifies color printing. */
+ public static final Chromaticity COLOR = new Chromaticity(1);
+
+ private static final String[] stringTable = { "monochrome", "color" };
+ private static final Chromaticity[] enumValueTable = { MONOCHROME, COLOR };
+
+ /**
+ * Creates a <code>Chromaticity</code> object.
+ *
+ * @param value the enum value
+ */
+ protected Chromaticity(int value)
+ {
+ super(value);
+ }
+
+ /**
+ * Returns category of this class.
+ *
+ * @return The class <code>Chromaticity</code> itself.
+ */
+ public Class getCategory()
+ {
+ return Chromaticity.class;
+ }
+
+ /**
+ * Returns the name of this attribute.
+ *
+ * @return The name "chromaticity".
+ */
+ public String getName()
+ {
+ return "chromaticity";
+ }
+
+ /**
+ * Returns a table with the enumeration values represented as strings
+ * for this object.
+ *
+ * @return The enumeration values as strings.
+ */
+ protected String[] getStringTable()
+ {
+ return stringTable;
+ }
+
+ /**
+ * Returns a table with the enumeration values for this object.
+ *
+ * @return The enumeration values.
+ */
+ protected EnumSyntax[] getEnumValueTable()
+ {
+ return enumValueTable;
+ }
+
+}
Added: llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/standard/ColorSupported.java
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/standard/ColorSupported.java?rev=43913&view=auto
==============================================================================
--- llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/standard/ColorSupported.java (added)
+++ llvm-gcc-4.2/trunk/libjava/classpath/javax/print/attribute/standard/ColorSupported.java Thu Nov 8 16:56:19 2007
@@ -0,0 +1,126 @@
+/* ColorSupported.java --
+ Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.print.attribute.standard;
+
+import javax.print.attribute.EnumSyntax;
+import javax.print.attribute.PrintServiceAttribute;
+
+
+/**
+ * The <code>ColorSupported</code> printing attribute specifies if a
+ * printing device is capable of color printing.
+ * <p>
+ * This attributes just tells if a printer device supports color printing
+ * but does not specify how a specific print job is printed. Therefore the
+ * attribute {@link javax.print.attribute.standard.Chromaticity} exists.
+ * </p>
+ * <p>
+ * <b>IPP Compatibility:</b> ColorSupported is an IPP 1.1 attribute. The IPP
+ * specification treats ColorSupported as a boolean type which is not available
+ * in the Java Print Service API. The IPP boolean value true corresponds
+ * to <code>SUPPORTED</code> and "false" to <code>NOT_SUPPORTED</code>.
+ * </p>
+ *
+ * @author Michael Koch (konqueror at gmx.de)
+ */
+public final class ColorSupported extends EnumSyntax
+ implements PrintServiceAttribute
+{
+ private static final long serialVersionUID = -2700555589688535545L;
+
+ /** The printer does not support printing in color. */
+ public static final ColorSupported NOT_SUPPORTED = new ColorSupported(0);
+
+ /** The printer supports printing in color. */
+ public static final ColorSupported SUPPORTED = new ColorSupported(1);
+
+ private static final String[] stringTable = { "not-supported", "supported" };
+ private static final ColorSupported[] enumValueTable = { NOT_SUPPORTED,
+ SUPPORTED };
+
+ /**
+ * Constructs a <code>ColorSupported</code> object.
+ *
+ * @param value the enum value
+ */
+ protected ColorSupported(int value)
+ {
+ super(value);
+ }
+
+ /**
+ * Returns category of this class.
+ *
+ * @return The class <code>ColorSupported</code> itself.
+ */
+ public Class getCategory()
+ {
+ return ColorSupported.class;
+ }
+
+ /**
+ * Returns the name of this attribute.
+ *
+ * @return The name "color-supported".
+ */
+ public String getName()
+ {
+ return "color-supported";
+ }
+
+ /**
+ * Returns a table with the enumeration values represented as strings
+ * for this object.
+ *
+ * @return The enumeration values as strings.
+ */
+ protected String[] getStringTable()
+ {
+ return stringTable;
+ }
+
+ /**
+ * Returns a table with the enumeration values for this object.
+ *
+ * @return The enumeration values.
+ */
+ protected EnumSyntax[] getEnumValueTable()
+ {
+ return enumValueTable;
+ }
+}
More information about the llvm-commits
mailing list