For use by the JCA resource adaptor.
435423
@Override
    public ConnectionFactory createConnectionFactory(JmsJcaConnectionFactory jcaConnectionFactory, JmsJcaManagedConnectionFactory jcaManagedConnectionFactory) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "createConnectionFactory", new Object[] { jcaConnectionFactory, jcaManagedConnectionFactory });
        ConnectionFactory cf = new JmsConnectionFactoryImpl(jcaConnectionFactory, jcaManagedConnectionFactory);
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "createConnectionFactory", cf);
        return cf;
    }
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);
    }
505829
private void writeResources(List<Resource> resources)
            throws JsonGenerationException, IOException {

        List<String> resourceStrings = new ArrayList<String>();

        for (Resource resource : resources) {
            resourceStrings.add(resource.getId());
        }
        writeJsonArray(JsonDocumentFields.RESOURCE, resourceStrings);
    }
422942
protected void buildJsonResourceItems(List<CmsResource> resourceitems, String parentFolder) {

        if (resourceitems == null) {
            resourceitems = new ArrayList<CmsResource>();
        }

        boolean isPublishEnabled = false;
        boolean hasDirectPublish = false;
        boolean hasWritePermission = false;
        if (CmsStringUtil.isNotEmpty(parentFolder)) {
            // check if there are changes in the currently selected gallery and the user has direct edit permissions
            try {
                if ((OpenCms.getPublishManager().getPublishList(
                    getCms(),
                    getCms().readResource(parentFolder),
                    false).size() > 0)) {
                    isPublishEnabled = true;
                }
            } catch (CmsException e) {
                // ignore, gallery can not be published
            }
            // check if the user has direst publish permissions,
            // used to enable the gallerypublish button, if user has enough permissions
            try {
                if (getCms().hasPermissions(
                    getCms().readResource(parentFolder),
                    CmsPermissionSet.ACCESS_DIRECT_PUBLISH,
                    false,
                    CmsResourceFilter.ALL)) {
                    hasDirectPublish = true;
                }
            } catch (CmsException e) {
                // ignore, no publish permissions for gallery
            }
            try {
                // check if the user has write permissions,
                // used to display the upload buttons
                if (getCms().hasPermissions(
                    getCms().readResource(parentFolder),
                    CmsPermissionSet.ACCESS_WRITE,
                    false,
                    CmsResourceFilter.ALL)) {
                    hasWritePermission = true;
                }
            } catch (CmsException e) {
                // ignore, no write permissions for gallery
            }
        }
        JSONObject publishInfo = new JSONObject();
        try {
            publishInfo.put("publishable", isPublishEnabled);
            publishInfo.put("directpublish", hasDirectPublish);
            publishInfo.put("writepermission", hasWritePermission);
        } catch (JSONException e) {
            // ignore
        }
        JSONArray items = new JSONArray();
        items.put(publishInfo);
        Iterator<CmsResource> i = resourceitems.iterator();
        while (i.hasNext()) {
            CmsResource res = i.next();
            // build a JSON object from the item and add it to the list
            items.put(buildJsonItemObject(res));
        }
        JspWriter out = getJsp().getJspContext().getOut();
        try {
            // print the JSON array
            out.print(items.toString());
        } catch (IOException e) {
            if (LOG.isErrorEnabled()) {
                LOG.error(e.getLocalizedMessage(), e);
            }
        }
    }
1011577
public void execute() throws MojoFailureException, MojoExecutionException {
        // Validate
        validateArtifactInformation();

        Artifact artifact =
                artifactFactory.createArtifactWithClassifier( groupId, artifactId, version, packaging, classifier );

        File existingFile = getLocalRepoFile(artifact);
        if (existingFile != null && existingFile.exists()) {
            System.out.println("Using cached remapped artifact "+ existingFile.getPath()); // delete file to reinstall
            return; // success
        }

        // Remap
        File outJar = null;
        try {
            // load input jar(s), as one combined jar (for jarmods)
            List<File> files = new ArrayList<File>();
            for (String filename : inJars) {
                files.add(FileLocator.getFile(filename));
            }
            Jar inJar = Jar.init(files);

            // temporary output file
            outJar = File.createTempFile(groupId + "." + artifactId + "-" + version, "." + packaging);

            // mappings
            JarMapping mapping = new JarMapping();
            if (excludedPackages != null) {
                for (String packageName : excludedPackages) {
                    mapping.addExcludedPackage(packageName);
                }
            }
            mapping.loadMappings(srgIn, reverse, numeric, inShadeRelocation, outShadeRelocation);
            mapping.setFallbackInheritanceProvider(new JarProvider(inJar));


            // access transformers
            RemapperProcessor preprocessor = null;
            if (accessTransformers != null) {
                AccessMap accessMap = new AccessMap();

                for (String filename : accessTransformers) {
                    if (filename != null && filename.length() != 0) {
                        accessMap.loadAccessTransformer(filename);
                    }
                }

                preprocessor = new RemapperProcessor(null, null, accessMap);
            }

            // Do the remap
            JarRemapper remapper = new JarRemapper(preprocessor, mapping);
            remapper.setGenerateAPI(generateAPI);
            remapper.remapJar(inJar, outJar);
        } catch (Exception ex) {
            ex.printStackTrace();
            throw new MojoExecutionException("Error creating remapped jar at "+outJar+": " + ex.getMessage(), ex);
        }

        // Replace main artifact with this remapped artifact
        if (replaceMainArtifact) {
            getLog().info("Replacing original artifact with remapped artifact.");
            File originalArtifact = project.getArtifact().getFile();
            originalArtifact.delete();
            if (!outJar.renameTo(originalArtifact)) {
                throw new MojoExecutionException("Error replacing remapped jar at "+originalArtifact+" with "+outJar);
            }
        }

        // Attach output artifact to this project
        if (attachArtifact) {
            if (attachArtifactClassifier == null || attachArtifactClassifier.equals("")) {
                attachArtifactClassifier = null;
            }

            getLog().info("Attaching artifact " + outJar.getPath());
            projectHelper.attachArtifact(project, attachArtifactType, attachArtifactClassifier, outJar);
        }

        // Install output artifact to local repository
        if (installArtifact) {
            installArtifact(artifact, outJar);
        }
    }
858785
public static <T> T withJsonResource(String resourceClasspath,
            TypeReference<T> typeReference) {
        return withJsonInputStream(
                JMResources.getResourceInputStream(resourceClasspath),
                typeReference);
    }
1102424
private Object createResource(String refName, String className, String bindingName, ResourceInfo resourceRefInfo) throws Exception {
        String nameFilter = FilterUtils.createPropertyFilter(ResourceFactory.JNDI_NAME, bindingName);
        String createsFilter = className == null ? null : FilterUtils.createPropertyFilter(ResourceFactory.CREATES_OBJECT_CLASS, className);
        String filter = createsFilter == null ? nameFilter : "(&" + nameFilter + createsFilter + ")";
        ResourceInfo resInfo = resourceRefInfo != null ? resourceRefInfo : className != null ? new ResourceEnvRefInfo(refName, className) : null;
        return createResourceWithFilter(filter, resInfo);
    }
726291
def handle_resourcelist(ltext, **kwargs):
    '''
    
    '''
    base=kwargs.get('base', VERSA_BASEIRI)
    model=kwargs.get('model')
    iris = ltext.strip().split()
    newlist = model.generate_resource()
    for i in iris:
        model.add(newlist, VERSA_BASEIRI + 'item', I(iri.absolutize(i, base)))
    return newlist
336057
private static Column getCurrentResourceColumn(DataSource dataSource, Integer size,
      Resource currentResource, String itemResourceType) {

    Iterator<Resource> items = dataSource.iterator();

    boolean hasMore = false;
    if (size != null) {
      List<Resource> list = new ArrayList<Resource>();
      while (items.hasNext() && list.size() < size) {
        list.add(items.next());
      }
      hasMore = items.hasNext();
      items = list.iterator();
    }

    Column column = new Column()
        .columnId(currentResource.getPath())
        .hasMore(hasMore)
        .metaElement(true);
    while (items.hasNext()) {
      Resource item = items.next();
      column.addItem(new ColumnItem(item)
          .resourceType(itemResourceType));
    }

    return column;
  }
872133
protected void preProcessResourceForStorage(T theResource) {
		String type = getContext().getResourceDefinition(theResource).getName();
		if (!getResourceName().equals(type)) {
			throw new InvalidRequestException(getContext().getLocalizer().getMessage(BaseHapiFhirResourceDao.class, "incorrectResourceType", type, getResourceName()));
		}

		if (theResource.getIdElement().hasIdPart()) {
			if (!theResource.getIdElement().isIdPartValid()) {
				throw new InvalidRequestException(getContext().getLocalizer().getMessage(BaseHapiFhirResourceDao.class, "failedToCreateWithInvalidId", theResource.getIdElement().getIdPart()));
			}
		}

		/*
		 * Replace absolute references with relative ones if configured to do so
		 */
		if (getConfig().getTreatBaseUrlsAsLocal().isEmpty() == false) {
			FhirTerser t = getContext().newTerser();
			List<ResourceReferenceInfo> refs = t.getAllResourceReferences(theResource);
			for (ResourceReferenceInfo nextRef : refs) {
				IIdType refId = nextRef.getResourceReference().getReferenceElement();
				if (refId != null && refId.hasBaseUrl()) {
					if (getConfig().getTreatBaseUrlsAsLocal().contains(refId.getBaseUrl())) {
						IIdType newRefId = refId.toUnqualified();
						nextRef.getResourceReference().setReference(newRefId.getValue());
					}
				}
			}
		}
	}
162036
private void parseResources(Element element, BeanDefinitionBuilder builder,
                                ManagedList<AbstractBeanDefinition> resourceList) {
        NodeList resources = element.getChildNodes();

        for (int i = 0; i < resources.getLength(); i++) {
            Node node = resources.item(i);

            if (!(node instanceof Element)) {
                continue;
            }

            Element resource = (Element) resources.item(i);
            Class<? extends IPluginResource> resourceClass = null;

            switch (getResourceType(getNodeName(resource))) {
                case button:
                    resourceClass = PluginResourceButton.class;
                    break;
                
                case help:
                    resourceClass = PluginResourceHelp.class;
                    break;
                
                case menu:
                    resourceClass = PluginResourceMenu.class;
                    break;
                
                case property:
                    resourceClass = PluginResourcePropertyGroup.class;
                    break;
                
                case css:
                    resourceClass = PluginResourceCSS.class;
                    break;
                
                case bean:
                    resourceClass = PluginResourceBean.class;
                    break;
                
                case command:
                    resourceClass = PluginResourceCommand.class;
                    break;
                
                case action:
                    resourceClass = PluginResourceAction.class;
                    break;
            }

            if (resourceClass != null) {
                BeanDefinitionBuilder resourceBuilder = BeanDefinitionBuilder.genericBeanDefinition(resourceClass);
                addProperties(resource, resourceBuilder);
                resourceList.add(resourceBuilder.getBeanDefinition());
            }
        }
    }
596173
protected JCTree resource() {
        int startPos = token.pos;
        if (token.kind == FINAL || token.kind == MONKEYS_AT) {
            JCModifiers mods = optFinal(Flags.FINAL);
            JCExpression t = parseType();
            return variableDeclaratorRest(token.pos, mods, t, ident(), true, null);
        }
        JCExpression t = term(EXPR | TYPE);
        if ((lastmode & TYPE) != 0 && LAX_IDENTIFIER.accepts(token.kind)) {
            JCModifiers mods = toP(F.at(startPos).Modifiers(Flags.FINAL));
            return variableDeclaratorRest(token.pos, mods, t, ident(), true, null);
        } else {
            checkVariableInTryWithResources(startPos);
            if (!t.hasTag(IDENT) && !t.hasTag(SELECT)) {
                log.error(t.pos(), "try.with.resources.expr.needs.var");
            }

            return t;
        }
    }
772524
@Override
    protected CommPortAdapter createResourceImpl()
    {
        //get COMM port name
        String portName=this.getPortName();
        
        //get timeout
        int timeout=this.getTimeOut();

        CommPort commPort=null;
        try
        {
            //get COMM port identifier
            CommPortIdentifier commPortIdentifier=this.getPortIdentifier(portName);

            //open connection
            commPort=commPortIdentifier.open("fax4j",timeout);
        }
        catch(Exception exception)
        {
            throw new FaxException("Unable to connect to COMM port: "+portName,exception);
        }

        //create adapter wrapper
        CommPortAdapter adapter=new RXTXCommPortAdapter(commPort);
        
        return adapter;
    }
440266
protected void setupClasspathJarResourceIfNeeds(WebAppContext context) {
        if (isWarableWorld() || !isValidMetaInfConfiguration()) {
            return;
        }
        // may be local development and uses meta-inf configuration here
        final List<String> classpathList = extractJarClassspathList();
        for (String classpath : classpathList) {
            final String jarPath = convertClasspathToJarPath(classpath);
            final URL url;
            try {
                url = new URL(jarPath);
            } catch (MalformedURLException e) {
                throw new IllegalStateException("Failed to create URL from the jar path: " + jarPath, e);
            }
            context.getMetaData().addContainerResource(new JarResource(url) {
            });
        }
    }
30481
private void handleConfigurableResources(FacesContext context,
                                             boolean provideJQuery,
                                             boolean provideBootstrap,
                                             List<UIComponent> resources,
                                             UIViewRoot view) {
        boolean isResourceAccepted;

        for (UIComponent resource : resources) {
            final String resourceLibrary = (String) resource.getAttributes().get("library");
            final String resourceName = (String) resource.getAttributes().get("name");
            isResourceAccepted = true;

            if (resourceName != null && CONFIGURABLE_LIBRARY_NAME.equals(resourceLibrary)) {
                if (!provideJQuery && resourceName.equals("butterfaces-third-party-jquery.js")) {
                    isResourceAccepted = false;
                } else if (!provideBootstrap && resourceName.equals("butterfaces-third-party-bootstrap.js")) {
                    isResourceAccepted = false;
                }
            }

            if (!isResourceAccepted)
                removeResource(context, resource, view);
        }
    }
1284446
def create_admin_object_resource(name, server=None, **kwargs):
    '''
    
    '''
    defaults = {
        'description': '',
        'className': 'com.sun.messaging.Queue',
        'enabled': True,
        'id': name,
        'resAdapter': 'jmsra',
        'resType': 'javax.jms.Queue',
        'target': 'server'
    }

    # Data = defaults + merge kwargs + poolname
    data = defaults
    data.update(kwargs)

    # ClassName isn't optional, even if the API says so
    if data['resType'] == 'javax.jms.Queue':
        data['className'] = 'com.sun.messaging.Queue'
    elif data['resType'] == 'javax.jms.Topic':
        data['className'] = 'com.sun.messaging.Topic'
    else:
        raise CommandExecutionError('resType should be "javax.jms.Queue" or "javax.jms.Topic"!')

    if data['resAdapter'] != 'jmsra':
        raise CommandExecutionError('resAdapter should be "jmsra"!')

    # Fix for lowercase vs camelCase naming differences
    if 'resType' in data:
        data['restype'] = data['resType']
        del data['resType']
    if 'className' in data:
        data['classname'] = data['className']
        del data['className']

    return _create_element(name, 'resources/admin-object-resource', data, server)
1102770
private static List<Validate> createResourceAdapter(Connector cmd,
         List<Failure> failures, ResourceBundle rb, ClassLoader cl)
   {
      List<Validate> result = new ArrayList<Validate>();

      if (cmd.getVersion() != Version.V_10 && cmd.getResourceadapter() != null &&
          cmd.getResourceadapter().getResourceadapterClass() != null)
      {
         try
         {
            Class<?> clazz = Class.forName(cmd.getResourceadapter().getResourceadapterClass(),
                                           true, cl);
            List<ConfigProperty> configProperties = cmd.getResourceadapter().getConfigProperties();

            ValidateClass vc = new ValidateClass(Key.RESOURCE_ADAPTER, clazz, configProperties);
            result.add(vc);
         }
         catch (ClassNotFoundException e)
         {
            Failure failure = new Failure(Severity.ERROR,
                                          rb.getString("uncategorized"),
                                          rb.getString("ra.cnfe"),
                                          e.getMessage());
            failures.add(failure);
         }
      }
      return result;
   }