use of com.liferay.ide.server.core.ILiferayRuntime in project liferay-ide by liferay.
the class PluginClasspathContainerInitializer method initialize.
@Override
public void initialize(IPath containerPath, IJavaProject project) throws CoreException {
IClasspathContainer classpathContainer = null;
int count = containerPath.segmentCount();
if (count != 2) {
String msg = "Invalid plugin classpath container should expecting 2 segments.";
throw new CoreException(ProjectCore.createErrorStatus(msg));
}
String root = containerPath.segment(0);
if (!ID.equals(root)) {
String msg = "Invalid plugin classpath container, expecting container root ";
throw new CoreException(ProjectCore.createErrorStatus(msg + ID));
}
String finalSegment = containerPath.segment(1);
IPath portalDir = ServerUtil.getPortalDir(project);
if (portalDir == null) {
return;
}
String javadocURL = null;
IPath sourceLocation = null;
try {
ILiferayRuntime liferayRuntime = ServerUtil.getLiferayRuntime(project.getProject());
if (liferayRuntime != null) {
javadocURL = liferayRuntime.getJavadocURL();
sourceLocation = liferayRuntime.getSourceLocation();
}
} catch (Exception e) {
ProjectCore.logError(e);
}
classpathContainer = getCorrectContainer(containerPath, finalSegment, project, portalDir, javadocURL, sourceLocation);
IJavaProject[] projects = { project };
IClasspathContainer[] containers = { classpathContainer };
JavaCore.setClasspathContainer(containerPath, projects, containers, null);
}
use of com.liferay.ide.server.core.ILiferayRuntime in project liferay-ide by liferay.
the class LiferayTomcatUtil method addRuntimeVMArgments.
public static void addRuntimeVMArgments(List<String> runtimeVMArgs, IPath installPath, IPath configPath, IPath deployPath, boolean isTestEnv, IServer currentServer, ILiferayTomcatServer liferayTomcatServer) {
// $NON-NLS-1$
runtimeVMArgs.add("-Dfile.encoding=UTF8");
// $NON-NLS-1$
runtimeVMArgs.add("-Dorg.apache.catalina.loader.WebappClassLoader.ENABLE_CLEAR_REFERENCES=false");
// $NON-NLS-1$
runtimeVMArgs.add("-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager");
ILiferayRuntime runtime = ServerUtil.getLiferayRuntime(currentServer);
Version portalVersion = new Version(getVersion(runtime));
if (CoreUtil.compareVersions(portalVersion, LiferayTomcatRuntime70.leastSupportedVersion) < 0) {
// $NON-NLS-1$ //$NON-NLS-2$
runtimeVMArgs.add("-Djava.security.auth.login.config=\"" + configPath.toOSString() + "/conf/jaas.config\"");
} else {
// $NON-NLS-1$
runtimeVMArgs.add("-Djava.net.preferIPv4Stack=true");
}
runtimeVMArgs.add(// $NON-NLS-1$
"-Djava.util.logging.config.file=\"" + installPath.toOSString() + // $NON-NLS-1$
"/conf/logging.properties\"");
// $NON-NLS-1$ //$NON-NLS-2$
runtimeVMArgs.add("-Djava.io.tmpdir=\"" + installPath.toOSString() + "/temp\"");
final boolean useDefaultPortalServerSettings = liferayTomcatServer.getUseDefaultPortalServerSettings();
if (useDefaultPortalServerSettings) {
addUserDefaultVMArgs(runtimeVMArgs);
} else {
addUserVMArgs(runtimeVMArgs, currentServer, liferayTomcatServer);
File externalPropertiesFile = getExternalPropertiesFile(installPath, configPath, currentServer, liferayTomcatServer);
runtimeVMArgs.add("-Dexternal-properties=\"" + externalPropertiesFile.getAbsolutePath() + "\"");
}
}
use of com.liferay.ide.server.core.ILiferayRuntime in project liferay-ide by liferay.
the class LiferayTomcatServer method getDefaultServerMode.
public int getDefaultServerMode() {
int defaultServerMode = ILiferayTomcatConstants.STANDARD_SERVER_MODE;
try {
String version = LiferayTomcatUtil.getVersion(((ILiferayRuntime) getServer().getRuntime()));
Version portalVersion = Version.parseVersion(version);
if (CoreUtil.compareVersions(portalVersion, ILiferayConstants.V620) < 0) {
defaultServerMode = ILiferayTomcatConstants.DEVELOPMENT_SERVER_MODE;
}
} catch (Exception e) {
}
return defaultServerMode;
}
use of com.liferay.ide.server.core.ILiferayRuntime in project liferay-ide by liferay.
the class WorkflowValidationProxy method getProxyClasspath.
@SuppressWarnings("deprecation")
protected URL[] getProxyClasspath() throws CoreException {
List<URL> scriptUrlList = new ArrayList<>();
IRuntime serverRuntime = _runtime;
if (serverRuntime == null) {
throw new CoreException(KaleoCore.createErrorStatus("Could not get server runtime."));
}
ILiferayRuntime liferayRuntime = (ILiferayRuntime) serverRuntime.loadAdapter(ILiferayRuntime.class, null);
IPath appServerPortalDir = liferayRuntime.getAppServerPortalDir();
IPath appServerPortalLibDir = appServerPortalDir.append("WEB-INF/lib");
File libFolder = appServerPortalLibDir.toFile();
FilenameFilter fileNameFilter = new FilenameFilter() {
public boolean accept(File dir, String name) {
if (name.endsWith(".jar") && (name.contains("dom4j") || name.contains("xercesImpl") || name.contains("portal-impl") || name.contains("util-java") || name.contains("commons-lang"))) {
return true;
}
return false;
}
};
String[] libs = libFolder.list(fileNameFilter);
for (String lib : libs) {
File libJar = new File(libFolder, lib);
if (FileUtil.exists(libJar)) {
try {
scriptUrlList.add(libJar.toURL());
} catch (MalformedURLException murle) {
}
}
}
IPath runtimePath = _runtime.getLocation();
IPath kaleoWebServiceJarDir = runtimePath.append("webapps/kaleo-designer-portlet/WEB-INF/lib/kaleo-web-service.jar");
IPath portalServiceJarDir = runtimePath.append("lib/ext/portal-service.jar");
File[] jars = { kaleoWebServiceJarDir.toFile(), portalServiceJarDir.toFile() };
for (File jar : jars) {
if (FileUtil.exists(jar)) {
try {
scriptUrlList.add(jar.toURL());
} catch (MalformedURLException murle) {
}
}
}
IPath classesDir = runtimePath.append("webapps/kaleo-web/WEB-INF/classes/");
File parserDir = classesDir.toFile();
if (FileUtil.exists(parserDir)) {
try {
scriptUrlList.add(parserDir.toURL());
} catch (Exception e) {
}
}
return scriptUrlList.toArray(new URL[0]);
}
use of com.liferay.ide.server.core.ILiferayRuntime in project liferay-ide by liferay.
the class WorkflowValidationProxy method getGroovyFile.
protected File getGroovyFile() throws Exception {
Object loadAdapter = _runtime.loadAdapter(ILiferayRuntime.class, null);
ILiferayRuntime liferayRuntime = (ILiferayRuntime) loadAdapter;
KaleoCore kaleoCore = KaleoCore.getDefault();
if (liferayRuntime != null) {
Version version = new Version(liferayRuntime.getPortalVersion());
Bundle bundle = kaleoCore.getBundle();
URL bundleURL = FileLocator.toFileURL(bundle.getEntry(_getGroovyWorkflowValidationScript(version)));
return new File(bundleURL.getFile());
}
IStatus error = KaleoCore.createErrorStatus("Unable to locate groovy script");
ILog log = kaleoCore.getLog();
log.log(error);
throw new CoreException(error);
}
Aggregations