Search in sources :

Example 1 with AppDomainInfo

use of com.qlangtech.tis.manage.common.AppDomainInfo in project tis by qlangtech.

the class AppDomainSelectedCheckValve method doIntercept.

@Override
protected String doIntercept(ActionInvocation invocation) throws Exception {
    final ActionProxy proxy = invocation.getProxy();
    if ("control".equals(StringUtils.split(proxy.getNamespace(), "#")[1])) {
        return invocation.invoke();
    }
    final Rundata rundata = BasicModule.getRundataInstance();
    AppDomainInfo domain = CheckAppDomainExistValve.getAppDomain(daoContextGetter.get());
    final String actionTarget = getActionTarget(proxy);
    if (!include_urls.containsKey(actionTarget)) {
        // 不在校验范围之内
        return invocation.invoke();
    }
    final String specialTarget = specialForward.get(actionTarget);
    boolean sensitiveRuntime = true;
    try {
        if (StringUtils.isNotBlank(specialTarget)) {
            sensitiveRuntime = "true".equalsIgnoreCase(StringUtils.substringAfter(specialTarget, ","));
        }
    } catch (Throwable e) {
    }
    if (isInvalidDomain((BasicModule) proxy.getAction(), domain, sensitiveRuntime)) {
        if (StringUtils.isNotBlank(specialTarget)) {
            rundata.forwardTo(StringUtils.substringBefore(specialTarget, ","));
        } else {
            rundata.forwardTo("appdomainhasnotselected");
            return Action.NONE;
        }
        // context.breakPipeline(0);
        return invocation.invoke();
    // return;
    }
    Collection<RunEnvironment> runtime = include_urls.get(actionTarget);
    if (runtime.contains(domain.getRunEnvironment())) {
        // 跳转到该应用是不能被使用的,不支持 该环境的应用
        rundata.forwardTo("environmentunuseable");
    }
    return invocation.invoke();
}
Also used : AppDomainInfo(com.qlangtech.tis.manage.common.AppDomainInfo) ActionProxy(com.opensymphony.xwork2.ActionProxy) RunEnvironment(com.qlangtech.tis.pubhook.common.RunEnvironment) Rundata(com.qlangtech.tis.runtime.module.action.BasicModule.Rundata)

Example 2 with AppDomainInfo

use of com.qlangtech.tis.manage.common.AppDomainInfo in project tis by qlangtech.

the class SnapshotRevsionAction method doSelectRevsionByContext.

/*
   * 与doSelectRevsion的区别在于,源参数是页面传递, doSelectRevsionByContext的参数是有http接口传入
   */
public void doSelectRevsionByContext(Context context) {
    Integer snapshotid = (Integer) context.get("selectedSnapshotid");
    final String memo = "drds配置更新";
    final ServerGroup group = getAppServerGroup();
    Assert.assertNotNull(group);
    final AppDomainInfo domain = this.getAppDomain();
    if (!StringUtils.equals(this.getString("appname"), domain.getAppName())) {
        this.addErrorMessage(context, "执行的应用:“" + this.getString("appname") + "”,与当前系统应用“" + domain.getAppName() + "”不一致,请关闭当前页面重新打开");
        return;
    }
    if (group.getPublishSnapshotId() != null && snapshotid == (int) group.getPublishSnapshotId()) {
        this.addErrorMessage(context, "SNAPSHOT已经设置为:" + snapshotid + ",请重新设置");
        return;
    }
    Application app = new Application();
    app.setAppId(domain.getAppid());
    app.setProjectName(domain.getAppName());
    change2newSnapshot(snapshotid, memo, group, app, domain.getRunEnvironment(), this);
    addActionMessage(context, "已经将<strong style='background-color:yellow'>" + domain.getRunEnvironment().getDescribe() + "</strong>的应用<strong style='background-color:yellow'>" + domain.getAppName() + "</strong>的第<strong style='background-color:yellow'>" + group.getGroupIndex() + "组</strong>服务器,的发布快照设置成了snapshot:<strong style='background-color:yellow'>" + snapshotid + "</strong>");
}
Also used : AppDomainInfo(com.qlangtech.tis.manage.common.AppDomainInfo)

Example 3 with AppDomainInfo

use of com.qlangtech.tis.manage.common.AppDomainInfo in project tis by qlangtech.

the class SnapshotRevsionAction method doGetSnapshotList.

/**
 * @param context
 */
public void doGetSnapshotList(Context context) {
    AppDomainInfo domain = this.getAppDomain();
    if (domain instanceof Nullable) {
        this.addErrorMessage(context, "has not select app");
        // 是否已经选择了域
        return;
    }
    context.put("hasselectdomain", true);
    Pager pager = this.createPager();
    SnapshotCriteria query = new SnapshotCriteria();
    // 一览先不考虑有 版本设置
    query.createCriteria().andAppidEqualTo(domain.getAppid());
    query.setOrderByClause("snapshot.sn_id desc");
    query.setPageSize(PAGE_SIZE);
    pager.setTotalCount(this.getSnapshotDAO().countByExample(query));
    ServerGroup group = getAppServerGroup();
    SnapshotList snapshotList = new SnapshotList();
    snapshotList.publishSnapshotid = group.getPublishSnapshotId();
    snapshotList.snapshotList = this.getSnapshotDAO().selectByExample(query, pager.getCurPage(), PAGE_SIZE);
    this.setBizResult(context, new PaginationResult(pager, snapshotList.snapshotList, snapshotList.publishSnapshotid));
    Assert.assertNotNull("group can not be null,app:" + domain.getAppName() + ", runtime:" + domain.getRunEnvironment().getKeyName(), group);
// context.put("selectgroup", group);
}
Also used : AppDomainInfo(com.qlangtech.tis.manage.common.AppDomainInfo) Pager(com.koubei.web.tag.pager.Pager) Nullable(com.qlangtech.tis.pubhook.common.Nullable)

Example 4 with AppDomainInfo

use of com.qlangtech.tis.manage.common.AppDomainInfo in project tis by qlangtech.

the class Appselectboxcontrol method execute.

public void execute(Context context) throws Exception {
    // ${contextid}
    // if (context.get("contextid") == null) {
    // context.put("contextid", StringUtils.EMPTY);
    // }
    AppOptionsList optionslist = (AppOptionsList) this.getRequest().getAttribute(key);
    if (optionslist == null) {
        final List<Option> bizlist = this.getBizLineList();
        List<Option> applist = null;
        AppDomainInfo domain = this.getAppDomain();
        if (!(domain instanceof Nullable)) {
            // if (bizid != null) {
            applist = this.getAppList(domain.getDptid());
        // }
        }
        optionslist = new AppOptionsList(bizlist, applist);
        this.getRequest().setAttribute(key, optionslist);
    }
    context.put("bizlinelist", optionslist.bizlinelist);
    context.put("applist", optionslist.applist);
}
Also used : AppDomainInfo(com.qlangtech.tis.manage.common.AppDomainInfo) Option(com.qlangtech.tis.manage.common.Option) Nullable(com.qlangtech.tis.pubhook.common.Nullable)

Example 5 with AppDomainInfo

use of com.qlangtech.tis.manage.common.AppDomainInfo in project tis by qlangtech.

the class IndexQueryAction method doGetServerNodes.

/**
 * @param context
 */
public void doGetServerNodes(Context context) throws Exception {
    AppDomainInfo domain = this.getAppDomain();
    if (domain instanceof Nullable) {
        throw new IllegalStateException("execute phase must be Collection aware");
    }
    QueryResutStrategy queryStrategy = QueryIndexServlet.createQueryResutStrategy(domain, new QueryRequestWrapper(getRequest(), context), getResponse(), getDaoContext());
    List<ServerJoinGroup> nodes = queryStrategy.queryProcess();
    List<PSchemaField> sfields = IndexQuery.getSfields(this.getRequest(), queryStrategy, nodes);
    Map<String, Object> props = Maps.newHashMap();
    props.put("nodes", queryStrategy.selectCandiate);
    props.put("fields", sfields.stream().map((c) -> c.getName()).collect(Collectors.toList()));
    this.setBizResult(context, props);
}
Also used : AppDomainInfo(com.qlangtech.tis.manage.common.AppDomainInfo) PSchemaField(com.qlangtech.tis.solrdao.pojo.PSchemaField) QueryRequestWrapper(com.qlangtech.tis.runtime.module.screen.IndexQuery.QueryRequestWrapper) Nullable(com.qlangtech.tis.pubhook.common.Nullable)

Aggregations

AppDomainInfo (com.qlangtech.tis.manage.common.AppDomainInfo)8 Nullable (com.qlangtech.tis.pubhook.common.Nullable)4 Pager (com.koubei.web.tag.pager.Pager)1 ActionProxy (com.opensymphony.xwork2.ActionProxy)1 Application (com.qlangtech.tis.manage.biz.dal.pojo.Application)1 Department (com.qlangtech.tis.manage.biz.dal.pojo.Department)1 Option (com.qlangtech.tis.manage.common.Option)1 SnapshotDomain (com.qlangtech.tis.manage.common.SnapshotDomain)1 Func (com.qlangtech.tis.manage.spring.aop.Func)1 RunEnvironment (com.qlangtech.tis.pubhook.common.RunEnvironment)1 Rundata (com.qlangtech.tis.runtime.module.action.BasicModule.Rundata)1 QueryRequestWrapper (com.qlangtech.tis.runtime.module.screen.IndexQuery.QueryRequestWrapper)1 PSchemaField (com.qlangtech.tis.solrdao.pojo.PSchemaField)1 DocCollection (org.apache.solr.common.cloud.DocCollection)1