use of io.fabric8.kubernetes.model.annotation.Version in project fabric8 by jboss-fuse.
the class FabricResource method versions.
/**
* Returns the list of version ids
*/
@GET
@Path("versions")
public Map<String, String> versions() {
FabricService fabricService = getFabricService();
if (fabricService != null) {
ProfileService profileService = fabricService.adapt(ProfileService.class);
List<String> versionIds = profileService.getVersions();
return mapToLinks(versionIds, "/version/");
} else {
noFabricService();
}
return Collections.emptyMap();
}
use of io.fabric8.kubernetes.model.annotation.Version in project fabric8 by jboss-fuse.
the class FabricWebRegistrationHandler method registerWebapp.
/**
* Registers a webapp to the registry.
*/
private void registerWebapp(Container container, WebEvent webEvent) {
String id = container.getId();
String url = "${zk:" + id + "/http}" + webEvent.getContextPath();
String bundleName = webEvent.getBundle().getSymbolicName();
String bundleVersion = webEvent.getBundle().getVersion().toString();
setJolokiaUrl(container, url, bundleName);
Version version = container.getVersion();
String versionId = version != null ? version.getId() : null;
String json = "{\"id\":" + jsonEncodeString(id) + ",\"services\":[" + jsonEncodeString(url) + "]" + ",\"version\":" + JsonHelper.jsonEncodeString(versionId) + ",\"bundleName\":" + jsonEncodeString(bundleName) + ",\"bundleVersion\":" + jsonEncodeString(bundleVersion) + ",\"container\":" + jsonEncodeString(id) + "}";
try {
synchronized (webEvent.getBundle()) {
setData(curator.get(), ZkPath.WEBAPPS_CONTAINER.getPath(bundleName, webEvent.getBundle().getVersion().toString(), id), json, CreateMode.EPHEMERAL);
}
} catch (Exception e) {
LOGGER.error("Failed to register webapp {}.", webEvent.getContextPath(), e);
}
}
use of io.fabric8.kubernetes.model.annotation.Version in project fabric8 by jboss-fuse.
the class ProvisionSupport method profileAvailable.
public static Boolean profileAvailable(String profile, String version, Long timeout) throws Exception {
FabricService fabricService = ServiceLocator.awaitService(FabricService.class);
ProfileRegistry profileRegistry = fabricService.adapt(ProfileRegistry.class);
for (long t = 0; (!profileRegistry.hasProfile(version, profile) && t < timeout); t += 2000L) {
Thread.sleep(2000L);
}
return profileRegistry.hasProfile(version, profile);
}
use of io.fabric8.kubernetes.model.annotation.Version in project fabric8 by jboss-fuse.
the class Log4jLogQuery method loadCoords.
protected String loadCoords(String coords, String filePath, String classifier) throws IOException {
String[] split = coords.split("/");
if (split != null && split.length > 2) {
String groupId = split[0];
String artifactId = split[1];
String version = split[2];
if (resolver == null) {
Properties defaultProperties = getDefaultProperties();
Properties systemProperties = System.getProperties();
if (config == null) {
Properties combined = new Properties();
combined.putAll(defaultProperties);
combined.putAll(systemProperties);
if (properties != null) {
combined.putAll(properties);
}
config = new MavenConfigurationImpl(new PropertiesPropertyResolver(combined), ServiceConstants.PID);
}
resolver = new AetherBasedResolver(config);
}
File file = resolver.resolveFile(groupId, artifactId, classifier, "jar", version);
if (file.exists() && file.isFile()) {
if (isRoot(filePath)) {
return jarIndex(file);
}
String fileUri = file.toURI().toString();
URL url = new URL("jar:" + fileUri + "!" + filePath);
return loadString(url);
}
}
return null;
}
use of io.fabric8.kubernetes.model.annotation.Version in project fabric8 by jboss-fuse.
the class AbstractProfileManagementTest method testCreateVersionFrom.
@Test
public void testCreateVersionFrom() throws Exception {
// [FABRIC-1169] Profile version attributes leak to other versions
// VersionState v12 = getProxy().createVersion("1.0", "1.2", Collections.singletonMap("keyA", "valA"));
VersionState v12 = getProxy().createVersionFrom("1.0", "1.2", null);
try {
Assert.assertEquals("1.2", v12.getId());
// Assert.assertEquals("valA", v12.getAttributes().get("keyA"));
List<String> profiles = v12.getProfiles();
Assert.assertTrue(profiles.contains("default"));
Assert.assertTrue(profiles.contains("fabric"));
} finally {
getProxy().deleteVersion("1.2");
}
}
Aggregations