getObjectInstance(Object, Name, Context, Hashtable)
513488
@Override
    public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable environment) throws Exception {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "getObjectInstance", new Object[] { obj, name, nameCtx, environment });
        Object ret = null;

        if (obj instanceof Reference) {
            Reference ref = (Reference) obj;
            String clsName = ref.getClassName();

            if (clsName.equals(ConnectionFactory.class.getName())) {
                ret = this.createConnectionFactory();
                ((JmsConnectionFactory) ret).setReference(ref);
            }

            else if (clsName.equals(QueueConnectionFactory.class.getName())) {
                ret = this.createQueueConnectionFactory();
                ((JmsQueueConnectionFactory) ret).setReference(ref);
            }

            else if (clsName.equals(TopicConnectionFactory.class.getName())) {
                ret = this.createTopicConnectionFactory();
                ((JmsTopicConnectionFactory) ret).setReference(ref);
            }

            else if (clsName.equals(JmsQueueImpl.class.getName())) {
                ret = new JmsQueueImpl(ref);
            }

            else if (clsName.equals(JmsTopicImpl.class.getName())) {
                ret = new JmsTopicImpl(ref);
            }

            else {
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                    SibTr.debug(tc, "class name is " + clsName);
            }
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "getObjectInstance", ret);
        return ret;
    }
289961
def get_object(self, binding_name, cls):
        
        return self._state.get_object(self, binding_name, cls)
393794
@Override
    public Object getMember(String name) {
        switch (name) {
            case "get":
            case "apply":
                return F_get;
            case "getString":
                return F_getString;
            case "getBinary":
                return F_getBinary;
            case "getBoolean":
                return F_getBoolean;
            case "getDate":
                return F_getDate;
            case "getDouble":
                return F_getDouble;
            case "getFloat":
                return F_getFloat;
            case "getInt":
                return F_getInt;
            case "getAs":
                return F_getAs;
            case "getTimestamp":
                return F_getTimestamp;
            case "getList":
            case "getArray":
                return F_getList;
            case "getStruct":
                return F_getStruct;
            case "mkString":
                return F_mkString;
            case "schema":
                return F_schema;
            case "length":
                return F_length;
            case "size":
                return F_length;
            case "anyNull":
                return F_anyNull;
            case "copy":
                return F_copy;
            case "equals":
                return F_equals;
            case "fieldIndex":
                return F_fieldIndex;
            case "hashCode":
                return F_hashCode;
            case "isNullAt":
                return F_isNullAt;
        }
        return super.getMember(name);
    }
1131165
@Override
    public Object getObject( final String    key,
                             final String    defaultClassName )
        throws
            UtilException
    {
        return formatObject( key, getString( key, defaultClassName ) );
    }
543064
private static Object getObjectFromWritable(Writable writable)
            throws IllegalAccessException, InstantiationException, InvocationTargetException {
        Object object = null;

        if (writable instanceof NullWritable) {
            object = NullWritable.get();
        } else if (writable instanceof BooleanWritable) {
            object = ((BooleanWritable) writable).get();
        } else if (writable instanceof Text) {
            object = writable.toString();
        } else if (writable instanceof ByteWritable) {
            object = ((ByteWritable) writable).get();
        } else if (writable instanceof IntWritable) {
            object = ((IntWritable) writable).get();
        } else if (writable instanceof LongWritable) {
            object = ((LongWritable) writable).get();
        } else if (writable instanceof BytesWritable) {
            object = ((BytesWritable) writable).getBytes();
        } else if (writable instanceof DoubleWritable) {
            object = ((DoubleWritable) writable).get();
        } else if (writable instanceof FloatWritable) {
            object = ((FloatWritable) writable).get();
        } else {
            // TODO : do nothing
        }

        return object;
    }
668370
@Override
    public Object getMember(String name) {
        switch (name) {
            case "version":
                return F_version;
            case "sparkContext":
                return F_sparkContext;
            case "sqlContext":
                return F_sqlContext;
//            case "listenerManager":
//                return F_listenerManager;
//            case "experimental":
//                return F_experimental;
            case "udf":
                return F_udf;
            case "streams":
                return F_streams;
            case "newSession":
                return F_newSession;
//            case "emptyDataset":
//                return F_emptyDataset;
            case "createDataFrame":
                return F_createDataFrame;
            case "createDataFrameFromJson":
                return F_createDataFrameFromJson;
            case "baseRelationToDataFrame":
                return F_baseRelationToDataFrame;
            case "createDataset":
                return F_createDataset;
            case "createDatasetFromJson":
                return F_createDatasetFromJson;
            case "range":
                return F_range;
            case "table":
                return F_table;
            case "sql":
                return F_sql;
            case "read":
                return F_read;
            case "readStream":
                return F_readStream;
            case "stop":
                return F_stop;
        }
        return super.getMember(name);
    }
267331
@Override
    public Object getMember(String name) {
        switch (name) {
            case "toJSON":
                return F_toJSON;
            case "toString":
                return F_toString;
            case "valueOf":
                return F_valueOf;
            case "getJavaObject":
                return F_getJavaObject;
        }
        return null;
//        throw new RuntimeException(getClassName() + "." + name + " is not defined");
    }
818184
@Override
    public Object getObjectInstance(Object o, Name n, Context c, Hashtable<?, ?> envmt) throws Exception {

        if (tc.isEntryEnabled()) {
            Tr.entry(tc, "getObjectInstance: o=" + o + ",name=" + n + ",context=" + c + ",evnmt=" + envmt);
        }

        if (!(o instanceof Reference)) {
            if (tc.isEntryEnabled()) {
                Tr.exit(tc, "Object " + o + " is not an instance of javax.naming.Reference. Returning null.");
            }
            return null;
        }
        Reference ref = (Reference) o;
        final Class<?> contextClass = Class.forName(ref.getClassName());
        if (tc.isDebugEnabled())
            Tr.debug(tc, "Creating a proxy for type {0}", contextClass);
        Object proxy = null;

        if (Application.class.equals(contextClass)) {
            if (tc.isDebugEnabled()) {
                Tr.debug(tc, "This is an Application sub-class being injected. Injecting an instance of ApplicationInjectionProxy.");
            }
            proxy = new ApplicationInjectionProxy();
        } else if (HttpServletRequest.class.equals(contextClass)) {
            if (tc.isDebugEnabled()) {
                Tr.debug(tc, "This is an HttpServletRequest sub-class being injected. Injecting an instance of HttpServletRequestInjectionProxy.");
            }
            proxy = new HttpServletRequestInjectionProxy();
        } else if (HttpServletResponse.class.equals(contextClass)) {
            if (tc.isDebugEnabled()) {
                Tr.debug(tc, "This is an HttpServletResponse sub-class being injected. Injecting an instance of HttpServletResponseInjectionProxy.");
            }
            proxy = new HttpServletResponseInjectionProxy();
        } else {
            proxy = Proxy.newProxyInstance(priv.getClassLoader(contextClass),
                                           new Class[] { contextClass },
                                           new InvocationHandler() {
                                               @Override
                                               public Object invoke(Object proxy,
                                                                    Method method,
                                                                    Object[] args) throws Throwable {
                                                   // Without these entry and exit calls RAS uses bytecode injection
                                                   // to insert Tr.entry on first line of this method and then Tr.exit
                                                   // on last lie. Tr.entry attempts to call proxy.toString(), which
                                                   // loops back to the invoke method again--hence resulting in a
                                                   // StackOverflowError
                                                   if (tc.isEntryEnabled()) {
                                                       Tr.entry(tc, "invoke");
                                                   }

                                                   Object result = null;
                                                   // use runtimeContext from TLS
                                                   InjectionRuntimeContext runtimeContext = InjectionRuntimeContextHelper.getRuntimeContext();

                                                   if ("toString".equals(method.getName()) && (method.getParameterTypes().length == 0)) {
                                                       result = "Proxy for " + contextClass.getName();
                                                       if (tc.isEntryEnabled()) {
                                                           Tr.exit(tc, "invoke", result);
                                                       }
                                                       return result;
                                                   }

                                                   // get the real context from the RuntimeContext
                                                   Object context = runtimeContext.getRuntimeCtxObject(contextClass.getName());
                                                   if (context != null) {
                                                       result = method.invoke(context, args);
                                                   }

                                                   if (tc.isEntryEnabled()) {
                                                       Tr.exit(tc, "invoke", result);
                                                   }
                                                   // invoke the method on the real context
                                                   return result;
                                               }
                                           });
        }

        if (tc.isEntryEnabled()) {
            Tr.exit(tc, "getObjectInstance", proxy);
        }

        return proxy;

    }
1232593
@Override
	public <T> T getObject(final int columnIndex, final Class<T> type) throws SQLException {
		return wrapped.getObject(columnIndex, type);
	}
168159
private synchronized void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {
        in.defaultReadObject();

        // rebuild hash hashtable
        hash = new Hashtable<>();
        for (NameValue<N, V> nameValue : order) {
            putInHash(nameValue.name, nameValue.value);
        }
    }
1367284
@Override
    public Object getObjectInstance(Object o, Name n, Context c, Hashtable<?, ?> envmt) throws Exception {
        @SuppressWarnings("unchecked")
        Hashtable<String, Object> env = (Hashtable<String, Object>) envmt;
        return (o instanceof Reference) ? resolve((Reference) o, env) : null;
    }
154029
@Override
    public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable<?, ?> env)
                    throws Exception {
        final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();

        // -----------------------------------------------------------------------
        // Is obj a Reference?
        // -----------------------------------------------------------------------
        if (!(obj instanceof Reference)) {
            return null;
        }

        Reference ref = (Reference) obj;

        // -----------------------------------------------------------------------
        // Is the right factory for this reference?
        // -----------------------------------------------------------------------
        if (!ivInstanceClassName.equals(ref.getFactoryClassName())) {
            return null;
        }

        // -----------------------------------------------------------------------
        // Is address null?
        // -----------------------------------------------------------------------
        RefAddr addr = ref.get(Addr_Type);
        if (addr == null) {
            NamingException nex = new NamingException("The address for this Reference is empty (null)");
            throw nex;
        }

        // -----------------------------------------------------------------------
        // Reference has the right factory and non empty address, so it is OK
        // to generate the EntityManager or EntityManagerFactory object now.
        // -----------------------------------------------------------------------

        Object retObj = null;

        JPAJndiLookupInfo info = (JPAJndiLookupInfo) addr.getContent();
        if (isTraceOn && tc.isDebugEnabled())
            Tr.debug(tc, "getting EntityManagerFactory for " + info);

        JPAPuId puId = info.getPuId(); // d424494
        J2EEName j2eeName = info.getJ2EEName(); // d510184
        String refName = info.getReferenceName(); // d510184
        boolean isSFSB = checkSFSBAccess(info, info.isSFSB()); // F743-30682
        JPAComponent jpaService = JPAAccessor.getJPAComponent();

        //Check to see see if we can delegate to the OSGi-aware JPA container
        JPALookupDelegate delegate = lookupDelegate.get();

        // If we find a delegate then call it to see if it can provide the Object
        if (delegate != null) {
            // Call the right method
            if (info.isFactory())
                retObj = delegate.getEntityManagerFactory(puId.getPuName(), j2eeName);
            else
                retObj = delegate.getEntityManager(puId.getPuName(), j2eeName, info.isExtendedContextType(), info.getPersistenceProperties());
        }

        if (retObj == null) {
            if (info.isFactory()) {
                retObj = jpaService.getEntityManagerFactory(puId,
                                                            j2eeName,
                                                            USE_EMF_PROXY_VALUE || isSFSB); // d706751
            } else {
                Map<?, ?> pCtxtProperties = info.getPersistenceProperties();
                retObj = jpaService.getEntityManager(puId,
                                                     j2eeName,
                                                     refName,
                                                     info.isExtendedContextType(),
                                                     info.isUnsynchronized(),
                                                     pCtxtProperties);

            }
        }

        return retObj;
    }
1252941
private <T> T getInstance(DatastoreType datastoreType, TransactionalCache.Mode cacheMode) {
        DatastoreId id = getDatastoreId(datastoreType);
        Object instance = cache.get(id, cacheMode);
        if (instance == null) {
            DynamicType<?> types = getTypes(datastoreType);
            instance = newInstance(id, datastoreType, types, cacheMode);
            if (TransactionalCache.Mode.READ.equals(cacheMode)) {
                instanceListenerService.postLoad(instance);
            }
        }
        return (T) instance;
    }
368532
@Override
    public Object getObjectInstance(JavaColonNamespace namespace, String name) throws NamingException {

        Object objectInstance = null;

        // java:app and java:global are the only namespaces that we could expect to find when
        // checking the server, so we'll only check those:
        if (JavaColonNamespace.APP.equals(namespace) || JavaColonNamespace.GLOBAL.equals(namespace)) {
            // ok, so either we have never looked it up before, or if we did it wasn't cacheable
            // so we must do the lookup on the server
            ComponentMetaData cmd = ComponentMetaDataAccessorImpl.getComponentMetaDataAccessor().getComponentMetaData();
            J2EEName j2eeName = cmd.getJ2EEName();
            RemoteObjectInstance roi = null;
            try {
                ClientSupport jndiHelper = clientSupportFactory.getRemoteClientSupport();
                roi = jndiHelper.getRemoteObjectInstance(j2eeName.getApplication(), j2eeName.getModule(), j2eeName.getComponent(), namespace.toString(), name);
            } catch (RemoteException ex) {
                //ffdc
                throw new NamingException("Failed remote lookup of " + namespace.prefix() + name);
            }

            if (roi != null) {
                try {
                    objectInstance = roi.getObject();
                    if (roi instanceof RemoteReferenceObjectInstanceImpl) {
                        // need to deserialize remote object byte array into javax.naming.Reference and re-construct
                        ObjectInputStream ois = null;
                        try {
                            byte[] bytes = (byte[]) objectInstance;
                            ClassLoader classLoader = AccessController.doPrivileged(new GetCL("this"));
                            DeserializationContext dc = serializationService.createDeserializationContext();
                            ois = dc.createObjectInputStream(new ByteArrayInputStream(bytes), classLoader);
                            objectInstance = ois.readObject();

                            if (objectInstance == null || !(objectInstance instanceof javax.naming.Reference)) {
                                throw new NamingException("Invalid reference returned from server");
                            }
                            javax.naming.Reference ref = (javax.naming.Reference) objectInstance;
                            String factoryClassName = ref.getFactoryClassName();
                            ObjectFactory objectFactory = null;
                            ObjectFactoryInfo info = objectFactoryInfos.get(factoryClassName);
                            if (info != null) {
                                objectFactory = info.getObjectFactoryClass().newInstance();
                            } else {
                                objectFactory = objectFactories.getServiceWithException(factoryClassName);
                            }
                            objectInstance = objectFactory.getObjectInstance(ref, null, null, null);
                            if (objectInstance == null) {
                                // should never happen
                                throw new NamingException("Could not object instance from object factory " + objectFactory);
                            }

                        } catch (Exception ex) {
                            NamingException ne = new NamingException("Failure occurred while reconstructing remote reference object");
                            ne.initCause(ex);
                            throw ne;
                        } finally {
                            if (ois != null)
                                try {
                                    ois.close();
                                } catch (IOException ex) {
                                }
                        }

                    }

                } catch (RemoteObjectInstanceException ex) {
                    //ffdc
                    NamingException ne = new NamingException();
                    ne.initCause(ex);
                    throw ne;
                }
            }
        }
        return objectInstance;
    }
939273
private Object getObjectPropertyImpl(Context cx, Object object,
                                           Object id) {
        Scriptable scriptable = (Scriptable)object;
        Object result;
        if (id instanceof String) {
            String name = (String)id;
            if (name.equals("this")) {
                result = scriptable;
            } else if (name.equals("__proto__")) {
                result = scriptable.getPrototype();
            } else if (name.equals("__parent__")) {
                result = scriptable.getParentScope();
            } else {
                result = ScriptableObject.getProperty(scriptable, name);
                if (result == ScriptableObject.NOT_FOUND) {
                    result = Undefined.instance;
                }
            }
        } else {
            int index = ((Integer)id).intValue();
            result = ScriptableObject.getProperty(scriptable, index);
            if (result == ScriptableObject.NOT_FOUND) {
                result = Undefined.instance;
            }
        }
        return result;
    }
58545
@Override
    public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable<?, ?> environment) throws Exception {
        if (obj instanceof Reference) {
            try {
                String jndiName = nameCtx == null ? "" : nameCtx.getNameInNamespace();
                jndiName += name == null ? "" : name.toString();
                String urlValue = (String) ((Reference) obj).get(0).getContent();
                return createURL(jndiName, urlValue);
            } catch (Throwable t) {
                NamingException ne = new NamingException();
                ne.initCause(t);
                throw ne;
            }
        }

        return null;
    }
432799
int getObjectID(Object element) {
        if (element == null) return NULL;
        else if (Cell.class.isInstance(element)) return CELL;
        else if (Table.class.isInstance(element)) return TABLE; 
        return -1;
    }