Returns JNDI resource name.

@param resourceName to use if specified
@param fallBackName fall back bean name otherwise
@return JNDI resource name
338163
private static String getName(final String resourceName, final String fallBackName)
   {
      return resourceName.length() > 0 ? resourceName : fallBackName;
   }
169871
public String getName() {
    ResourceServices services = getServices();
    return (services != null) ? services.getResourceName() : null;
  }
827666
@Override
    public ICodeBaseEntry lookupResource(String resourceName) {
        if (!resourceName.equals(getResourceName())) {
            return null;
        }

        return new SingleFileCodeBaseEntry(this);
    }
1086414
public static String getClassName(String resourceName)
    {
        String className = resourceName.replace(File.separatorChar, '.');
        if (className.length() > 7)
        {
            className = className.substring(0, className.length() - 6);
        }
        return className;
    }
603580
public URLConnection getResourceConnection(String resourceName) throws ResourceException {
        // Get the URLConnection
        URLConnection groovyScriptConn = null;

        ResourceException se = null;
        for (URL root : roots) {
            URL scriptURL = null;
            try {
                scriptURL = new URL(root, resourceName);
                groovyScriptConn = openConnection(scriptURL);

                break; // Now this is a bit unusual
            } catch (MalformedURLException e) {
                String message = "Malformed URL: " + root + ", " + resourceName;
                if (se == null) {
                    se = new ResourceException(message);
                } else {
                    se = new ResourceException(message, se);
                }
            } catch (IOException e1) {
                String message = "Cannot open URL: " + root + resourceName;
                groovyScriptConn = null;
                if (se == null) {
                    se = new ResourceException(message);
                } else {
                    se = new ResourceException(message, se);
                }
            }
        }

        if (se == null) se = new ResourceException("No resource for " + resourceName + " was found");

        // If we didn't find anything, report on all the exceptions that occurred.
        if (groovyScriptConn == null) throw se;
        return groovyScriptConn;
    }
332037
public static URL findConfigResource(String resourceName) {
        if (Strings.isNullOrEmpty(resourceName)) {
            return null;
        }

        final URL url = resourceName.startsWith(ROOT) ? DefaultConfiguration.class.getResource(resourceName)
            : DefaultConfiguration.class.getResource(ROOT + resourceName);

        if (url != null) {
            return url;
        }

        // This is useful to get resource under META-INF directory
        String[] resourceNamePrefix = new String[] {"META-INF/fabric8/", "META-INF/fabric8/"};

        for (String resource : resourceNamePrefix) {
            String fullResourceName = resource + resourceName;

            URL candidate = KubernetesResourceLocator.class.getResource(fullResourceName.startsWith(ROOT) ? fullResourceName : ROOT + fullResourceName);
            if (candidate != null) {
                return candidate;
            }
        }

        return null;
    }
1278165
public static Reader resource(String resourceName) {
        if (resourceName == null) {
            throw new NullPointerException("'null' passed instead of resource name");
        }

        final InputStream resourceStream = ClassLoader.getSystemResourceAsStream(resourceName);
        if (resourceStream == null) {
            throw new IllegalArgumentException(format("resource '%s' not found", resourceName));
        }

        return new BufferedReader(new InputStreamReader(resourceStream));
    }
1357688
public Resourcepart getNickname() {
        final EntityFullJid myRoomJid = this.myRoomJid;
        if (myRoomJid == null) {
            return null;
        }
        return myRoomJid.getResourcepart();
    }
982146
public static void checkResourceName(String name) {

        try {
            CmsResource.checkResourceName(name);
        } catch (CmsIllegalArgumentException e) {
            throw new CmisNameConstraintViolationException(e.getLocalizedMessage(), e);
        }
    }
1333671
public static InputStream getResourceAsStream(String resourceName) throws URISyntaxException,
            ClassNotFoundException {
        return ResourceUtil.class.getClassLoader().getResourceAsStream(resourceName);
    }
825436
String getResourceName() {
        if (!resourceNameKnown) {
            // The resource name of a classfile can only be determined by
            // reading
            // the file and parsing the constant pool.
            // If we can't do this for some reason, then we just
            // make the resource name equal to the filename.

            try {
                resourceName = getClassDescriptor().toResourceName();
            } catch (Exception e) {
                resourceName = fileName;
            }

            resourceNameKnown = true;
        }
        return resourceName;
    }
1057445
public static String getResourceName(Resource resource) {
        String result = null;
        if (resource != null) {
            String name = resource.getName();
            if (ResourceUtil.CONTENT_NODE.equals(name)) {
                result = getResourceName(resource.getParent());
            } else {
                result = name;
            }
        }
        return result;
    }
849230
@Override
    public String getjcaResource() {
        final boolean trace = TraceComponent.isAnyTracingEnabled();
        Collection<JCAResourceMBeanImpl> c = jcaMBeanRuntime.jcaResources.values();
        Iterator<JCAResourceMBeanImpl> i = c.iterator();
        String jcaResourceString = null;
        while (i.hasNext()) {
            JCAResourceMBeanImpl jcaResource = i.next();
            String resourceAdapter = jcaResource.getResourceAdapter();
            String s = jcaResource.getobjectName().toString();
            if (trace && tc.isDebugEnabled())
                Tr.debug(tc, "getjcaResource - ", s);
            //ResourceAdapter
            if (this.resourceAdapter.equals(resourceAdapter)) {
                // I believe we should only have one that matches, if we have more, its likely a bug.
                // A resource adapter should only have one jcaResource and a jca jcaResource can
                // have several connection factories.   While debugging this code I see we have two
                // jcaResources for this resource adapter.
                jcaResourceString = s;
            }
        }
        return jcaResourceString;
    }
1308321
private static String getStringResourceByName(Context ctx, String resourceName) {
        String packageName = ctx.getPackageName();
        int resId = ctx.getResources().getIdentifier(resourceName, "string", packageName);
        if (resId == 0) {
            return "";
        } else {
            return ctx.getString(resId);
        }
    }
162149
public static Resource getConsoleResource(BeanContext context) {
        SlingHttpServletRequest request = context.getRequest();
        ResourceResolver resolver = request.getResourceResolver();
        String path = null;
        // use the resource set by a probably executed 'defineObjects' tag (supports including components)
        Resource resource = context.getAttribute("resource", Resource.class);
        if (resource == null) {
            resource = request.getResource();
        }
        if (resource != null) {
            path = resource.getPath();
        }
        // use the suffix as the resource path if the resource is not defined or references a servlet
        if (StringUtils.isBlank(path) || path.startsWith("/bin/")) {
            RequestPathInfo requestPathInfo = request.getRequestPathInfo();
            path = requestPathInfo.getSuffix();
            resource = null;
        }
        if (resource == null && StringUtils.isNotBlank(path)) {
            resource = resolver.getResource(path);
        }
        if (resource == null) {
            // fallback to the root node if the servlet request has no suffix
            resource = resolver.getResource("/");
        }
        return resource;
    }
853781
public static DataSource getJndiDs(String jndiName) {
		try {
			return (DataSource) new InitialContext().lookup(jndiName);
		} catch (NamingException e) {
			throw new DbRuntimeException(e);
		}
	}
382063
private String getNewAreaResourceType(String componentPath) {
    Resource componentResource = resolver.getResource(componentPath);
    if (componentResource != null) {
      if (componentResource.getChild(NEWAREA_CHILD_NAME) != null) {
        return componentPath + "/" + NEWAREA_CHILD_NAME;
      }
      String resourceSuperType = componentResource.getResourceSuperType();
      if (StringUtils.isNotEmpty(resourceSuperType)) {
        return getNewAreaResourceType(resourceSuperType);
      }
    }
    return FALLBACK_NEWAREA_RESOURCE_TYPE;
  }