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;
}
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;
}
Aggregations