+++ /dev/null
-/*\r
- * Copyright (C) 2007-2012 Argeo GmbH\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-package org.argeo.slc.support.deploy;\r
-\r
-import java.io.File;\r
-import java.net.MalformedURLException;\r
-import java.net.URL;\r
-\r
-import org.argeo.slc.SlcException;\r
-import org.argeo.slc.deploy.TargetData;\r
-\r
-public class HttpdApplicationTargetData implements TargetData {\r
- private HttpdServer webServer;\r
- private String relativePath;\r
- private String targetRootPath;\r
-\r
- public HttpdServer getWebServer() {\r
- return webServer;\r
- }\r
-\r
- public void setWebServer(HttpdServer webServer) {\r
- this.webServer = webServer;\r
- }\r
-\r
- public String getRelativePath() {\r
- return relativePath;\r
- }\r
-\r
- /**\r
- * If targetRootLocation not set, used to build the targetRootLocation,\r
- * relative to the webserver base.\r
- */\r
- public void setRelativePath(String relativePath) {\r
- this.relativePath = relativePath;\r
- }\r
-\r
- public String getTargetRootPath() {\r
- return targetRootPath;\r
- }\r
-\r
- public void setTargetRootPath(String targetRootPath) {\r
- this.targetRootPath = targetRootPath;\r
- }\r
-\r
- public URL getTargetBaseUrl() {\r
- try {\r
- URL wsUrl = getWebServer().getBaseUrl();\r
- // TODO: use URI\r
- return new URL(wsUrl, wsUrl.getFile() + '/' + relativePath);\r
- } catch (MalformedURLException e) {\r
- throw new SlcException("Cannot get base url for " + relativePath, e);\r
- }\r
- }\r
-\r
- public File getTargetRootLocation() {\r
- if (targetRootPath != null && !targetRootPath.equals("")) {\r
- return new File(targetRootPath);\r
- } else {\r
- HttpdServerTargetData targetData = (HttpdServerTargetData) getWebServer()\r
- .getTargetData();\r
- String path = targetData.getServerRoot() + File.separator\r
- + getRelativePath();\r
- return new File(path);\r
- }\r
- }\r
-\r
-}\r