Returns a replacement object that can be serialized instead of WSJdbcDataSource.

@param resRefConfigFactory factory for resource ref config.
@return a replacement object that can be serialized instead of WSJdbcDataSource.
514705
Object replaceObject(ResourceRefConfigFactory resRefConfigFactory) {
        DSConfig config = dsConfig.get();
        String filter = config.jndiName == null || config.jndiName.startsWith("java:")
                        ? FilterUtils.createPropertyFilter("config.displayId", config.id)
                        : FilterUtils.createPropertyFilter(ResourceFactory.JNDI_NAME, config.jndiName);
        ResourceRefConfig resRefConfig = resRefInfo == null ? null : resRefConfigFactory.createResourceRefConfig(DataSource.class.getName());
        if (resRefInfo != null) {
            resRefConfig.setBranchCoupling(resRefInfo.getBranchCoupling());
            resRefConfig.setCommitPriority(resRefInfo.getCommitPriority());
            resRefConfig.setIsolationLevel(resRefInfo.getIsolationLevel());
            resRefConfig.setJNDIName(resRefInfo.getJNDIName());
            resRefConfig.setLoginConfigurationName(resRefInfo.getLoginConfigurationName());
            resRefConfig.setResAuthType(resRefInfo.getAuth());
            resRefConfig.setSharingScope(resRefInfo.getSharingScope());
        }
        return new SerializedDataSourceWrapper(filter, resRefConfig);
    }
29338
public static RefCapablePropertyResourceBundle
            getBundle(String baseName, Locale locale, ClassLoader loader) {
        return getRef(baseName,
                ResourceBundle.getBundle(baseName, locale, loader), loader);
    }
1325462
private static PBXObjectRef createPBXBuildFile(final PBXObjectRef fileRef, final Map settings) {
    final Map map = new HashMap();
    map.put("fileRef", fileRef);
    map.put("isa", "PBXBuildFile");
    if (settings != null) {
      map.put("settings", settings);
    }
    return new PBXObjectRef(map);
  }
42105
@FFDCIgnore(Exception.class)
    public DataSource getDataSource() throws Exception {
        if (tc.isEntryEnabled())
            Tr.entry(tc, "getDataSource");

        // Retrieve the data source factory from the CustomLogProperties. This Factory should be set in the JTMConfigurationProvider
        // by the jdbc component using DeclarativeServices. TxRecoveryAgentImpl gets the factory from the ConfigurationProvider and
        // then sets it into CustomLogProperties.
        ResourceFactory dataSourceFactory = _customLogProperties.resourceFactory();

        if (dataSourceFactory != null) {
            if (tc.isDebugEnabled())
                Tr.debug(tc, "Using DataSourceFactory " + dataSourceFactory);
        } else {
            if (tc.isEntryEnabled())
                Tr.exit(tc, "getDataSource", "Null ResourceFactory InternalLogException");
            throw new InternalLogException("Failed to locate DataSource, null Resourcefactory", null);
        }

        try {
            nonTranDataSource = (DataSource) dataSourceFactory.createResource(null);
        } catch (Exception e) {
            //e.printStackTrace();
            if (tc.isEntryEnabled())
                Tr.exit(tc, "getDataSource", "Caught exception " + e + "throw InternalLogException");
            throw new InternalLogException("Failed to locate DataSource, caught exception ", null);
        }

/*
 * TEMPORARY This is waiting on fixes to DeclarativeServices which impact the jdbc component. At present it is
 * possible that the DataSource will have been set but that its associated jdbc driver service will still be initialising
 */
//        boolean refSet = false;
//        while (!refSet)
//        {
//            if (tc.isDebugEnabled())
//                Tr.debug(tc, "getDataSource after sleep");
//            try {
//
//                nonTranDataSource = (DataSource) dataSourceFactory.createResource(null);
//                if (tc.isDebugEnabled())
//                    Tr.debug(tc, "Non Tran dataSource is " + nonTranDataSource);
//                Connection conn = nonTranDataSource.getConnection();
//                if (tc.isDebugEnabled())
//                    Tr.debug(tc, "Established connection " + conn);
//
//                DatabaseMetaData mdata = conn.getMetaData();
//
//                String dbName = mdata.getDatabaseProductName();
//                if (tc.isDebugEnabled())
//                    Tr.debug(tc, "Database name " + dbName);
//
//                String dbVersion = mdata.getDatabaseProductVersion();
//                if (tc.isDebugEnabled())
//                    Tr.debug(tc, "Database version " + dbVersion);
//                refSet = true;
//            } catch (Exception e) {
//                // We will catch an exception if the DataSource is not yet fully formed
//                if (tc.isDebugEnabled())
//                    Tr.debug(tc, "Caught exception: " + e);
//            }
//
//            if (!refSet)
//                Thread.sleep(200);
//        }
// eof TEMPORARY

        if (tc.isEntryEnabled())
            Tr.exit(tc, "getDataSource", nonTranDataSource);
        return nonTranDataSource;
    }
931265
public static DataSourceConfiguration getDataSourceConfiguration(final DataSource dataSource) {
        DataSourceConfiguration result = new DataSourceConfiguration(dataSource.getClass().getName());
        result.getProperties().putAll(findAllGetterProperties(dataSource));
        return result;
    }
809074
protected AbstractMetadataResolver buildMetadataResolverFrom(final SamlRegisteredService service,
                                                                 final SamlMetadataDocument metadataDocument) {
        try {
            val desc = StringUtils.defaultString(service.getDescription(), service.getName());
            val metadataResource = ResourceUtils.buildInputStreamResourceFrom(metadataDocument.getDecodedValue(), desc);
            val metadataResolver = new InMemoryResourceMetadataResolver(metadataResource, configBean);

            val metadataFilterList = new ArrayList<MetadataFilter>();
            if (StringUtils.isNotBlank(metadataDocument.getSignature())) {
                val signatureResource = ResourceUtils.buildInputStreamResourceFrom(metadataDocument.getSignature(), desc);
                buildSignatureValidationFilterIfNeeded(service, metadataFilterList, signatureResource);
            }
            configureAndInitializeSingleMetadataResolver(metadataResolver, service, metadataFilterList);
            return metadataResolver;
        } catch (final Exception e) {
            LOGGER.error(e.getMessage(), e);
        }
        return null;
    }
1346613
@Override
  public DataSourceMetadata getDataSourceMetadata(final String dataSource)
  {
    final byte[] bytes = connector.lookup(
        dbTables.getDataSourceTable(),
        "dataSource",
        "commit_metadata_payload",
        dataSource
    );

    if (bytes == null) {
      return null;
    }

    try {
      return jsonMapper.readValue(bytes, DataSourceMetadata.class);
    }
    catch (Exception e) {
      throw new RuntimeException(e);
    }
  }
1302568
public static DataSource getDataSource(final String dataSourceClassName, final Map<String, Object> dataSourceProperties) throws ReflectiveOperationException {
        DataSource result = (DataSource) Class.forName(dataSourceClassName).newInstance();
        for (Entry<String, Object> entry : dataSourceProperties.entrySet()) {
            callSetterMethod(result, getSetterMethodName(entry.getKey()), null == entry.getValue() ? null : entry.getValue().toString());
        }
        return result;
    }
1232071
public ResponseBuilder setResource(final Resource res) {
        final String baseUrl = getBaseUrl();
        final String identifier = baseUrl + req.getPartition() + req.getPath() +
            (ACL.equals(req.getExt()) ? "?ext=acl" : "");

        // Check the cache
        ofNullable(res).ifPresent(r -> checkResourceCache(identifier, r));

        final Session session = ofNullable(req.getSession()).orElseGet(HttpSession::new);
        final Optional<RDFSyntax> rdfSyntax = ofNullable(req.getContentType()).flatMap(RDFSyntax::byMediaType)
            .filter(SUPPORTED_RDF_TYPES::contains);

        // One cannot put binaries into the ACL graph
        if (isAclAndNonRdfContent(rdfSyntax)) {
            return status(NOT_ACCEPTABLE);
        }

        LOGGER.info("Setting resource as {}", identifier);

        final IRI heuristicType = nonNull(req.getContentType()) && !rdfSyntax.isPresent() ?
            LDP.NonRDFSource : LDP.RDFSource;

        final IRI defaultType = ofNullable(res).map(Resource::getInteractionModel).orElse(heuristicType);

        final IRI ldpType = ofNullable(req.getLink()).filter(l -> "type".equals(l.getRel()))
                    .map(Link::getUri).map(URI::toString).filter(l -> l.startsWith(LDP.URI)).map(rdf::createIRI)
                    .filter(l -> !LDP.Resource.equals(l)).orElse(defaultType);

        // It is not possible to change the LDP type to a type that is not a subclass
        if (nonNull(res) && !ldpResourceTypes(ldpType).anyMatch(res.getInteractionModel()::equals)) {
            return status(CONFLICT).entity("Cannot change the LDP type to " + ldpType).type(TEXT_PLAIN);
        }

        final IRI internalId = rdf.createIRI(TRELLIS_PREFIX + req.getPartition() + req.getPath());

        try (final TrellisDataset dataset = TrellisDataset.createDataset()) {
            final IRI graphName = getActiveGraphName();
            final IRI otherGraph = getInactiveGraphName();

            // Add audit quads
            audit.map(addAuditQuads(res, internalId, session)).ifPresent(q ->
                    q.stream().map(skolemizeQuads(resourceService, baseUrl)).forEachOrdered(dataset::add));

            // Add LDP type
            dataset.add(rdf.createQuad(PreferServerManaged, internalId, RDF.type, ldpType));

            // Add user-supplied data
            if (rdfSyntax.isPresent()) {
                readEntityIntoDataset(identifier, baseUrl, graphName, rdfSyntax.get(), dataset);

                // Check for any constraints
                checkConstraint(dataset, PreferUserManaged, ldpType, baseUrl, rdfSyntax.get());

            } else {
                // Check the expected digest value
                final Digest digest = req.getDigest();
                if (nonNull(digest) && !getDigestForEntity(digest).equals(digest.getDigest())) {
                    return status(BAD_REQUEST);
                }

                final Map<String, String> metadata = singletonMap(CONTENT_TYPE, ofNullable(req.getContentType())
                        .orElse(APPLICATION_OCTET_STREAM));
                final IRI binaryLocation = rdf.createIRI(binaryService.getIdentifierSupplier(req.getPartition()).get());

                // Persist the content
                persistContent(binaryLocation, metadata);

                dataset.add(rdf.createQuad(PreferServerManaged, internalId, DC.hasPart, binaryLocation));
                dataset.add(rdf.createQuad(PreferServerManaged, binaryLocation, DC.modified,
                            rdf.createLiteral(now().toString(), XSD.dateTime)));
                dataset.add(rdf.createQuad(PreferServerManaged, binaryLocation, DC.format,
                            rdf.createLiteral(ofNullable(req.getContentType()).orElse(APPLICATION_OCTET_STREAM))));
                dataset.add(rdf.createQuad(PreferServerManaged, binaryLocation, DC.extent,
                            rdf.createLiteral(Long.toString(entity.length()), XSD.long_)));
            }

            if (nonNull(res)) {
                try (final Stream<? extends Triple> remaining = res.stream(otherGraph)) {
                    remaining.map(t -> rdf.createQuad(otherGraph, t.getSubject(), t.getPredicate(), t.getObject()))
                        .forEachOrdered(dataset::add);
                }
            }

            if (resourceService.put(internalId, dataset.asDataset())) {
                final ResponseBuilder builder = status(NO_CONTENT);

                ldpResourceTypes(ldpType).map(IRI::getIRIString).forEach(type -> builder.link(type, "type"));
                return builder;
            }
        }

        LOGGER.error("Unable to persist data to location at {}", internalId.getIRIString());
        return serverError().type(TEXT_PLAIN)
            .entity("Unable to persist data. Please consult the logs for more information");
    }
401882
private static PropertySourceGenerator getSourceGenerator(final ErrorBuffer errorBuffer, final String className, final PropertyDefinition propertyDefinition) throws FrameworkException {

		final String propertyName                                  = propertyDefinition.getPropertyName();
		final Type propertyType                                    = propertyDefinition.getPropertyType();
		final Class<? extends PropertySourceGenerator> parserClass = parserMap.get(propertyType);

		try {

			return parserClass.getConstructor(ErrorBuffer.class, String.class, PropertyDefinition.class).newInstance(errorBuffer, className, propertyDefinition);

		} catch (Throwable t) {
			logger.warn("", t);
		}

		errorBuffer.add(new InvalidPropertySchemaToken(SchemaProperty.class.getSimpleName(), propertyName, propertyName, "invalid_property_definition", "Unknow value type " + source + ", options are " + Arrays.asList(Type.values()) + "."));
		throw new FrameworkException(422, "Invalid property definition for property " + propertyDefinition.getPropertyName(), errorBuffer);
	}
1316256
public static DatasourceDependencyBuilder copyOf(final DatasourceDependency prototype) {
        return new DatasourceDependencyBuilder()
                .withName(prototype.getName())
                .withDescription(prototype.getDescription())
                .withType(prototype.getType())
                .withSubtype(prototype.getSubtype())
                .withDatasources(prototype.getDatasources())
                .withCriticality(prototype.getCriticality())
                .withExpectations(prototype.getExpectations());
    }
295938
private static DataSource getNewDataSource(final String dataSourceName) {
		try {
			Context context = new InitialContext();
			return (DataSource) context.lookup(dataSourceName);
		} catch (NamingException ex) {
			throw new UroborosqlRuntimeException("DataSource[" + dataSourceName + "] can not be acquired.", ex);
		}
	}
671000
public static Converter<String,String> replaceDataReferencesConverter(final Map<String, Map<String, String>> data) {
        return replaceDataReferencesConverter(data, null, false);
    }
44909
@Override
  public ServiceRefAmp toRef(Object serviceImpl)
  {
    if (serviceImpl instanceof ProxyHandleAmp) {
      ProxyHandleAmp proxy = (ProxyHandleAmp) serviceImpl;
      
      return proxy.__caucho_getServiceRef();
    }
    
    Objects.requireNonNull(serviceImpl);
    
    return new ServiceBuilderImpl<>(this, serviceImpl).ref();
  }
1078512
static private RefCapablePropertyResourceBundle getRef(String baseName,
            ResourceBundle rb, ClassLoader loader) {
        if (!(rb instanceof PropertyResourceBundle))
            throw new MissingResourceException(
                    "Found a Resource Bundle, but it is a "
                            + rb.getClass().getName(),
                    PropertyResourceBundle.class.getName(), null);
        if (allBundles.containsKey(rb))
            return (RefCapablePropertyResourceBundle) allBundles.get(rb);
        RefCapablePropertyResourceBundle newPRAFP =
                new RefCapablePropertyResourceBundle(baseName,
                        (PropertyResourceBundle) rb, loader);
        allBundles.put(rb, newPRAFP);
        return newPRAFP;
    }
1345780
public DataSource getDataSource(String dataSourceName) throws ServiceLocatorException {
		DataSource dataSource = null;
		try {
			dataSource = (DataSource) ic.lookup(dataSourceName);
		} catch (NamingException ne) {
			throw new ServiceLocatorException(ne);
		} catch (Exception e) {
			throw new ServiceLocatorException(e);
		}
		return dataSource;
	}
809246
public com.google.cloud.datalabeling.v1beta1.GcsSourceOrBuilder getGcsSourceOrBuilder() {
    if (sourceCase_ == 2) {
      return (com.google.cloud.datalabeling.v1beta1.GcsSource) source_;
    }
    return com.google.cloud.datalabeling.v1beta1.GcsSource.getDefaultInstance();
  }