Java 8 BinaryRefAddr - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 BinaryRefAddr class.

This code example shows how to use the following methods:
        catch (IOException e)
        { 
            throw new NamingException(e.getMessage());
        } 
 
        BinaryRefAddr handle = new BinaryRefAddr("com.impetus.kundera.persistence.jta", outStream.toByteArray());
        Reference ret = new Reference(object.getClass().getName(), handle, UserTransactionFactory.class.getName(), null);
        return ret;
    } 
} 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getContent
    public Object getObjectInstance(Object o, Name name, Context context, Hashtable<?, ?> hashtable) throws Exception {
        if (o instanceof Reference) {
            Reference ref = (Reference) o;
            if (ref.getClassName().equals(DataSourceService.class.getName())) {
                BinaryRefAddr addr = (BinaryRefAddr) ref.get(0);
                ByteArrayInputStream bais = new ByteArrayInputStream((byte[]) addr.getContent());
                ObjectInputStream in = new ObjectInputStream(bais);
                DataSourceDescription dataSourceDescription = (DataSourceDescription) in.readObject();
                Hashtable dict = new Hashtable();
                dict.put(OSGI_JNDI_SERVICE_NAME, dataSourceDescription.getOsgiServiceName());
                ServiceReference[] serviceReferences = bundleContext.getServiceReferences(javax.sql.DataSource.class.getName(), "(" + OSGI_JNDI_SERVICE_NAME + "=" + dataSourceDescription.getOsgiServiceName() + ")");
                if (serviceReferences != null && serviceReferences.length > 0) {
                    Object result = bundleContext.getService(serviceReferences[0]);
                    return result; 
                } 
                String objectName = abName.toString();
//                BundleContext bundleContext = (BundleContext) hashtable.get(BUNDLE_CONTEXT); 
                DataSourceService dataSourceGBean = new DataSourceService(dataSourceDescription, connectionTracker, txManager, objectName, null);
                bundleContext.registerService(new String[] {javax.sql.DataSource.class.getName()}, dataSourceGBean, dict);
                return dataSourceGBean.$getResource();
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
                jndiProxyDataSource.getDataSourceName(), 
                jndiProxyDataSource.getListener() 
        }; 
 
        return new Reference(JndiProxyDataSource.class.getName(),
                new BinaryRefAddr(infoAddressType, toByteArray(parentInfo)),
                JndiProxyDataSourceFactory.class.getName(), null);
    } 
 
    static byte[] toByteArray(Object obj) { 
        try { 
            ByteArrayOutputStream bOut = new ByteArrayOutputStream();
            ObjectOutputStream oOut = new ObjectOutputStream(bOut);
            oOut.writeObject(obj);
            oOut.close();
            return bOut.toByteArray();
        } catch (IOException e) {
            throw new RuntimeException(e);
        } 
    } 
3
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
See Code Examples for Java 8 BinaryRefAddr Methods: