Merging eliminateswing branch, as the swing (and AWT) seem to compile separatelly
1.1 --- a/build.xml Sat Jun 20 22:21:50 2009 +0200
1.2 +++ b/build.xml Mon Jun 22 17:40:22 2009 +0200
1.3 @@ -4,6 +4,7 @@
1.4
1.5 <target name="all">
1.6 <antcall target="base"/>
1.7 + <antcall target="client"/>
1.8 <antcall target="applet"/>
1.9 <antcall target="corba"/>
1.10 <antcall target="deprecated7"/>
1.11 @@ -81,43 +82,45 @@
1.12 </and>
1.13 </selector>
1.14 <selector id="corba">
1.15 - <or>
1.16 - <filename name="org/omg/**"/>
1.17 - <filename name="com/sun/corba/**"/>
1.18 - <filename name="com/sun/jmx/remote/internal/ProxyInputStream.java"/>
1.19 - <filename name="com/sun/jndi/cosnaming/**"/>
1.20 - <filename name="com/sun/jndi/toolkit/corba/**"/>
1.21 - <filename name="com/sun/jndi/url/iiop/**"/>
1.22 - <filename name="com/sun/jndi/url/iiopname/**"/>
1.23 - <filename name="com/sun/jndi/url/corbaname/**"/>
1.24 - <filename name="javax/management/remote/rmi/RMIConnector.java"/>
1.25 - <filename name="javax/management/remote/rmi/RMIConnectorServer.java"/>
1.26 - <filename name="javax/management/remote/rmi/RMIServerImpl.java"/>
1.27 - <filename name="javax/management/remote/rmi/RMIIIOPServerImpl.java"/>
1.28 - <filename name="javax/management/remote/rmi/RMIConnectionImpl.java"/>
1.29 - <filename name="javax/management/remote/rmi/RMIJRMPServerImpl.java"/>
1.30 - <filename name="javax/rmi/PortableRemoteObject.java"/>
1.31 - <filename name="com/sun/jmx/remote/security/FileLoginModule.java"/>
1.32 - <filename name="com/sun/jmx/remote/security/JMXPluggableAuthenticator.java"/>
1.33 - <filename name="com/sun/jmx/remote/protocol/rmi/ClientProvider.java"/>
1.34 - <filename name="com/sun/jmx/remote/protocol/rmi/ClientProvider.java"/>
1.35 - <filename name="com/sun/jmx/remote/protocol/iiop/ClientProvider.java"/>
1.36 - <filename name="com/sun/jmx/remote/protocol/iiop/ServerProvider.java"/>
1.37 - <filename name="com/sun/jmx/remote/protocol/rmi/ServerProvider.java"/>
1.38 - <filename name="com/sun/jndi/url/iiop/iiopURLContextFactory.java"/>
1.39 - <filename name="sun/rmi/rmic/RMIGenerator.java"/>
1.40 - <filename name="sun/management/jmxremote/ConnectorBootstrap.java"/>
1.41 - <filename name="sun/management/Agent.java"/>
1.42 - <filename name="sun/management/snmp/AdaptorBootstrap.java"/>
1.43 - <filename name="javax/rmi/CORBA/**"/>
1.44 - <filename name="com/sun/org/omg/**"/>
1.45 - <filename name="javax/management/remote/rmi/RMIConnectorServer.java"/>
1.46 - <filename name="com/sun/jndi/url/iiop/iiopURLContext.java"/>
1.47 - <filename name="sun/rmi/rmic/iiop/**"/>
1.48 -
1.49 - <!-- now there are just two references in jconsole -->
1.50 - <filename name="sun/tools/jconsole/**"/>
1.51 - </or>
1.52 + <and>
1.53 + <or>
1.54 + <filename name="org/omg/**"/>
1.55 + <filename name="com/sun/corba/**"/>
1.56 + <filename name="com/sun/jmx/remote/internal/ProxyInputStream.java"/>
1.57 + <filename name="com/sun/jndi/cosnaming/**"/>
1.58 + <filename name="com/sun/jndi/toolkit/corba/**"/>
1.59 + <filename name="com/sun/jndi/url/iiop/**"/>
1.60 + <filename name="com/sun/jndi/url/iiopname/**"/>
1.61 + <filename name="com/sun/jndi/url/corbaname/**"/>
1.62 + <filename name="javax/management/remote/rmi/RMIConnector.java"/>
1.63 + <filename name="javax/management/remote/rmi/RMIConnectorServer.java"/>
1.64 + <filename name="javax/management/remote/rmi/RMIServerImpl.java"/>
1.65 + <filename name="javax/management/remote/rmi/RMIIIOPServerImpl.java"/>
1.66 + <filename name="javax/management/remote/rmi/RMIConnectionImpl.java"/>
1.67 + <filename name="javax/management/remote/rmi/RMIJRMPServerImpl.java"/>
1.68 + <filename name="javax/rmi/PortableRemoteObject.java"/>
1.69 + <filename name="com/sun/jmx/remote/security/FileLoginModule.java"/>
1.70 + <filename name="com/sun/jmx/remote/security/JMXPluggableAuthenticator.java"/>
1.71 + <filename name="com/sun/jmx/remote/protocol/rmi/ClientProvider.java"/>
1.72 + <filename name="com/sun/jmx/remote/protocol/rmi/ClientProvider.java"/>
1.73 + <filename name="com/sun/jmx/remote/protocol/iiop/ClientProvider.java"/>
1.74 + <filename name="com/sun/jmx/remote/protocol/iiop/ServerProvider.java"/>
1.75 + <filename name="com/sun/jmx/remote/protocol/rmi/ServerProvider.java"/>
1.76 + <filename name="com/sun/jndi/url/iiop/iiopURLContextFactory.java"/>
1.77 + <filename name="sun/rmi/rmic/RMIGenerator.java"/>
1.78 + <filename name="sun/management/jmxremote/ConnectorBootstrap.java"/>
1.79 + <filename name="sun/management/Agent.java"/>
1.80 + <filename name="sun/management/snmp/AdaptorBootstrap.java"/>
1.81 + <filename name="javax/rmi/CORBA/**"/>
1.82 + <filename name="com/sun/org/omg/**"/>
1.83 + <filename name="javax/management/remote/rmi/RMIConnectorServer.java"/>
1.84 + <filename name="com/sun/jndi/url/iiop/iiopURLContext.java"/>
1.85 + <filename name="sun/rmi/rmic/iiop/**"/>
1.86 + </or>
1.87 + <none>
1.88 + <selector refid="deprecated7"/>
1.89 + </none>
1.90 + </and>
1.91 </selector>
1.92 <selector id="beans">
1.93 <and>
1.94 @@ -133,6 +136,78 @@
1.95 </and>
1.96 </selector>
1.97
1.98 + <selector id="client">
1.99 + <and>
1.100 + <or>
1.101 + <filename name="java/awt/**"/>
1.102 + <filename name="sun/awt/**"/>
1.103 + <filename name="com/sun/awt/**"/>
1.104 + <filename name="javax/imageio/**"/>
1.105 + <filename name="javax/print/**"/>
1.106 + <filename name="javax/accessibility/**"/>
1.107 + <filename name="com/sun/imageio/**"/>
1.108 + <filename name="javax/swing/**"/>
1.109 + <filename name="sun/swing/**"/>
1.110 + <filename name="sun/java2d/**"/>
1.111 + <filename name="sun/print/**"/>
1.112 + <filename name="sun/font/**"/>
1.113 + <filename name="sun/beans/**"/>
1.114 + <filename name="sun/awt/shell/**"/>
1.115 + <filename name="com/sun/swing/**"/>
1.116 + <filename name="com/sun/java/swing/**"/>
1.117 + <filename name="com/sun/xml/internal/xsom/impl/util/**"/>
1.118 + <filename name="com/sun/security/auth/callback/DialogCallbackHandler*"/>
1.119 + <filename name="com/sun/inputmethods/internal/**"/>
1.120 + <filename name="com/sun/xml/internal/bind/**"/>
1.121 +
1.122 + <filename name="com/sun/xml/internal/messaging/saaj/**"/>
1.123 + <filename name="com/sun/xml/internal/org/jvnet/staxex/**"/>
1.124 + <filename name="com/sun/xml/internal/stream/buffer/stax/**"/>
1.125 + <filename name="com/sun/xml/internal/ws/**"/>
1.126 + <filename name="com/sun/istack/internal/**"/>
1.127 + <filename name="com/sun/xml/internal/stream/buffer/**"/>
1.128 +<!-- <filename name="com/sun/xml/internal/stream/**"/>-->
1.129 + <filename name="com/sun/xml/internal/xsom/**"/>
1.130 +
1.131 + <filename name="javax/xml/soap/**"/>
1.132 + <filename name="javax/xml/bind/**"/>
1.133 + <filename name="javax/xml/ws/**"/>
1.134 + <filename name="javax/activation/**"/>
1.135 +
1.136 + <filename name="sun/net/www/content/image/**"/>
1.137 +
1.138 + <!--<filename name="com/sun/naming/internal/**"/>-->
1.139 +
1.140 + <!-- input method has JFrame in signature -->
1.141 + <filename name="sun/awt/im/**"/>
1.142 + <filename name="sun/awt/X11/**"/>
1.143 +
1.144 + <filename name="java/beans/javax_swing*"/>
1.145 + <filename name="java/beans/**"/>
1.146 + <filename name="com/sun/beans/**"/>
1.147 + <!-- bridge between jmx and beans -->
1.148 + <filename name="META-INF/services/com.sun.jmx.mbeanserver.IntrospectorProxy"/>
1.149 + <!-- bridge between java.text and java.awt.font for Bidi -->
1.150 + <filename name="META-INF/services/sun.text.BidiProxy"/>
1.151 + </or>
1.152 + <none>
1.153 + <filename name="java/awt/AWTPermission*"/>
1.154 +
1.155 + <filename name="java/beans/ConstructorProperties*"/>
1.156 + <filename name="java/beans/PropertyChangeListener*"/>
1.157 + <filename name="java/beans/PropertyChangeEvent*"/>
1.158 + <filename name="java/beans/IndexedPropertyChangeEvent*"/>
1.159 + <filename name="java/beans/PropertyChangeSupport*"/>
1.160 + <filename name="java/beans/ChangeListenerMap*"/>
1.161 +
1.162 + <!-- remove classes from other modules -->
1.163 + <selector refid="applet"/>
1.164 + <selector refid="corba"/>
1.165 + <selector refid="deprecated7"/>
1.166 + </none>
1.167 + </and>
1.168 + </selector>
1.169 +
1.170 <selector id="deprecated7">
1.171 <or>
1.172 <!-- deprecated as it contains one method
1.173 @@ -145,8 +220,12 @@
1.174 <filename name="javax/swing/RepaintManager*"/>
1.175
1.176 <!-- tools -->
1.177 - <filename name="sun/tools/serialver/**"/>
1.178 - <filename name="com/sun/tools/corba/**"/>
1.179 + <filename name="sun/security/tools/**"/>
1.180 + <filename name="com/sun/istack/internal/ws/AnnotationProcessorFactoryImpl*"/>
1.181 + <filename name="com/sun/tools/**"/>
1.182 + <filename name="com/sun/jdi/**"/>
1.183 + <filename name="sun/tools/**"/>
1.184 + <filename name="sun/rmi/rmic/**"/>
1.185 </or>
1.186 </selector>
1.187
1.188 @@ -155,9 +234,9 @@
1.189 <!-- exclude classes from other modules -->
1.190 <selector refid="corba"/>
1.191 <selector refid="applet"/>
1.192 + <selector refid="client"/>
1.193 <selector refid="deprecated7"/>
1.194 <!--
1.195 - <selector refid="beans"/>
1.196 <selector refid="client"/>
1.197 <selector refid="enterprise"/>
1.198 <selector refid="deprecated7"/>
1.199 @@ -184,13 +263,13 @@
1.200 <target name="deprecated7">
1.201 <antcall target="-compile-one-module">
1.202 <param name="module" value="deprecated7"/>
1.203 - <param name="depends" value="base:applet"/>
1.204 + <param name="depends" value="base:applet:client:corba"/>
1.205 </antcall>
1.206 </target>
1.207 <target name="applet">
1.208 <antcall target="-compile-one-module">
1.209 <param name="module" value="applet"/>
1.210 - <param name="depends" value="base"/>
1.211 + <param name="depends" value="base:client"/>
1.212 </antcall>
1.213 </target>
1.214 <target name="beans">
1.215 @@ -198,10 +277,16 @@
1.216 <param name="module" value="beans"/>
1.217 </antcall>
1.218 </target>
1.219 + <target name="client">
1.220 + <antcall target="-compile-one-module">
1.221 + <param name="module" value="client"/>
1.222 + <param name="depends" value="base"/>
1.223 + </antcall>
1.224 + </target>
1.225 <target name="corba">
1.226 <antcall target="-compile-one-module">
1.227 <param name="module" value="corba"/>
1.228 - <param name="depends" value="base:applet"/>
1.229 + <param name="depends" value="base:client:applet"/>
1.230 </antcall>
1.231 </target>
1.232
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2.2 +++ b/src/share/classes/META-INF/services/com.sun.jmx.mbeanserver.IntrospectorProxy Mon Jun 22 17:40:22 2009 +0200
2.3 @@ -0,0 +1,1 @@
2.4 +sun.beans.IntrospectorProxyImpl
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
3.2 +++ b/src/share/classes/META-INF/services/sun.text.BidiProxy Mon Jun 22 17:40:22 2009 +0200
3.3 @@ -0,0 +1,2 @@
3.4 +sun.font.BidiProxyImpl
3.5 +
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
4.2 +++ b/src/share/classes/com/sun/beans/IntrospectorProxyImpl.java Mon Jun 22 17:40:22 2009 +0200
4.3 @@ -0,0 +1,66 @@
4.4 +/*
4.5 + * Copyright 2005-2008 Sun Microsystems, Inc. All Rights Reserved.
4.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4.7 + *
4.8 + * This code is free software; you can redistribute it and/or modify it
4.9 + * under the terms of the GNU General Public License version 2 only, as
4.10 + * published by the Free Software Foundation. Sun designates this
4.11 + * particular file as subject to the "Classpath" exception as provided
4.12 + * by Sun in the LICENSE file that accompanied this code.
4.13 + *
4.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
4.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
4.16 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
4.17 + * version 2 for more details (a copy is included in the LICENSE file that
4.18 + * accompanied this code).
4.19 + *
4.20 + * You should have received a copy of the GNU General Public License version
4.21 + * 2 along with this work; if not, write to the Free Software Foundation,
4.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
4.23 + *
4.24 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
4.25 + * CA 95054 USA or visit www.sun.com if you need additional information or
4.26 + * have any questions.
4.27 + */
4.28 +
4.29 +package sun.beans;
4.30 +
4.31 +import java.beans.BeanInfo;
4.32 +import java.beans.PropertyDescriptor;
4.33 +import java.lang.reflect.InvocationTargetException;
4.34 +import java.lang.reflect.Method;
4.35 +import java.util.Map;
4.36 +import java.util.TreeMap;
4.37 +
4.38 +import com.sun.jmx.mbeanserver.IntrospectorProxy;
4.39 +
4.40 +public abstract class IntrospectorProxyImpl extends IntrospectorProxy {
4.41 + public Map<String, Object> inspectClass(Class<?> type, Object values) {
4.42 + Map<String, Object> map = new TreeMap<String, Object>();
4.43 + try {
4.44 + BeanInfo bi = java.beans.Introspector.getBeanInfo(type);
4.45 + PropertyDescriptor[] pds = bi.getPropertyDescriptors();
4.46 + for (PropertyDescriptor pd : pds) {
4.47 + String name = pd.getName();
4.48 + if (name.equals("class")) {
4.49 + continue;
4.50 + }
4.51 + Method get = pd.getReadMethod();
4.52 + if (get != null) {
4.53 + if (values == null) {
4.54 + map.put(name, get);
4.55 + } else {
4.56 + map.put(name, get.invoke(values));
4.57 + }
4.58 + }
4.59 + }
4.60 + } catch (Exception e) {
4.61 + Throwable t = e;
4.62 + if (t instanceof InvocationTargetException) {
4.63 + t = t.getCause();
4.64 + }
4.65 + map.put("Exception", t);
4.66 + }
4.67 + return map;
4.68 + }
4.69 +}
4.70 \ No newline at end of file
5.1 --- a/src/share/classes/com/sun/jmx/mbeanserver/Introspector.java Sat Jun 20 22:21:50 2009 +0200
5.2 +++ b/src/share/classes/com/sun/jmx/mbeanserver/Introspector.java Mon Jun 22 17:40:22 2009 +0200
5.3 @@ -25,14 +25,9 @@
5.4
5.5 package com.sun.jmx.mbeanserver;
5.6
5.7 -import com.sun.jmx.remote.util.EnvHelp;
5.8 -import java.beans.BeanInfo;
5.9 -import java.beans.PropertyDescriptor;
5.10 import java.lang.annotation.Annotation;
5.11 import java.lang.reflect.AnnotatedElement;
5.12 -import java.lang.reflect.Array;
5.13 import java.lang.reflect.Constructor;
5.14 -import java.lang.reflect.InvocationTargetException;
5.15 import java.lang.reflect.Method;
5.16 import java.lang.reflect.Modifier;
5.17 import java.lang.reflect.Proxy;
5.18 @@ -41,7 +36,6 @@
5.19 import java.util.HashMap;
5.20 import java.util.Map;
5.21 import java.util.logging.Level;
5.22 -import javax.management.AttributeNotFoundException;
5.23 import javax.management.Description;
5.24
5.25 import javax.management.Descriptor;
5.26 @@ -53,14 +47,11 @@
5.27 import javax.management.MBeanInfo;
5.28 import javax.management.MXBean;
5.29 import javax.management.NotCompliantMBeanException;
5.30 -import javax.management.openmbean.CompositeData;
5.31 import javax.management.openmbean.MXBeanMappingFactory;
5.32
5.33 import static com.sun.jmx.defaults.JmxProperties.MBEANSERVER_LOGGER;
5.34 import com.sun.jmx.mbeanserver.Util;
5.35 import com.sun.jmx.remote.util.EnvHelp;
5.36 -import java.beans.BeanInfo;
5.37 -import java.beans.PropertyDescriptor;
5.38 import java.lang.reflect.Array;
5.39 import java.lang.reflect.InvocationTargetException;
5.40 import java.util.LinkedHashSet;
5.41 @@ -732,11 +723,11 @@
5.42 } else {
5.43 // Java Beans introspection
5.44 //
5.45 - BeanInfo bi = java.beans.Introspector.getBeanInfo(complex.getClass());
5.46 - PropertyDescriptor[] pds = bi.getPropertyDescriptors();
5.47 - for (PropertyDescriptor pd : pds)
5.48 - if (pd.getName().equals(element))
5.49 - return pd.getReadMethod().invoke(complex);
5.50 + Map<String,Object> methods = IntrospectorProxy.getDefault().inspectClass(complex.getClass(), null);
5.51 + Object method = methods.get(element);
5.52 + if (method instanceof Method) {
5.53 + return ((Method)method).invoke(complex);
5.54 + }
5.55 throw new AttributeNotFoundException(
5.56 "Could not find the getter method for the property " +
5.57 element + " using the Java Beans introspector");
6.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
6.2 +++ b/src/share/classes/com/sun/jmx/mbeanserver/IntrospectorProxy.java Mon Jun 22 17:40:22 2009 +0200
6.3 @@ -0,0 +1,85 @@
6.4 +/*
6.5 + * Copyright 2005-2008 Sun Microsystems, Inc. All Rights Reserved.
6.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6.7 + *
6.8 + * This code is free software; you can redistribute it and/or modify it
6.9 + * under the terms of the GNU General Public License version 2 only, as
6.10 + * published by the Free Software Foundation. Sun designates this
6.11 + * particular file as subject to the "Classpath" exception as provided
6.12 + * by Sun in the LICENSE file that accompanied this code.
6.13 + *
6.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
6.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
6.16 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
6.17 + * version 2 for more details (a copy is included in the LICENSE file that
6.18 + * accompanied this code).
6.19 + *
6.20 + * You should have received a copy of the GNU General Public License version
6.21 + * 2 along with this work; if not, write to the Free Software Foundation,
6.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
6.23 + *
6.24 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
6.25 + * CA 95054 USA or visit www.sun.com if you need additional information or
6.26 + * have any questions.
6.27 + */
6.28 +
6.29 +package com.sun.jmx.mbeanserver;
6.30 +
6.31 +import java.lang.reflect.InvocationTargetException;
6.32 +import java.lang.reflect.Method;
6.33 +import java.util.Iterator;
6.34 +import java.util.Map;
6.35 +import java.util.ServiceLoader;
6.36 +import java.util.TreeMap;
6.37 +
6.38 +public abstract class IntrospectorProxy {
6.39 + public static IntrospectorProxy getDefault() {
6.40 + Iterator<IntrospectorProxy> it = ServiceLoader.load(IntrospectorProxy.class).iterator();
6.41 + return it.hasNext() ? it.next() : new SimpleIntrospector();
6.42 + }
6.43 +
6.44 + /** Either fills the map with inspected Method objects (if values == null)
6.45 + * or with real values of those methods called on the values target
6.46 + */
6.47 + public abstract Map<String, Object> inspectClass(Class<?> type, Object values);
6.48 +
6.49 + private static final class SimpleIntrospector extends IntrospectorProxy {
6.50 + @Override
6.51 + public Map<String,Object> inspectClass(Class<?> type, Object values) {
6.52 + Map<String, Object> map = new TreeMap<String, Object>();
6.53 + try {
6.54 + for (Method get : type.getMethods()) {
6.55 + if (get.getName().equals("getClass")) {
6.56 + continue;
6.57 + }
6.58 + if (get.getParameterTypes().length != 0) {
6.59 + continue;
6.60 + }
6.61 + String name;
6.62 + if (get.getName().startsWith("get")) {
6.63 + name = get.getName().substring(3);
6.64 + } else {
6.65 + if (get.getName().startsWith("is")) {
6.66 + name = get.getName().substring(2);
6.67 + } else {
6.68 + continue;
6.69 + }
6.70 + }
6.71 + if (values == null) {
6.72 + map.put(name, get);
6.73 + } else {
6.74 + map.put(name, get.invoke(values));
6.75 + }
6.76 + }
6.77 + } catch (Exception e) {
6.78 + Throwable t = e;
6.79 + if (t instanceof InvocationTargetException) {
6.80 + t = t.getCause();
6.81 + }
6.82 + map.put("Exception", t);
6.83 + }
6.84 + return map;
6.85 + }
6.86 +
6.87 + }
6.88 +}
6.89 \ No newline at end of file
7.1 --- a/src/share/classes/com/sun/naming/internal/ResourceManager.java Sat Jun 20 22:21:50 2009 +0200
7.2 +++ b/src/share/classes/com/sun/naming/internal/ResourceManager.java Mon Jun 22 17:40:22 2009 +0200
7.3 @@ -25,11 +25,10 @@
7.4
7.5 package com.sun.naming.internal;
7.6
7.7 -import java.awt.Component;
7.8 import java.io.InputStream;
7.9 import java.io.IOException;
7.10 -import java.net.URL;
7.11 import java.lang.ref.WeakReference;
7.12 +import java.lang.reflect.Method;
7.13 import java.util.Enumeration;
7.14 import java.util.HashMap;
7.15 import java.util.Hashtable;
7.16 @@ -41,7 +40,6 @@
7.17 import java.util.WeakHashMap;
7.18
7.19 import javax.naming.*;
7.20 -import sun.swing.SwingUtilities2;
7.21
7.22 /**
7.23 * The ResourceManager class facilitates the reading of JNDI resource files.
7.24 @@ -144,7 +142,7 @@
7.25 if (env == null) {
7.26 env = new Hashtable(11);
7.27 }
7.28 - Component applet = (Component)env.get(Context.APPLET);
7.29 + Object applet = env.get(Context.APPLET);
7.30
7.31 // Merge property values from env param, applet params, and system
7.32 // properties. The first value wins: there's no concatenation of
7.33 @@ -158,7 +156,7 @@
7.34 Object val = env.get(props[i]);
7.35 if (val == null) {
7.36 if (applet != null) {
7.37 - val = SwingUtilities2.getAppletParameter(applet, props[i]);
7.38 + val = getAppletParameter(applet, props[i]);
7.39 }
7.40 if (val == null) {
7.41 // Read system property.
7.42 @@ -559,4 +557,16 @@
7.43 }
7.44 return false;
7.45 }
7.46 +
7.47 + public static String getAppletParameter(Object applet, String name) {
7.48 + try {
7.49 + Class<?> appletC = Class.forName("java.applet.Applet");
7.50 + Method get = appletC.getMethod("getParameter", String.class);
7.51 + return (String)get.invoke(applet, name);
7.52 + } catch (Exception ex) {
7.53 + ex.printStackTrace();
7.54 + return null;
7.55 + }
7.56 + }
7.57 +
7.58 }
8.1 --- a/src/share/classes/java/text/Bidi.java Sat Jun 20 22:21:50 2009 +0200
8.2 +++ b/src/share/classes/java/text/Bidi.java Mon Jun 22 17:40:22 2009 +0200
8.3 @@ -35,10 +35,8 @@
8.4
8.5 package java.text;
8.6
8.7 -import java.awt.Toolkit;
8.8 -import java.awt.font.TextAttribute;
8.9 -import java.awt.font.NumericShaper;
8.10 import sun.text.CodePointIterator;
8.11 +import sun.text.BidiProxy;
8.12
8.13 /**
8.14 * This class implements the Unicode Bidirectional Algorithm.
8.15 @@ -69,7 +67,7 @@
8.16 int[] cws;
8.17
8.18 static {
8.19 - sun.font.FontManagerNativeLibrary.load();
8.20 + BidiProxy.getDefault().init();
8.21 }
8.22
8.23 /** Constant indicating base direction is left-to-right. */
8.24 @@ -156,51 +154,20 @@
8.25
8.26 paragraph.first();
8.27 try {
8.28 - Boolean runDirection = (Boolean)paragraph.getAttribute(TextAttribute.RUN_DIRECTION);
8.29 - if (runDirection != null) {
8.30 - if (TextAttribute.RUN_DIRECTION_LTR.equals(runDirection)) {
8.31 - flags = DIRECTION_LEFT_TO_RIGHT; // clears default setting
8.32 - } else {
8.33 - flags = DIRECTION_RIGHT_TO_LEFT;
8.34 - }
8.35 + Integer f = BidiProxy.getDefault().findDirection(paragraph);
8.36 + if (f != null) {
8.37 + flags = f;
8.38 }
8.39 }
8.40 catch (ClassCastException e) {
8.41 }
8.42
8.43 try {
8.44 - NumericShaper shaper = (NumericShaper)paragraph.getAttribute(TextAttribute.NUMERIC_SHAPING);
8.45 - if (shaper != null) {
8.46 - shaper.shape(text, 0, text.length);
8.47 - }
8.48 + BidiProxy.getDefault().shapeText(paragraph, text);
8.49 }
8.50 catch (ClassCastException e) {
8.51 }
8.52 -
8.53 - int pos = start;
8.54 - do {
8.55 - paragraph.setIndex(pos);
8.56 - Object embeddingLevel = paragraph.getAttribute(TextAttribute.BIDI_EMBEDDING);
8.57 - int newpos = paragraph.getRunLimit(TextAttribute.BIDI_EMBEDDING);
8.58 -
8.59 - if (embeddingLevel != null) {
8.60 - try {
8.61 - int intLevel = ((Integer)embeddingLevel).intValue();
8.62 - if (intLevel >= -61 && intLevel < 61) {
8.63 - byte level = (byte)(intLevel < 0 ? (-intLevel | 0x80) : intLevel);
8.64 - if (embeddings == null) {
8.65 - embeddings = new byte[length];
8.66 - }
8.67 - for (int i = pos - start; i < newpos - start; ++i) {
8.68 - embeddings[i] = level;
8.69 - }
8.70 - }
8.71 - }
8.72 - catch (ClassCastException e) {
8.73 - }
8.74 - }
8.75 - pos = newpos;
8.76 - } while (pos < limit);
8.77 + embeddings = BidiProxy.getDefault().embedding(start, paragraph, embeddings, length, limit);
8.78
8.79 nativeBidiChars(this, text, 0, embeddings, 0, text.length, flags);
8.80 }
9.1 --- a/src/share/classes/javax/management/JMX.java Sat Jun 20 22:21:50 2009 +0200
9.2 +++ b/src/share/classes/javax/management/JMX.java Mon Jun 22 17:40:22 2009 +0200
9.3 @@ -26,10 +26,8 @@
9.4 package javax.management;
9.5
9.6 import com.sun.jmx.mbeanserver.Introspector;
9.7 +import com.sun.jmx.mbeanserver.IntrospectorProxy;
9.8 import com.sun.jmx.mbeanserver.MBeanInjector;
9.9 -import com.sun.jmx.remote.util.ClassLogger;
9.10 -import java.beans.BeanInfo;
9.11 -import java.beans.PropertyDescriptor;
9.12 import java.io.IOException;
9.13 import java.io.Serializable;
9.14 import java.lang.reflect.InvocationHandler;
9.15 @@ -298,25 +296,7 @@
9.16 }
9.17
9.18 private Map<String, Object> toMap() {
9.19 - Map<String, Object> map = new TreeMap<String, Object>();
9.20 - try {
9.21 - BeanInfo bi = java.beans.Introspector.getBeanInfo(getClass());
9.22 - PropertyDescriptor[] pds = bi.getPropertyDescriptors();
9.23 - for (PropertyDescriptor pd : pds) {
9.24 - String name = pd.getName();
9.25 - if (name.equals("class"))
9.26 - continue;
9.27 - Method get = pd.getReadMethod();
9.28 - if (get != null)
9.29 - map.put(name, get.invoke(this));
9.30 - }
9.31 - } catch (Exception e) {
9.32 - Throwable t = e;
9.33 - if (t instanceof InvocationTargetException)
9.34 - t = t.getCause();
9.35 - map.put("Exception", t);
9.36 - }
9.37 - return map;
9.38 + return IntrospectorProxy.getDefault().inspectClass(getClass(), this);
9.39 }
9.40
9.41 @Override
10.1 --- a/src/share/classes/sun/applet/AppletViewerPanel.java Sat Jun 20 22:21:50 2009 +0200
10.2 +++ b/src/share/classes/sun/applet/AppletViewerPanel.java Mon Jun 22 17:40:22 2009 +0200
10.3 @@ -26,12 +26,9 @@
10.4 package sun.applet;
10.5
10.6 import java.util.*;
10.7 -import java.io.*;
10.8 import java.net.URL;
10.9 import java.net.MalformedURLException;
10.10 -import java.awt.*;
10.11 import java.applet.*;
10.12 -import sun.tools.jar.*;
10.13
10.14
10.15 /**
11.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
11.2 +++ b/src/share/classes/sun/font/BidiProxyImpl.java Mon Jun 22 17:40:22 2009 +0200
11.3 @@ -0,0 +1,96 @@
11.4 +/*
11.5 + * Copyright 2000-2003 Sun Microsystems, Inc. All Rights Reserved.
11.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
11.7 + *
11.8 + * This code is free software; you can redistribute it and/or modify it
11.9 + * under the terms of the GNU General Public License version 2 only, as
11.10 + * published by the Free Software Foundation. Sun designates this
11.11 + * particular file as subject to the "Classpath" exception as provided
11.12 + * by Sun in the LICENSE file that accompanied this code.
11.13 + *
11.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
11.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11.16 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
11.17 + * version 2 for more details (a copy is included in the LICENSE file that
11.18 + * accompanied this code).
11.19 + *
11.20 + * You should have received a copy of the GNU General Public License version
11.21 + * 2 along with this work; if not, write to the Free Software Foundation,
11.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
11.23 + *
11.24 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
11.25 + * CA 95054 USA or visit www.sun.com if you need additional information or
11.26 + * have any questions.
11.27 + */
11.28 +
11.29 +package sun.font;
11.30 +
11.31 +import java.awt.font.NumericShaper;
11.32 +import java.awt.font.TextAttribute;
11.33 +import java.text.AttributedCharacterIterator;
11.34 +import java.text.Bidi;
11.35 +import sun.text.BidiProxy;
11.36 +
11.37 +/*
11.38 + * (C) Copyright IBM Corp. 1999-2003 - All Rights Reserved
11.39 + *
11.40 + * The original version of this source code and documentation is
11.41 + * copyrighted and owned by IBM. These materials are provided
11.42 + * under terms of a License Agreement between IBM and Sun.
11.43 + * This technology is protected by multiple US and International
11.44 + * patents. This notice and attribution to IBM may not be removed.
11.45 + */
11.46 +public abstract class BidiProxyImpl extends BidiProxy {
11.47 +
11.48 + public void init() {
11.49 + sun.font.FontManagerNativeLibrary.load();
11.50 + }
11.51 +
11.52 + public Integer findDirection(AttributedCharacterIterator paragraph) {
11.53 + Boolean runDirection = (Boolean)paragraph.getAttribute(TextAttribute.RUN_DIRECTION);
11.54 + if (runDirection != null) {
11.55 + if (TextAttribute.RUN_DIRECTION_LTR.equals(runDirection)) {
11.56 + return Bidi.DIRECTION_LEFT_TO_RIGHT; // clears default setting
11.57 + } else {
11.58 + return Bidi.DIRECTION_RIGHT_TO_LEFT;
11.59 + }
11.60 + }
11.61 + return null;
11.62 + }
11.63 +
11.64 + public void shapeText(AttributedCharacterIterator paragraph, char[] text) {
11.65 + NumericShaper shaper = (NumericShaper) paragraph.getAttribute(TextAttribute.NUMERIC_SHAPING);
11.66 + if (shaper != null) {
11.67 + shaper.shape(text, 0, text.length);
11.68 + }
11.69 + }
11.70 +
11.71 +
11.72 + public byte[] embedding(int start, AttributedCharacterIterator paragraph, byte[] embeddings, int length, int limit) {
11.73 + int pos = start;
11.74 + do {
11.75 + paragraph.setIndex(pos);
11.76 + Object embeddingLevel = paragraph.getAttribute(TextAttribute.BIDI_EMBEDDING);
11.77 + int newpos = paragraph.getRunLimit(TextAttribute.BIDI_EMBEDDING);
11.78 + if (embeddingLevel != null) {
11.79 + try {
11.80 + int intLevel = ((Integer) embeddingLevel).intValue();
11.81 + if (intLevel >= -61 && intLevel < 61) {
11.82 + byte level = (byte) (intLevel < 0 ? (-intLevel | 0x80) : intLevel);
11.83 + if (embeddings == null) {
11.84 + embeddings = new byte[length];
11.85 + }
11.86 + for (int i = pos - start; i < newpos - start; ++i) {
11.87 + embeddings[i] = level;
11.88 + }
11.89 + }
11.90 + } catch (ClassCastException e) {
11.91 + }
11.92 + }
11.93 + pos = newpos;
11.94 + } while (pos < limit);
11.95 + return embeddings;
11.96 + }
11.97 +
11.98 +}
11.99 +
12.1 --- a/src/share/classes/sun/nio/fs/MimeType.java Sat Jun 20 22:21:50 2009 +0200
12.2 +++ b/src/share/classes/sun/nio/fs/MimeType.java Mon Jun 22 17:40:22 2009 +0200
12.3 @@ -25,6 +25,8 @@
12.4
12.5 package sun.nio.fs;
12.6
12.7 +import java.util.Locale;
12.8 +
12.9 /**
12.10 * Represents a MIME type for the purposes of validation and matching. For
12.11 * now this class is implemented using the javax.activation.MimeType class but
12.12 @@ -32,9 +34,9 @@
12.13 */
12.14
12.15 public class MimeType {
12.16 - private final javax.activation.MimeType type;
12.17 + private final Impl type;
12.18
12.19 - private MimeType(javax.activation.MimeType type) {
12.20 + private MimeType(Impl type) {
12.21 this.type = type;
12.22 }
12.23
12.24 @@ -45,18 +47,14 @@
12.25 * If the string is not a valid MIME type
12.26 */
12.27 public static MimeType parse(String type) {
12.28 - try {
12.29 - return new MimeType(new javax.activation.MimeType(type));
12.30 - } catch (javax.activation.MimeTypeParseException x) {
12.31 - throw new IllegalArgumentException(x);
12.32 - }
12.33 + return new MimeType(new Impl(type));
12.34 }
12.35
12.36 /**
12.37 * Returns {@code true} if this MIME type has parameters.
12.38 */
12.39 public boolean hasParameters() {
12.40 - return !type.getParameters().isEmpty();
12.41 + return type.hasParameters;
12.42 }
12.43
12.44 /**
12.45 @@ -66,8 +64,220 @@
12.46 public boolean match(String other) {
12.47 try {
12.48 return type.match(other);
12.49 - } catch (javax.activation.MimeTypeParseException x) {
12.50 + } catch (IllegalArgumentException x) {
12.51 return false;
12.52 }
12.53 }
12.54 +
12.55 + /** copy of javax.activation.MimeType */
12.56 + private static class Impl {
12.57 +
12.58 + private String primaryType;
12.59 + private String subType;
12.60 + private boolean hasParameters;
12.61 +
12.62 + /**
12.63 + * A string that holds all the special chars.
12.64 + */
12.65 + private static final String TSPECIALS = "()<>@,;:/[]?=\\\"";
12.66 +
12.67 + /**
12.68 + * Default constructor.
12.69 + */
12.70 + public Impl() {
12.71 + primaryType = "application";
12.72 + subType = "*";
12.73 + hasParameters = false;
12.74 + }
12.75 +
12.76 + /**
12.77 + * Constructor that builds a MimeType from a String.
12.78 + *
12.79 + * @param rawdata the MIME type string
12.80 + */
12.81 + public Impl(String rawdata) throws IllegalArgumentException {
12.82 + parse(rawdata);
12.83 + }
12.84 +
12.85 + /**
12.86 + * A routine for parsing the MIME type out of a String.
12.87 + */
12.88 + private void parse(String rawdata) throws IllegalArgumentException {
12.89 + int slashIndex = rawdata.indexOf('/');
12.90 + int semIndex = rawdata.indexOf(';');
12.91 + if ((slashIndex < 0) && (semIndex < 0)) {
12.92 + // neither character is present, so treat it
12.93 + // as an error
12.94 + throw new IllegalArgumentException("Unable to find a sub type.");
12.95 + } else if ((slashIndex < 0) && (semIndex >= 0)) {
12.96 + // we have a ';' (and therefore a parameter list),
12.97 + // but no '/' indicating a sub type is present
12.98 + throw new IllegalArgumentException("Unable to find a sub type.");
12.99 + } else if ((slashIndex >= 0) && (semIndex < 0)) {
12.100 + // we have a primary and sub type but no parameter list
12.101 + primaryType = rawdata.substring(0, slashIndex).trim().
12.102 + toLowerCase(Locale.ENGLISH);
12.103 + subType = rawdata.substring(slashIndex + 1).trim().
12.104 + toLowerCase(Locale.ENGLISH);
12.105 + hasParameters = false;
12.106 + } else if (slashIndex < semIndex) {
12.107 + // we have all three items in the proper sequence
12.108 + primaryType = rawdata.substring(0, slashIndex).trim().
12.109 + toLowerCase(Locale.ENGLISH);
12.110 + subType = rawdata.substring(slashIndex + 1, semIndex).trim().
12.111 + toLowerCase(Locale.ENGLISH);
12.112 + hasParameters = true;
12.113 + } else {
12.114 + // we have a ';' lexically before a '/' which means we
12.115 + // have a primary type and a parameter list but no sub type
12.116 + throw new IllegalArgumentException("Unable to find a sub type.");
12.117 + }
12.118 +
12.119 + // now validate the primary and sub types
12.120 +
12.121 + // check to see if primary is valid
12.122 + if (!isValidToken(primaryType))
12.123 + throw new IllegalArgumentException("Primary type is invalid.");
12.124 +
12.125 + // check to see if sub is valid
12.126 + if (!isValidToken(subType))
12.127 + throw new IllegalArgumentException("Sub type is invalid.");
12.128 + }
12.129 +
12.130 + /**
12.131 + * Retrieve the primary type of this object.
12.132 + *
12.133 + * @return the primary MIME type
12.134 + */
12.135 + public String getPrimaryType() {
12.136 + return primaryType;
12.137 + }
12.138 +
12.139 + /**
12.140 + * Set the primary type for this object to the given String.
12.141 + *
12.142 + * @param primary the primary MIME type
12.143 + * @exception IllegalArgumentException if the primary type
12.144 + * is not a valid token
12.145 + */
12.146 + public void setPrimaryType(String primary) throws IllegalArgumentException {
12.147 + // check to see if primary is valid
12.148 + if (!isValidToken(primaryType))
12.149 + throw new IllegalArgumentException("Primary type is invalid.");
12.150 + primaryType = primary.toLowerCase(Locale.ENGLISH);
12.151 + }
12.152 +
12.153 + /**
12.154 + * Retrieve the subtype of this object.
12.155 + *
12.156 + * @return the MIME subtype
12.157 + */
12.158 + public String getSubType() {
12.159 + return subType;
12.160 + }
12.161 +
12.162 + /**
12.163 + * Set the subtype for this object to the given String.
12.164 + *
12.165 + * @param sub the MIME subtype
12.166 + * @exception IllegalArgumentException if the subtype
12.167 + * is not a valid token
12.168 + */
12.169 + public void setSubType(String sub) throws IllegalArgumentException {
12.170 + // check to see if sub is valid
12.171 + if (!isValidToken(subType))
12.172 + throw new IllegalArgumentException("Sub type is invalid.");
12.173 + subType = sub.toLowerCase(Locale.ENGLISH);
12.174 + }
12.175 +
12.176 + /**
12.177 + * Return the String representation of this object.
12.178 + */
12.179 + @Override
12.180 + public String toString() {
12.181 + return getBaseType();
12.182 + }
12.183 +
12.184 + /**
12.185 + * Return a String representation of this object
12.186 + * without the parameter list.
12.187 + *
12.188 + * @return the MIME type and sub-type
12.189 + */
12.190 + public String getBaseType() {
12.191 + return primaryType + "/" + subType;
12.192 + }
12.193 +
12.194 + /**
12.195 + * Determine if the primary and sub type of this object is
12.196 + * the same as what is in the given type.
12.197 + *
12.198 + * @param type the MimeType object to compare with
12.199 + * @return true if they match
12.200 + */
12.201 + public boolean match(Impl type) {
12.202 + return primaryType.equals(type.getPrimaryType())
12.203 + && (subType.equals("*")
12.204 + || type.getSubType().equals("*")
12.205 + || (subType.equals(type.getSubType())));
12.206 + }
12.207 +
12.208 + /**
12.209 + * Determine if the primary and sub type of this object is
12.210 + * the same as the content type described in rawdata.
12.211 + *
12.212 + * @param rawdata the MIME type string to compare with
12.213 + * @return true if they match
12.214 + */
12.215 + public boolean match(String rawdata) throws IllegalArgumentException {
12.216 + return match(new Impl(rawdata));
12.217 + }
12.218 +
12.219 + // below here be scary parsing related things
12.220 +
12.221 + /**
12.222 + * Determine whether or not a given character belongs to a legal token.
12.223 + */
12.224 + private static boolean isTokenChar(char c) {
12.225 + return ((c > 040) && (c < 0177)) && (TSPECIALS.indexOf(c) < 0);
12.226 + }
12.227 +
12.228 + /**
12.229 + * Determine whether or not a given string is a legal token.
12.230 + */
12.231 + private boolean isValidToken(String s) {
12.232 + int len = s.length();
12.233 + if (len > 0) {
12.234 + for (int i = 0; i < len; ++i) {
12.235 + char c = s.charAt(i);
12.236 + if (!isTokenChar(c)) {
12.237 + return false;
12.238 + }
12.239 + }
12.240 + return true;
12.241 + } else {
12.242 + return false;
12.243 + }
12.244 + }
12.245 +
12.246 + /**
12.247 + * A simple parser test,
12.248 + * for debugging...
12.249 + *
12.250 + public static void main(String[] args)
12.251 + throws IllegalArgumentException, IOException {
12.252 + for (int i = 0; i < args.length; ++i) {
12.253 + System.out.println("Original: " + args[i]);
12.254 +
12.255 + MimeType type = new MimeType(args[i]);
12.256 +
12.257 + System.out.println("Short: " + type.getBaseType());
12.258 + System.out.println("Parsed: " + type.toString());
12.259 + System.out.println();
12.260 + }
12.261 + }
12.262 + */
12.263 + }
12.264 +
12.265 +
12.266 }
13.1 --- a/src/share/classes/sun/swing/SwingUtilities2.java Sat Jun 20 22:21:50 2009 +0200
13.2 +++ b/src/share/classes/sun/swing/SwingUtilities2.java Mon Jun 22 17:40:22 2009 +0200
13.3 @@ -32,25 +32,18 @@
13.4 import static java.awt.RenderingHints.*;
13.5 import java.awt.event.*;
13.6 import java.awt.font.*;
13.7 -import java.awt.geom.*;
13.8 import java.awt.print.PrinterGraphics;
13.9 -import java.text.Bidi;
13.10 import java.text.AttributedCharacterIterator;
13.11 import java.text.AttributedString;
13.12
13.13 import javax.swing.*;
13.14 -import javax.swing.plaf.*;
13.15 import javax.swing.text.Highlighter;
13.16 import javax.swing.text.JTextComponent;
13.17 import javax.swing.text.DefaultHighlighter;
13.18 import javax.swing.text.DefaultCaret;
13.19 import javax.swing.table.TableCellRenderer;
13.20 -import sun.swing.PrintColorUIResource;
13.21 -import sun.swing.ImageIconUIResource;
13.22 import sun.print.ProxyPrintGraphics;
13.23 import sun.awt.*;
13.24 -import sun.security.action.GetPropertyAction;
13.25 -import sun.security.util.SecurityConstants;
13.26 import java.io.*;
13.27 import java.util.*;
13.28 import sun.font.FontDesignMetrics;
13.29 @@ -1881,9 +1874,4 @@
13.30 }
13.31 return false;
13.32 }
13.33 -
13.34 - public static String getAppletParameter(Component applet, String name) {
13.35 - // JST-TBD: some trick, maybe reflection, may code injection
13.36 - return null;
13.37 - }
13.38 }
14.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
14.2 +++ b/src/share/classes/sun/text/BidiProxy.java Mon Jun 22 17:40:22 2009 +0200
14.3 @@ -0,0 +1,74 @@
14.4 +/*
14.5 + * Copyright 2000-2003 Sun Microsystems, Inc. All Rights Reserved.
14.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
14.7 + *
14.8 + * This code is free software; you can redistribute it and/or modify it
14.9 + * under the terms of the GNU General Public License version 2 only, as
14.10 + * published by the Free Software Foundation. Sun designates this
14.11 + * particular file as subject to the "Classpath" exception as provided
14.12 + * by Sun in the LICENSE file that accompanied this code.
14.13 + *
14.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
14.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14.16 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14.17 + * version 2 for more details (a copy is included in the LICENSE file that
14.18 + * accompanied this code).
14.19 + *
14.20 + * You should have received a copy of the GNU General Public License version
14.21 + * 2 along with this work; if not, write to the Free Software Foundation,
14.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
14.23 + *
14.24 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
14.25 + * CA 95054 USA or visit www.sun.com if you need additional information or
14.26 + * have any questions.
14.27 + */
14.28 +
14.29 +package sun.text;
14.30 +
14.31 +import java.text.AttributedCharacterIterator;
14.32 +import java.util.Iterator;
14.33 +import java.util.ServiceLoader;
14.34 +
14.35 +/*
14.36 + * (C) Copyright IBM Corp. 1999-2003 - All Rights Reserved
14.37 + *
14.38 + * The original version of this source code and documentation is
14.39 + * copyrighted and owned by IBM. These materials are provided
14.40 + * under terms of a License Agreement between IBM and Sun.
14.41 + * This technology is protected by multiple US and International
14.42 + * patents. This notice and attribution to IBM may not be removed.
14.43 + */
14.44 +public abstract class BidiProxy {
14.45 + public static BidiProxy getDefault() {
14.46 + Iterator<BidiProxy> it = ServiceLoader.load(BidiProxy.class).iterator();
14.47 + return it.hasNext() ? it.next() : new DefaultBidiProxy();
14.48 + }
14.49 +
14.50 + public abstract void init();
14.51 + public abstract Integer findDirection(AttributedCharacterIterator paragraph);
14.52 + public abstract void shapeText(AttributedCharacterIterator paragraph, char[] text);
14.53 + public abstract byte[] embedding(int start, AttributedCharacterIterator paragraph, byte[] embeddings, int length, int limit);
14.54 +
14.55 +
14.56 + private static final class DefaultBidiProxy extends BidiProxy {
14.57 +
14.58 + @Override
14.59 + public void init() {
14.60 + }
14.61 +
14.62 + @Override
14.63 + public Integer findDirection(AttributedCharacterIterator paragraph) {
14.64 + return null;
14.65 + }
14.66 +
14.67 + @Override
14.68 + public void shapeText(AttributedCharacterIterator paragraph, char[] text) {
14.69 + }
14.70 +
14.71 + @Override
14.72 + public byte[] embedding(int start, AttributedCharacterIterator paragraph, byte[] embeddings, int length, int limit) {
14.73 + return embeddings;
14.74 + }
14.75 + }
14.76 +}
14.77 +