• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java PublishHelper类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.eclipse.wst.server.core.util.PublishHelper的典型用法代码示例。如果您正苦于以下问题:Java PublishHelper类的具体用法?Java PublishHelper怎么用?Java PublishHelper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



PublishHelper类属于org.eclipse.wst.server.core.util包,在下文中一共展示了PublishHelper类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: publishModule

import org.eclipse.wst.server.core.util.PublishHelper; //导入依赖的package包/类
@Override
protected void publishModule(int kind, int deltaKind, IModule[] moduleTree, IProgressMonitor monitor) throws CoreException
{
    if (getServer().getServerState() != IServer.STATE_STOPPED)
    {
        if (deltaKind == ServerBehaviourDelegate.ADDED || deltaKind == ServerBehaviourDelegate.REMOVED)
            setServerRestartState(true);
    }
    if (getJettyServer().isTestEnvironment())
        return;

    Properties p = loadModulePublishLocations();

    PublishHelper helper = new PublishHelper(getRuntimeBaseDirectory().append("temp").toFile());
    // If parent web module
    if (moduleTree.length == 1)
    {
        publishDir(deltaKind,p,moduleTree,helper,monitor);
    }
    // Else a child module
    else
    {
        // Try to determine the URI for the child module
        IWebModule webModule = (IWebModule)moduleTree[0].loadAdapter(IWebModule.class,monitor);
        String childURI = null;
        if (webModule != null)
        {
            childURI = webModule.getURI(moduleTree[1]);
        }
        // Try to determine if child is binary
        IJ2EEModule childModule = (IJ2EEModule)moduleTree[1].loadAdapter(IJ2EEModule.class,monitor);
        boolean isBinary = false;
        if (childModule != null)
        {
            isBinary = childModule.isBinary();
        }

        if (isBinary)
        {
            publishArchiveModule(childURI,kind,deltaKind,p,moduleTree,helper,monitor);
        }
        else
        {
            publishJar(childURI,kind,deltaKind,p,moduleTree,helper,monitor);
        }
    }

    setModulePublishState(moduleTree,IServer.PUBLISH_STATE_NONE);

    saveModulePublishLocations(p);
}
 
开发者ID:bengalaviz,项目名称:JettyWTPPlugin,代码行数:52,代码来源:JettyServerBehaviour.java


示例2: publishJar

import org.eclipse.wst.server.core.util.PublishHelper; //导入依赖的package包/类
/**
 * Publish a jar file.
 * 
 * @param deltaKind
 * @param p
 * @param module
 * @param monitor
 * @throws CoreException
 */
private void publishJar(String jarURI, int kind, int deltaKind, Properties p, IModule[] module, PublishHelper helper, IProgressMonitor monitor)
        throws CoreException
{
    // Remove if requested or if previously published and are now serving
    // without publishing
    if (deltaKind == REMOVED || getJettyServer().isServeModulesWithoutPublish())
    {
        try
        {
            String publishPath = (String)p.get(module[1].getId());
            if (publishPath != null)
            {
                new File(publishPath).delete();
                p.remove(module[1].getId());
            }
        }
        catch (Exception e)
        {
            throw new CoreException(new Status(IStatus.WARNING,JettyPlugin.PLUGIN_ID,0,"Could not remove module",e));
        }
    }
    else
    {
        IPath path = getModuleDeployDirectory(module[0]);
        if (jarURI == null)
        {
            jarURI = "WEB-INF/lib" + module[1].getName() + ".jar";
        }
        IPath jarPath = path.append(jarURI);
        path = jarPath.removeLastSegments(1);
        if (!path.toFile().exists())
        {
            path.toFile().mkdirs();
        }
        else
        {
            // If file still exists and we are not forcing a new one to be
            // built
            if (jarPath.toFile().exists() && kind != IServer.PUBLISH_CLEAN && kind != IServer.PUBLISH_FULL)
            {
                // avoid changes if no changes to module since last publish
                IModuleResourceDelta[] delta = getPublishedResourceDelta(module);
                if (delta == null || delta.length == 0)
                    return;
            }
        }

        IModuleResource[] mr = getResources(module);
        IStatus[] stat = helper.publishZip(mr,jarPath,monitor);
        List<IStatus> status = new ArrayList<IStatus>();
        PublishOperation2.addArrayToList(status,stat);
        PublishOperation2.throwException(status);
        p.put(module[1].getId(),jarPath.toOSString());
    }
}
 
开发者ID:bengalaviz,项目名称:JettyWTPPlugin,代码行数:65,代码来源:JettyServerBehaviour.java


示例3: publishArchiveModule

import org.eclipse.wst.server.core.util.PublishHelper; //导入依赖的package包/类
private void publishArchiveModule(String jarURI, int kind, int deltaKind, Properties p, IModule[] module, PublishHelper helper, IProgressMonitor monitor)
        throws CoreException
{
    // Remove if requested or if previously published and are now serving
    // without publishing
    if (deltaKind == REMOVED || getJettyServer().isServeModulesWithoutPublish())
    {
        try
        {
            String publishPath = (String)p.get(module[1].getId());
            if (publishPath != null)
            {
                new File(publishPath).delete();
                p.remove(module[1].getId());
            }
        }
        catch (Exception e)
        {
            throw new CoreException(new Status(IStatus.WARNING,JettyPlugin.PLUGIN_ID,0,"Could not remove archive module",e));
        }
    }
    else
    {
        List<IStatus> status = new ArrayList<IStatus>();
        IPath path = getModuleDeployDirectory(module[0]);
        if (jarURI == null)
        {
            jarURI = "WEB-INF/lib" + module[1].getName();
        }
        IPath jarPath = path.append(jarURI);
        path = jarPath.removeLastSegments(1);
        if (!path.toFile().exists())
        {
            path.toFile().mkdirs();
        }
        else
        {
            // If file still exists and we are not forcing a new one to be
            // built
            if (jarPath.toFile().exists() && kind != IServer.PUBLISH_CLEAN && kind != IServer.PUBLISH_FULL)
            {
                // avoid changes if no changes to module since last publish
                IModuleResourceDelta[] delta = getPublishedResourceDelta(module);
                if (delta == null || delta.length == 0)
                    return;
            }
        }

        IModuleResource[] mr = getResources(module);
        IStatus[] stat = helper.publishToPath(mr,jarPath,monitor);
        PublishOperation2.addArrayToList(status,stat);
        PublishOperation2.throwException(status);
        p.put(module[1].getId(),jarPath.toOSString());
    }
}
 
开发者ID:bengalaviz,项目名称:JettyWTPPlugin,代码行数:56,代码来源:JettyServerBehaviour.java



注:本文中的org.eclipse.wst.server.core.util.PublishHelper类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java DataContainerChild类代码示例发布时间:2022-05-22
下一篇:
Java RDFTerm类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap