use of org.codice.ddf.admin.application.service.ApplicationServiceException in project ddf by codice.
the class ApplicationFileInstaller method getAppDetails.
/**
* Detects and Builds an AppDetail based on the zip file provided.
*
* To start the process, we find the features.xml file. Once we find it within the zip file, we
* specifically get a stream to that file. Next we parse through the features.xml and extract
* the version/appname.
*
* @param applicationFile
* the file to detect appname and version from.
* @return {@link ZipFileApplicationDetails} containing appname and version.
* @throws ApplicationServiceException
* any errors that happening during extracting the appname/version from the zipfile.
*/
public static ZipFileApplicationDetails getAppDetails(File applicationFile) throws ApplicationServiceException {
ZipFile appZip = null;
try {
appZip = new ZipFile(applicationFile);
LOGGER.debug("Extracting version and application name from zipfile {}.", applicationFile.getAbsolutePath());
ZipEntry featureFileEntry = getFeatureFile(appZip);
return getAppDetailsFromFeature(appZip, featureFileEntry);
} catch (IOException | SAXException | ParserConfigurationException e) {
throw new ApplicationServiceException("Could not get application details of the provided zipfile.", e);
} finally {
IOUtils.closeQuietly(appZip);
}
}
use of org.codice.ddf.admin.application.service.ApplicationServiceException in project ddf by codice.
the class ApplicationServiceBean method init.
/**
* Initializes the initial variables and registers the class to the MBean
* server. <br/>
* <br/>
* <b>NOTE: This should be run before any other operations are performed.
* Operations will NOT be usable until this is called (and until destroy()
* is called).</b>
*
* @throws ApplicationServiceException if an error occurs during registration.
*/
public void init() throws ApplicationServiceException {
try {
try {
LOGGER.debug("Registering application service MBean under object name: {}", objectName.toString());
mBeanServer.registerMBean(this, objectName);
} catch (InstanceAlreadyExistsException iaee) {
// Try to remove and re-register
LOGGER.debug("Re-registering Application Service MBean");
mBeanServer.unregisterMBean(objectName);
mBeanServer.registerMBean(this, objectName);
}
} catch (Exception e) {
LOGGER.warn("Could not register mbean.", e);
throw new ApplicationServiceException(e);
}
}
Aggregations