use of org.eclipse.wst.server.core.IServer in project sling by apache.
the class SlingLaunchpadCombo method getErrorMessage.
public String getErrorMessage(ValidationFlag... flags) {
if (!hasServers() && project != null) {
return "The selected project is not configured with/added to any Sling server";
}
IServer server = getServer();
if (server == null) {
return "Please select a repository";
}
Set<ValidationFlag> flagSet = flags.length == 0 ? EnumSet.noneOf(ValidationFlag.class) : EnumSet.copyOf(asList(flags));
if (!flagSet.contains(ValidationFlag.SKIP_SERVER_STARTED)) {
if (server.getServerState() != IServer.STATE_STARTED) {
return "Selected server is not started";
}
}
return null;
}
use of org.eclipse.wst.server.core.IServer in project sling by apache.
the class ServerUtil method getDefaultServer.
private static IServer getDefaultServer(IProject project) {
IModule module = org.eclipse.wst.server.core.ServerUtil.getModule(project);
if (module == null) {
// is what we need to create a RepositoryInfo
return null;
}
IServer server = ServerCore.getDefaultServer(module);
if (server != null) {
return server;
}
// then we cannot create a repository
IServer[] allServers = ServerCore.getServers();
out: for (int i = 0; i < allServers.length; i++) {
IServer aServer = allServers[i];
IModule[] allModules = aServer.getModules();
for (int j = 0; j < allModules.length; j++) {
IModule aMoudle = allModules[j];
if (aMoudle.equals(module)) {
server = aServer;
break out;
}
}
}
return server;
}
use of org.eclipse.wst.server.core.IServer in project sling by apache.
the class ServerUtil method triggerIncrementalBuild.
public static void triggerIncrementalBuild(IResource anyResourceInThatProject, IProgressMonitor monitorOrNull) {
if (anyResourceInThatProject == null) {
throw new IllegalArgumentException("anyResourceInThatProject must not be null");
}
IProject proj = anyResourceInThatProject.getProject();
if (proj == null) {
throw new IllegalStateException("no project found for " + anyResourceInThatProject);
}
Set<IServer> servers = getAllServers(proj);
if (servers != null) {
if (monitorOrNull == null) {
monitorOrNull = new NullProgressMonitor();
}
for (IServer server : servers) {
if (server != null) {
int autoPublishSetting = server.getAttribute(PROP_AUTO_PUBLISH_SETTING, AUTO_PUBLISH_RESOURCE);
int autoPublishTime = server.getAttribute(PROP_AUTO_PUBLISH_TIME, 15);
if (autoPublishSetting == AUTO_PUBLISH_RESOURCE) {
//TODO: ignoring the autoPublishTime - SLING-3587
server.publish(IServer.PUBLISH_INCREMENTAL, monitorOrNull);
}
}
}
}
}
use of org.eclipse.wst.server.core.IServer in project sling by apache.
the class AbstractNewSlingApplicationWizard method deployProjectsOnServer.
protected void deployProjectsOnServer(Projects projects, IProgressMonitor monitor) throws CoreException {
IServer server = setupServerWizardPage.getOrCreateServer(monitor);
if (server == null) {
monitor.done();
return;
}
advance(monitor, 1);
IServerWorkingCopy wc = server.createWorkingCopy();
// add the bundle and content projects, ie modules, to the server
List<IModule> modules = new LinkedList<>();
for (IProject project : projects.getBundleProjects()) {
IModule module = ServerUtil.getModule(project);
if (module != null && shouldDeploy(module)) {
modules.add(module);
}
}
for (IProject project : projects.getContentProjects()) {
IModule module = ServerUtil.getModule(project);
if (module != null && shouldDeploy(module)) {
modules.add(module);
}
}
wc.modifyModules(modules.toArray(new IModule[modules.size()]), new IModule[0], monitor);
wc.save(true, monitor);
advance(monitor, 2);
monitor.done();
}
use of org.eclipse.wst.server.core.IServer in project sling by apache.
the class ApplyDefaultSlingServerValuesFragment method performFinish.
@Override
public void performFinish(IProgressMonitor monitor) throws CoreException {
IServer server = (IServer) getTaskModel().getObject(TaskModel.TASK_SERVER);
if (server instanceof IServerWorkingCopy) {
IServerWorkingCopy wc = (IServerWorkingCopy) server;
SlingLaunchpadConfigurationDefaults.applyDefaultValues(wc);
wc.save(true, monitor);
}
}
Aggregations