protected String getContainerAlias(KieContainerResource containerResource) { String alias = containerResource.getContainerAlias(); if (alias == null || alias.isEmpty()) { alias = containerResource.getReleaseId().getArtifactId(); } return alias; }
public Builder releaseId(ReleaseId releaseId) { this.groupId = releaseId.getGroupId(); this.artifactId = releaseId.getArtifactId(); this.version = releaseId.getVersion(); return this; }
public ReleaseIdFilter(ReleaseId releaseId) { this(releaseId.getGroupId(), releaseId.getArtifactId(),releaseId.getVersion()); }
public void setup(final ReleaseId gav) { checkNotNull("gav", gav); view.setup(gav.getGroupId(), gav.getArtifactId()); } }
KieContainerResource container = new KieContainerResource(releaseId.getArtifactId(), releaseId, KieContainerStatus.STARTED); containers.add(container);
/** * Checks whether the specified releaseId matches (is accepted by) this filter. * * @param releaseId releaseId to match against * @return true if this filter accepts the specified releaseId, otherwise false */ public boolean accept(ReleaseId releaseId) { if (releaseId == null) { throw new IllegalArgumentException("ReleaseId can not be null!"); } return matches(groupId, releaseId.getGroupId()) && matches(artifactId, releaseId.getArtifactId()) && matches(version, releaseId.getVersion()); }
@Test public void testSetup() { final ReleaseId releaseId = new ReleaseId( "com.company", "artifact-id", "1.0.0" ); presenter.setup( releaseId ); verify( view ).setup( releaseId.getGroupId(), releaseId.getArtifactId() ); }
times(times)).setGroupIp(containerSpec.getReleasedId().getGroupId()); verify(view, times(times)).setArtifactId(containerSpec.getReleasedId().getArtifactId()); verify(containerRulesConfigPresenter, times(times)).setVersion(releaseId.getVersion());
public void upgrade(final String version) { view.disableActions(); ruleCapabilitiesService.call(new RemoteCallback<Void>() { @Override public void callback(final Void response) { if (version != null && !version.isEmpty() && version.compareTo(containerSpec.getReleasedId().getVersion()) == 0) { notification.fire(new NotificationEvent(view.getUpgradeSuccessMessage(), NotificationEvent.NotificationType.SUCCESS)); } updateViewState(); } }, new ErrorCallback<Object>() { @Override public boolean error(final Object o, final Throwable throwable) { notification.fire(new NotificationEvent(view.getUpgradeErrorMessage(), NotificationEvent.NotificationType.ERROR)); updateViewState(); return false; } }).upgradeContainer(containerSpec, new ReleaseId(containerSpec.getReleasedId().getGroupId(), containerSpec.getReleasedId().getArtifactId(), version)); }
private void updateView(final Collection<Container> containers) { containerStatusEmptyPresenter.setup(containerSpec); containerRemoteStatusPresenter.setup(containerSpec, containers); view.clear(); if (isEmpty(containers)) { view.setStatus(containerStatusEmptyPresenter.getView()); } else { view.setStatus(containerRemoteStatusPresenter.getView()); } view.setContainerName(containerSpec.getContainerName()); view.setGroupIp(containerSpec.getReleasedId().getGroupId()); view.setArtifactId(containerSpec.getReleasedId().getArtifactId()); containerRulesConfigPresenter.setVersion(containerSpec.getReleasedId().getVersion()); containerProcessConfigPresenter.disable(); updateStatus(containerSpec.getStatus() != null ? containerSpec.getStatus() : KieContainerStatus.STOPPED); for (Map.Entry<Capability, ContainerConfig> entry : containerSpec.getConfigs().entrySet()) { switch (entry.getKey()) { case RULE: setupRuleConfig((RuleConfig) entry.getValue()); break; case PROCESS: setupProcessConfig((ProcessConfig) entry.getValue()); break; } } }
@Override public void upgradeContainer(final ContainerSpecKey containerSpecKey, ReleaseId releaseId) { ServerTemplate serverTemplate = templateStorage.load(containerSpecKey.getServerTemplateKey().getId()); if (serverTemplate == null) { throw new KieServerControllerIllegalArgumentException("No server template found for id " + containerSpecKey.getServerTemplateKey().getId()); } ContainerSpec containerSpec = serverTemplate.getContainerSpec(containerSpecKey.getId()); if (containerSpec == null) { throw new KieServerControllerIllegalArgumentException("No container spec found for id " + containerSpecKey.getId()); } if (releaseId.getGroupId() == null) { releaseId.setGroupId(containerSpec.getReleasedId().getGroupId()); } if (releaseId.getArtifactId() == null) { releaseId.setArtifactId(containerSpec.getReleasedId().getArtifactId()); } final List<Container> containers; containerSpec.setReleasedId(releaseId); if (containerSpec.getStatus() == KieContainerStatus.STARTED) { containers = kieServerInstanceManager.upgradeContainer(serverTemplate, containerSpec); } else { containers = kieServerInstanceManager.startContainer(serverTemplate, containerSpec); } containerSpec.setStatus(KieContainerStatus.STARTED); templateStorage.update(serverTemplate); notificationService.notify(serverTemplate, containerSpec, containers); }