Search in sources :

Example 1 with ApplicationArchivist

use of com.sun.enterprise.deployment.archivist.ApplicationArchivist in project Payara by payara.

the class ResourcesUtil method getConnectorDescriptorFromUri.

public ConnectorDescriptor getConnectorDescriptorFromUri(String rarName, String raLoc) {
    try {
        String appName = rarName.substring(0, rarName.indexOf(ConnectorConstants.EMBEDDEDRAR_NAME_DELIMITER));
        // String actualRarName = rarName.substring(rarName.indexOf(ConnectorConstants.EMBEDDEDRAR_NAME_DELIMITER) + 1);
        String appDeployLocation = ResourcesUtil.createInstance().getApplicationDeployLocation(appName);
        FileArchive in = ConnectorRuntime.getRuntime().getFileArchive();
        in.open(new URI(appDeployLocation));
        ApplicationArchivist archivist = ConnectorRuntime.getRuntime().getApplicationArchivist();
        com.sun.enterprise.deployment.Application application = archivist.open(in);
        return application.getModuleByTypeAndUri(ConnectorDescriptor.class, raLoc);
    } catch (Exception e) {
        Object[] params = new Object[] { rarName, e };
        _logger.log(Level.WARNING, "error.getting.connector.descriptor", params);
    }
    return null;
}
Also used : ApplicationArchivist(com.sun.enterprise.deployment.archivist.ApplicationArchivist) FileArchive(com.sun.enterprise.deploy.shared.FileArchive) URI(java.net.URI) ConnectorRuntimeException(com.sun.appserv.connectors.internal.api.ConnectorRuntimeException)

Example 2 with ApplicationArchivist

use of com.sun.enterprise.deployment.archivist.ApplicationArchivist in project Payara by payara.

the class EarHandler method getApplicationHolder.

private ApplicationHolder getApplicationHolder(ReadableArchive source, DeploymentContext context, boolean isDirectory) {
    ApplicationHolder holder = context.getModuleMetaData(ApplicationHolder.class);
    if (holder == null || holder.app == null) {
        try {
            DeployCommandParameters params = context.getCommandParameters(DeployCommandParameters.class);
            if (params != null && params.altdd != null) {
                source.addArchiveMetaData(DeploymentProperties.ALT_DD, params.altdd);
            }
            long start = System.currentTimeMillis();
            ApplicationArchivist archivist = habitat.getService(ApplicationArchivist.class);
            archivist.setAnnotationProcessingRequested(true);
            String xmlValidationLevel = dasConfig.getDeployXmlValidation();
            archivist.setXMLValidationLevel(xmlValidationLevel);
            if (xmlValidationLevel.equals("none")) {
                archivist.setXMLValidation(false);
            }
            holder = new ApplicationHolder(archivist.createApplication(source, isDirectory));
            Boolean cdiEnabled = new GFApplicationXmlParser(source).isEnableImplicitCDI();
            if (cdiEnabled != null) {
                context.getAppProps().put(RuntimeTagNames.PAYARA_ENABLE_IMPLICIT_CDI, cdiEnabled.toString().toLowerCase());
            }
            _logger.fine("time to read application.xml " + (System.currentTimeMillis() - start));
        } catch (IOException | XMLStreamException | SAXParseException e) {
            throw new RuntimeException(e);
        }
        context.addModuleMetaData(holder);
    }
    if (holder.app == null) {
        throw new RuntimeException(strings.get("errReadMetadata"));
    }
    return holder;
}
Also used : DeployCommandParameters(org.glassfish.api.deployment.DeployCommandParameters) ApplicationHolder(org.glassfish.javaee.core.deployment.ApplicationHolder) XMLStreamException(javax.xml.stream.XMLStreamException) SAXParseException(org.xml.sax.SAXParseException) ApplicationArchivist(com.sun.enterprise.deployment.archivist.ApplicationArchivist)

Aggregations

ApplicationArchivist (com.sun.enterprise.deployment.archivist.ApplicationArchivist)2 ConnectorRuntimeException (com.sun.appserv.connectors.internal.api.ConnectorRuntimeException)1 FileArchive (com.sun.enterprise.deploy.shared.FileArchive)1 URI (java.net.URI)1 XMLStreamException (javax.xml.stream.XMLStreamException)1 DeployCommandParameters (org.glassfish.api.deployment.DeployCommandParameters)1 ApplicationHolder (org.glassfish.javaee.core.deployment.ApplicationHolder)1 SAXParseException (org.xml.sax.SAXParseException)1