List of usage examples for com.liferay.portal.deploy DeployUtil getAutoDeployDestDir
public static String getAutoDeployDestDir() throws Exception
From source file:com.liferay.portlet.plugininstaller.action.InstallPluginAction.java
License:Open Source License
protected void uninstall(ActionRequest actionRequest) throws Exception { String appServerType = ServerDetector.getServerId(); String deploymentContext = ParamUtil.getString(actionRequest, "deploymentContext"); if (appServerType.startsWith(ServerDetector.JBOSS_ID)) { deploymentContext += ".war"; }/*from w ww . j a v a 2 s . co m*/ File deployDir = new File(DeployUtil.getAutoDeployDestDir() + "/" + deploymentContext); DeployUtil.undeploy(appServerType, deployDir); SessionMessages.add(actionRequest, "triggeredPortletUndeploy"); }
From source file:com.liferay.web.extender.internal.webbundle.WebBundleProcessor.java
License:Open Source License
public void process() throws IOException { String webContextpath = MapUtil.getString(_parameterMap, OSGiConstants.WEB_CONTEXTPATH); if (!webContextpath.startsWith(StringPool.SLASH)) { webContextpath = StringPool.SLASH.concat(webContextpath); }//from w w w . jav a 2 s. c o m List<AutoDeployListener> autoDeployListeners = GlobalStartupAction.getAutoDeployListeners(); for (AutoDeployListener autoDeployListener : autoDeployListeners) { if (autoDeployListener instanceof OSGiAutoDeployListener) { continue; } try { autoDeployListener.deploy(_file, webContextpath); } catch (AutoDeployException e) { e.printStackTrace(); } } String deployDir = null; try { deployDir = DeployUtil.getAutoDeployDestDir(); } catch (Exception e) { throw new IOException(e); } _deployedAppFolder = new File(deployDir, webContextpath); if (!_deployedAppFolder.exists() || !_deployedAppFolder.isDirectory()) { return; } File manifestFile = new File(_deployedAppFolder, "META-INF/MANIFEST.MF"); if (!manifestFile.exists()) { FileUtil.mkdirs(manifestFile.getParent()); manifestFile.createNewFile(); } Manifest manifest = new Manifest(); FileInputStream fis = new FileInputStream(manifestFile); try { manifest.read(fis); } finally { fis.close(); } _resourcePaths = new ArrayList<String>(); processPaths(_deployedAppFolder, _deployedAppFolder.toURI()); Attributes attributes = manifest.getMainAttributes(); attributes.putValue(OSGiConstants.WEB_CONTEXTPATH, webContextpath); // If it's not a bundle, then we need to manipulate it into one. The // spec states that this is only true when the Manifest does not contain // a Bundle_SymbolicName header. if (!attributes.containsKey(Constants.BUNDLE_SYMBOLICNAME)) { processBundleSymbolicName(attributes, webContextpath); processBundleVersion(attributes); processBundleManifestVersion(attributes); processPortletXML(webContextpath); processLiferayPortletXML(webContextpath); // The order of these operations is important processBundleClassPath(attributes); processDeclarativeReferences(attributes); processExportImportPackage(attributes); } if (!attributes.containsKey(Attributes.Name.MANIFEST_VERSION.toString())) { attributes.putValue(Attributes.Name.MANIFEST_VERSION.toString(), "1.0"); } FileOutputStream fos = new FileOutputStream(manifestFile); try { manifest.write(fos); } finally { fos.close(); } }