Search in sources :

Example 1 with IServerWorkingCopy

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);
    }
}
Also used : CoreException(org.eclipse.core.runtime.CoreException) IServerWorkingCopy(org.eclipse.wst.server.core.IServerWorkingCopy)

Example 2 with IServerWorkingCopy

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();
}
Also used : IServer(org.eclipse.wst.server.core.IServer) IModule(org.eclipse.wst.server.core.IModule) IServerWorkingCopy(org.eclipse.wst.server.core.IServerWorkingCopy) LinkedList(java.util.LinkedList) IProject(org.eclipse.core.resources.IProject)

Example 3 with IServerWorkingCopy

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);
    }
}
Also used : IServer(org.eclipse.wst.server.core.IServer) IServerWorkingCopy(org.eclipse.wst.server.core.IServerWorkingCopy)

Example 4 with IServerWorkingCopy

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());
}
Also used : NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) IModule(org.eclipse.wst.server.core.IModule) IServerWorkingCopy(org.eclipse.wst.server.core.IServerWorkingCopy) CoreException(org.eclipse.core.runtime.CoreException)

Example 5 with IServerWorkingCopy

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());
}
Also used : NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) IServerWorkingCopy(org.eclipse.wst.server.core.IServerWorkingCopy)

Aggregations

IServerWorkingCopy (org.eclipse.wst.server.core.IServerWorkingCopy)8 CoreException (org.eclipse.core.runtime.CoreException)3 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)3 IModule (org.eclipse.wst.server.core.IModule)2 IServer (org.eclipse.wst.server.core.IServer)2 IServerType (org.eclipse.wst.server.core.IServerType)2 LinkedList (java.util.LinkedList)1 IProject (org.eclipse.core.resources.IProject)1 IStatus (org.eclipse.core.runtime.IStatus)1 Status (org.eclipse.core.runtime.Status)1 IRuntime (org.eclipse.wst.server.core.IRuntime)1 IRuntimeType (org.eclipse.wst.server.core.IRuntimeType)1 IRuntimeWorkingCopy (org.eclipse.wst.server.core.IRuntimeWorkingCopy)1