2362N/A * Copyright (c) 1999, 2005, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 2362N/A * published by the Free Software Foundation. Oracle designates this 0N/A * particular file as subject to the "Classpath" exception as provided 2362N/A * by Oracle in the LICENSE file that accompanied this code. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2362N/A * or visit www.oracle.com if you need additional information or have any 0N/A * Class containing static methods and constants for dealing with 0N/A * @author Vincent Ryan 0N/A * @author Rosanna Lee 0N/A private Obj () {};
// Make sure no one can create one 0N/A // package private; used by Connection 0N/A // LDAP attributes used to support Java objects. 0N/A "javaSerializedData",
0N/A "javaReferenceAddress",
0N/A "javaRemoteLocation" // Deprecated 0N/A // LDAP object classes to support Java objects 0N/A "javaNamingReference",
0N/A "javaSerializedObject",
0N/A "javaMarshalledObject",
0N/A "javanamingreference",
0N/A "javaserializedobject",
0N/A "javamarshalledobject",
0N/A static final int REF_OBJECT =
2;
// auxiliary reference object class 0N/A static final int SER_OBJECT =
3;
// auxiliary serialized object class 0N/A static final int MAR_OBJECT =
4;
// auxiliary marshalled object class 0N/A * Encode an object in LDAP attributes. 0N/A * Supports binding Referenceable or Reference, Serializable, 0N/A * If the object supports the Referenceable interface then encode 0N/A * the reference to the object. See encodeReference() for details. 0N/A * If the object is serializable, it is stored as follows: 0N/A * value: Object.getClass(); 0N/A * javaSerializedData 0N/A * value: serialized form of Object (in binary form). 0N/A * value: getTypeNames(Object.getClass()); 0N/A // Serializable Object 0N/A // DirContext Object 0N/A "can only bind Referenceable, Serializable, DirContext");
0N/A // System.err.println(attrs); 0N/A * Each value in javaCodebase contains a list of space-separated 0N/A * URLs. Each value is independent; we can pick any of the values 0N/A * so we just use the first one. 0N/A * @return an array of URL strings for the codebase 0N/A * Decode an object from LDAP attribute(s). 0N/A * The object may be a Reference, or a Serialized object. 0N/A * See encodeObject() and encodeReference() for details on formats 0N/A // Get codebase, which is used in all 3 cases. 0N/A // For backward compatibility only 0N/A * Convert a Reference object into several LDAP attributes. 0N/A * A Reference is stored as into the following attributes: 0N/A * value: Reference.getClassName(); 0N/A * value: Reference.getFactoryClassName(); 0N/A * value: Reference.getFactoryClassLocation(); 0N/A * javaReferenceAddress 0N/A * value: #0#typeA#valA 0N/A * value: #1#typeB#valB 0N/A * value: #2#typeC##[serialized RefAddr C] 0N/A * value: #3#typeD#valD 0N/A * - the first character denotes the separator 0N/A * - the number following the first separator denotes the position 0N/A * of the RefAddr within the Reference 0N/A * - "typeA" is RefAddr.getType() 0N/A * - ## denotes that the Base64-encoded form of the non-StringRefAddr 0N/A * is to follow; otherwise the value that follows is 0N/A * StringRefAddr.getContents() 0N/A * The default separator is the hash character (#). 0N/A * May provide property for this in future. 0N/A // Get original object's types if caller has not explicitly 0N/A // specified other type names 0N/A * A RMI object is stored in the directory as 0N/A * value: Object.getClass(); 0N/A * javaRemoteLocation 0N/A * value: URL of RMI object (accessed through the RMI Registry) 0N/A * value: URL of codebase of where to find classes for object 0N/A * Return the RMI Location URL itself. This will be turned into 0N/A * an RMI object when getObjectInstance() is called on it. 0N/A * %%% Ignore codebase for now. Depend on RMI registry to send code.-RL 0N/A * @deprecated For backward compatibility only 0N/A * Restore a Reference object from several LDAP attributes 0N/A " attribute is required");
0N/A * string encoding of a RefAddr is either: 0N/A * #posn#<type>#<address> 0N/A * #posn#<type>##<base64-encoded address> 0N/A * Temporary Vector for decoded RefAddr addresses - used to ensure 0N/A * unordered addresses are correctly re-ordered. 0N/A "empty attribute value");
0N/A // first character denotes encoding separator 0N/A // extract position within Reference 0N/A "empty RefAddr position");
0N/A "RefAddr position not an integer");
0N/A start =
sep +
1;
// skip over position and trailing separator 0N/A "RefAddr type not found");
0N/A "empty RefAddr type");
0N/A start =
sep +
1;
// skip over type and trailing separator 0N/A // Double separators indicate a non-StringRefAddr 0N/A // Content is a Base64-encoded serialized RefAddr 0N/A ++
start;
// skip over consecutive separator 0N/A // %%% RL: exception if empty after double separator 0N/A // Single separator indicates a StringRefAddr 0N/A // Copy to real reference 0N/A * Serialize an object into a byte array 0N/A * Deserializes a byte array into an object. 0N/A // Create ObjectInputStream for deserialization 0N/A * Returns the attributes to bind given an object and its attributes. 0N/A // Call state factories to convert object and attrs 0N/A // We're only storing attributes; no further processing required 0N/A //if object to be bound is a DirContext extract its attributes 0N/A // Create "objectClass" attribute 0N/A // No objectclasses supplied, use "top" to start 0N/A // Get existing objectclass attribute 0N/A // No objectclasses supplied, use "top" to start 0N/A // convert the supplied object into LDAP attributes 0N/A // System.err.println("Determined: " + attrs); 0N/A * An ObjectInputStream that uses a class loader to find classes. 0N/A // %%% Should use Class.forName(desc.getName(), false, classLoader); 0N/A // except we can't because that is only available on JDK1.2 0N/A // define proxy in class loader of non-public interface(s), if any 0N/A "conflicting non-public interface class loaders");