Search in sources :

Example 6 with ModuleDelegate

use of org.eclipse.wst.server.core.model.ModuleDelegate in project webtools.servertools by eclipse.

the class ModulePublishInfo method fillCache.

/**
 * Fill the module cache.
 *
 * @param module
 */
private void fillCache(IModule[] module) {
    if (!useCache)
        return;
    if (currentResources != null)
        return;
    try {
        long time = System.currentTimeMillis();
        IModule m = module[module.length - 1];
        ModuleDelegate pm = (ModuleDelegate) m.loadAdapter(ModuleDelegate.class, null);
        if (pm == null || (m.getProject() != null && !m.getProject().isAccessible()))
            currentResources = EMPTY_MODULE_RESOURCE;
        else
            currentResources = pm.members();
        delta = ServerPublishInfo.getDelta(resources, currentResources);
        hasDelta = (delta != null && delta.length > 0);
        if (Trace.PERFORMANCE) {
            Trace.trace(Trace.STRING_PERFORMANCE, "Filling publish cache for " + m.getName() + ": " + (System.currentTimeMillis() - time));
        }
    } catch (CoreException ce) {
        if (Trace.WARNING) {
            Trace.trace(Trace.STRING_WARNING, "Couldn't fill publish cache for " + module);
        }
    }
    if (delta == null)
        delta = EMPTY_MODULE_RESOURCE_DELTA;
}
Also used : IModule(org.eclipse.wst.server.core.IModule) ModuleDelegate(org.eclipse.wst.server.core.model.ModuleDelegate)

Example 7 with ModuleDelegate

use of org.eclipse.wst.server.core.model.ModuleDelegate in project webtools.servertools by eclipse.

the class ModulePublishInfo method fill.

public void fill(IModule[] module) {
    if (module == null)
        return;
    if (useCache) {
        fillCache(module);
        setResources(currentResources);
        return;
    }
    IModule m = module[module.length - 1];
    ModuleDelegate pm = (ModuleDelegate) m.loadAdapter(ModuleDelegate.class, null);
    if (pm == null || (m.getProject() != null && !m.getProject().isAccessible())) {
        setResources(EMPTY_MODULE_RESOURCE);
        return;
    }
    try {
        setResources(pm.members());
    } catch (CoreException ce) {
        if (Trace.WARNING) {
            Trace.trace(Trace.STRING_WARNING, "Possible failure in fill", ce);
        }
    }
}
Also used : IModule(org.eclipse.wst.server.core.IModule) ModuleDelegate(org.eclipse.wst.server.core.model.ModuleDelegate)

Aggregations

IModule (org.eclipse.wst.server.core.IModule)7 ModuleDelegate (org.eclipse.wst.server.core.model.ModuleDelegate)7 IModuleResource (org.eclipse.wst.server.core.model.IModuleResource)5 ByteArrayInputStream (java.io.ByteArrayInputStream)2 SlingContentModuleFactory (org.apache.sling.ide.eclipse.core.internal.SlingContentModuleFactory)2 ProjectAdapter (org.apache.sling.ide.test.impl.helpers.ProjectAdapter)2 IProject (org.eclipse.core.resources.IProject)2 Test (org.junit.Test)2