use of org.eclipse.wst.server.core.IServerWorkingCopy in project sling by apache.
the class SlingLaunchpadServer method setBundleVersion.
@Override
public void setBundleVersion(String bundleSymbolicName, Version version, IProgressMonitor monitor) {
String stringVersion = version != null ? version.toString() : null;
IServerWorkingCopy wc = getServer().createWorkingCopy();
wc.setAttribute(String.format(PROP_BUNDLE_VERSION_FORMAT, bundleSymbolicName), stringVersion);
try {
wc.save(false, monitor);
} catch (CoreException e) {
throw new RuntimeException(e);
}
}
use of org.eclipse.wst.server.core.IServerWorkingCopy 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.IServerWorkingCopy 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);
}
}
use of org.eclipse.wst.server.core.IServerWorkingCopy in project sling by apache.
the class ServerAdapter method installModule.
public void installModule(final IProject project) throws CoreException, InterruptedException {
// not sure why we need to poll at all here ... there is some async operation that I'm not aware of
IModule bundleModule = new Poller().pollUntil(new Callable<IModule>() {
@Override
public IModule call() throws Exception {
return ServerUtil.getModule(project);
}
}, notNullValue(IModule.class));
IServerWorkingCopy serverWorkingCopy = server.createWorkingCopy();
serverWorkingCopy.modifyModules(new IModule[] { bundleModule }, new IModule[0], new NullProgressMonitor());
serverWorkingCopy.save(false, new NullProgressMonitor());
}
use of org.eclipse.wst.server.core.IServerWorkingCopy in project sling by apache.
the class ServerAdapter method setAttribute.
public void setAttribute(String name, boolean value) throws CoreException {
IServerWorkingCopy serverWorkingCopy = server.createWorkingCopy();
serverWorkingCopy.setAttribute(name, value);
serverWorkingCopy.save(false, new NullProgressMonitor());
}
Aggregations