Get the JCA standard metadata
@param root The root of the deployment
@return The metadata
@exception Exception Thrown if an error occurs
189085
public Connector getStandardMetaData(File root) throws Exception
   {
      Connector result = null;
      File metadataFile = new File(root, "/META-INF/ra.xml");

      if (metadataFile.exists())
      {
         InputStream input = null;
         String url = metadataFile.getAbsolutePath();
         try
         {
            long start = System.currentTimeMillis();
            input = new FileInputStream(metadataFile);

            XMLStreamReader xsr = XMLInputFactory.newInstance().createXMLStreamReader(input);

            result = (new RaParser()).parse(xsr);

            log.debugf("Total parse for %s took %d ms", url, (System.currentTimeMillis() - start));
         }
         catch (Exception e)
         {
            log.parsingErrorRaXml(url, e);
            throw e;
         }
         finally
         {
            if (input != null)
               input.close();
         }

      }
      else
      {
         log.tracef("metadata file %s does not exist", metadataFile.toString());
      }

      return result;
   }
472523
JcrNodeDefinition getRootNodeDefinition() throws NoSuchNodeTypeException, RepositoryException {
        NodeTypes nodeTypes = nodeTypes();
        for (NodeDefinition definition : nodeTypes.getNodeType(ModeShapeLexicon.ROOT).getChildNodeDefinitions()) {
            if (definition.getName().equals(JcrNodeType.RESIDUAL_ITEM_NAME)) return (JcrNodeDefinition)definition;
        }

        assert false; // should not get here
        return null;
    }
393970
@Override
    protected AssetInformation extractInformationFromAsset(final File archive, ArtifactMetadata metadata) throws PrivilegedActionException, ProductInfoParseException, IOException {
        AssetInformation assetInformation = new AssetInformation();
        JarFile jarFile = null;
        try {
            jarFile = AccessController.doPrivileged(new PrivilegedExceptionAction<JarFile>() {

                @Override
                public JarFile run() throws IOException {
                    return new JarFile(archive);
                }

            });
            Manifest manifest = jarFile.getManifest();
            Attributes mainAttributes = manifest.getMainAttributes();
            String archiveRoot = mainAttributes.getValue("Archive-Root");
            archiveRoot = archiveRoot != null ? archiveRoot : "";
            assetInformation.addProductInfos(jarFile, archiveRoot, archive);

            // See what type of archive this is
            String contentType = mainAttributes.getValue("Archive-Content-Type");
            ResourceType type = getType(contentType, archive);
            assetInformation.type = type;
            assetInformation.provideFeature = mainAttributes.getValue("Provide-Feature");

            if (type.equals(ResourceType.ADDON)) {
                // Only needed for addon, not product
                assetInformation.requireFeature = mainAttributes.getValue("Require-Feature");
                assetInformation.appliesTo = mainAttributes.getValue("Applies-To");
            }
            assetInformation.laLocation = mainAttributes.getValue(LA_HEADER_PRODUCT);
            assetInformation.liLocation = mainAttributes.getValue(LI_HEADER_PRODUCT);
            assetInformation.fileWithLicensesIn = archive;
        } finally {
            if (jarFile != null) {
                jarFile.close();
            }
        }
        return assetInformation;
    }
568956
private Element getXHELMRootElement(String resource) throws JDOMException, IOException {

		ByteArrayInputStream stream = new ByteArrayInputStream(resource.getBytes());
		SAXBuilder builder = new SAXBuilder();
		Document doc = builder.build(stream);

		return doc.getRootElement();
	}
873556
@Override
    public Object getRootContext() throws BadMessageFormatMatchingException {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "getRootContext");

        // Just call the subclass's method to obtain the DOM Document which
        // represents the payload.
        Object result;
        try {
            result = getPayloadDocument();
        } catch (Exception e) {
            FFDCFilter.processException(e, "com.ibm.ws.sib.mfp.impl.JsApiMessageImpl.getRootContext", "921");
            result = null;
        }
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "getRootContext", result);
        return result;
    }
1151831
@GetMapping(path = WSFederationConstants.ENDPOINT_FEDERATION_METADATA)
    public void doGet(final HttpServletRequest request, final HttpServletResponse response) throws Exception {
        try {
            response.setContentType(MediaType.TEXT_HTML_VALUE);
            val out = response.getWriter();
            val metadata = WSFederationMetadataWriter.produceMetadataDocument(casProperties);
            out.write(DOM2Writer.nodeToString(metadata));
        } catch (final Exception ex) {
            LOGGER.error("Failed to get metadata document", ex);
            response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
        }
    }
851119
protected AbstractMetadataResolver getMetadataResolverFromResponse(final HttpResponse response, final File backupFile) throws Exception {
        val entity = response.getEntity();
        val result = IOUtils.toString(entity.getContent(), StandardCharsets.UTF_8);
        val path = backupFile.toPath();
        LOGGER.trace("Writing metadata to file at [{}]", path);
        try (val output = Files.newBufferedWriter(path, StandardCharsets.UTF_8)) {
            IOUtils.write(result, output);
            output.flush();
        }
        EntityUtils.consume(entity);
        return new InMemoryResourceMetadataResolver(backupFile, configBean);
    }
328614
protected synchronized ResourceRoot getSeamIntResourceRoot() throws DeploymentUnitProcessingException {
        try {
            if (seamIntResourceRoot == null) {
                final ModuleLoader moduleLoader = Module.getBootModuleLoader();
                Module extModule = moduleLoader.loadModule(EXT_CONTENT_MODULE);
                URL url = extModule.getExportedResource(SEAM_INT_JAR);
                if (url == null)
                    throw ServerLogger.ROOT_LOGGER.noSeamIntegrationJarPresent(extModule);

                File file = new File(url.toURI());
                VirtualFile vf = VFS.getChild(file.toURI());
                final Closeable mountHandle = VFS.mountZip(file, vf, TempFileProviderService.provider());
                Service<Closeable> mountHandleService = new Service<Closeable>() {
                    public void start(StartContext startContext) throws StartException {
                    }

                    public void stop(StopContext stopContext) {
                        VFSUtils.safeClose(mountHandle);
                    }

                    public Closeable getValue() throws IllegalStateException, IllegalArgumentException {
                        return mountHandle;
                    }
                };
                ServiceBuilder<Closeable> builder = serviceTarget.addService(ServiceName.JBOSS.append(SEAM_INT_JAR),
                        mountHandleService);
                builder.setInitialMode(ServiceController.Mode.ACTIVE).install();
                serviceTarget = null; // our cleanup service install work is done

                MountHandle dummy = MountHandle.create(null); // actual close is done by the MSC service above
                seamIntResourceRoot = new ResourceRoot(vf, dummy);
            }
            return seamIntResourceRoot;
        } catch (Exception e) {
            throw new DeploymentUnitProcessingException(e);
        }
    }
1138919
public static Throwable getRootCause(Throwable exception) {
    Assert.notNull(exception);
    return exception.getCause() == null ? exception : getRootCause(exception.getCause());
  }
833288
public RootMethodRunResult getRunResultByRootMethod(TestMethod rootMethod) {
        if (rootMethod == null) {
            throw new NullPointerException();
        }
        return getRunResultByRootMethodKey(rootMethod.getKey());
    }
1011215
CmsObject getRootCms() {

        try {
            if (m_rootCms == null) {

                m_rootCms = OpenCms.initCmsObject(A_CmsUI.getCmsObject());
                m_rootCms.getRequestContext().setSiteRoot("");
            }
        } catch (CmsException e) {
            //
        }
        return m_rootCms;

    }
309278
@Override
    public ConnectionMetaData getMetaData() throws JMSRuntimeException {

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "getMetaData");

        ConnectionMetaData connectionMetaData = null;
        try {
            connectionMetaData = jmsConnection.getMetaData();
        } catch (JMSException jmse) {
            throw (JMSRuntimeException) JmsErrorUtils.getJMS2Exception(jmse, JMSRuntimeException.class);
        } finally {
            if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                SibTr.exit(this, tc, "getMetaData", new Object[] { connectionMetaData });
        }

        return connectionMetaData;
    }
654421
protected String getRootContext(HttpServletRequest request) {
		if (StringUtils.isEmpty(coreConfig.getStripRootContext())) {
			return request.getContextPath() + AdminTool.ROOTCONTEXT;
		}
		return request.getContextPath().replaceFirst(Pattern.quote(coreConfig.getStripRootContext()), "") + AdminTool.ROOTCONTEXT;
	}
312177
public static String getPrimaryType(Resource resource) {
        String result = null;
        if (resource != null) {
            if (resource instanceof JcrResource) {
                // use the resource itself if it implements the JcrResource interface (maybe a version of a resource)
                result = ((JcrResource) resource).getPrimaryType();
            } else {
                Node node = resource.adaptTo(Node.class);
                if (node != null) {
                    try {
                        NodeType type = node.getPrimaryNodeType();
                        if (type != null) {
                            result = type.getName();
                        }
                    } catch (RepositoryException ignore) {
                    }
                }
                if (result == null) {
                    ValueMap values = resource.adaptTo(ValueMap.class);
                    if (values != null) {
                        result = values.get(JcrConstants.JCR_PRIMARYTYPE, (String) null);
                    }
                }
            }
        }
        return result;
    }
581697
public CmsSitemapTreeNodeData getData(CmsResource resource) {

        try {
            CmsVfsSitemapService svc = new CmsVfsSitemapService();
            CmsObject cms = OpenCms.initCmsObject(A_CmsUI.getCmsObject());
            cms.getRequestContext().setSiteRoot("");
            svc.setCms(cms);

            CmsClientSitemapEntry ent = svc.getChildren(resource.getRootPath(), resource.getStructureId(), 0);
            CmsSitemapTreeNodeData data = new CmsSitemapTreeNodeData(
                m_localeContext.getRootLocale(),
                m_localeContext.getComparisonLocale());
            data.setClientEntry(ent);
            data.initialize(cms);
            return data;
        } catch (Exception e) {
            LOG.error(e.getLocalizedMessage(), e);
            return null;
        }

    }
549173
private static ClassMetadata getClassMetadata(final Class cls, final Map /* <Class,ClassMetadata> */metadataMap,
                                                  final ClassAccessPrivilegedAction caAction,
                                                  final FieldAccessPrivilegedAction faAction) {
        if (null == cls) {
            return null;
        }

        ClassMetadata result;
        synchronized (metadataMap) {
            result = (ClassMetadata) metadataMap.get(cls);
        }
        if (result != null) {
            return result;
        }

        int primitiveFieldCount = 0;
        int shellSize = OBJECT_SHELL_SIZE; // java.lang.Object shell
        final List /* Field */refFields = new LinkedList();

        final Field[] declaredFields;
        try {
            caAction.setContext(cls);
            declaredFields = (Field[]) AccessController.doPrivileged(caAction);
        } catch (PrivilegedActionException pae) {
            throw new RuntimeException("could not access declared fields of class " + cls.getName() + ": "
                                       + pae.getException());
        }

        for (int f = 0; f < declaredFields.length; ++f) {
            final Field field = declaredFields[f];
            if (Modifier.isStatic(field.getModifiers())) {
                continue;
            }
            /*
             * Can't do that: HashMap data is transient, for example... if (Modifier.isTransient(field.getModifiers()))
             * { shellSize += OBJREF_SIZE; continue; }
             */

            final Class fieldType = field.getType();
            if (fieldType.isPrimitive()) {
                // memory alignment ignored:
                shellSize += sizeofPrimitiveType(fieldType);
                ++primitiveFieldCount;
            } else {
                // prepare for graph traversal later:
                if (!field.isAccessible()) {
                    try {
                        faAction.setContext(field);
                        AccessController.doPrivileged(faAction);
                    } catch (PrivilegedActionException pae) {
                        throw new RuntimeException("could not make field " + field + " accessible: "
                                                   + pae.getException());
                    }
                }

                // memory alignment ignored:
                shellSize += OBJREF_SIZE;
                refFields.add(field);
            }
        }

        // recurse into superclass:
        final ClassMetadata superMetadata = getClassMetadata(cls.getSuperclass(), metadataMap, caAction, faAction);
        if (superMetadata != null) {
            primitiveFieldCount += superMetadata.m_primitiveFieldCount;
            shellSize += superMetadata.m_shellSize - OBJECT_SHELL_SIZE;
            refFields.addAll(Arrays.asList(superMetadata.m_refFields));
        }

        final Field[] _refFields = new Field[refFields.size()];
        refFields.toArray(_refFields);

        result = new ClassMetadata(primitiveFieldCount, shellSize, _refFields);
        synchronized (metadataMap) {
            metadataMap.put(cls, result);
        }

        return result;
    }
1001428
public static WebArgumentMetadata get(final JCas jCas)
    {
        FSIterator<FeatureStructure> iterator = jCas.getCas().getIndexRepository().getAllIndexedFS(
                CasUtil.getType(jCas.getCas(), WebArgumentMetadata.class));

        if (!iterator.hasNext()) {
            throw new IllegalArgumentException(new Throwable("CAS does not contain any "
                    + WebArgumentMetadata.class.getName()));
        }

        WebArgumentMetadata result = (WebArgumentMetadata) iterator.next();

        if (iterator.hasNext()) {
            throw new IllegalArgumentException(new Throwable("CAS contains more than one "
                    + WebArgumentMetadata.class.getName()));
        }

        return result;
    }