diff options
author | Jon Bratseth <bratseth@yahoo-inc.com> | 2016-06-15 23:09:44 +0200 |
---|---|---|
committer | Jon Bratseth <bratseth@yahoo-inc.com> | 2016-06-15 23:09:44 +0200 |
commit | 72231250ed81e10d66bfe70701e64fa5fe50f712 (patch) | |
tree | 2728bba1131a6f6e5bdf95afec7d7ff9358dac50 /application-model/src/main |
Publish
Diffstat (limited to 'application-model/src/main')
13 files changed, 170 insertions, 0 deletions
diff --git a/application-model/src/main/java/com/yahoo/vespa/applicationmodel/DummyJavadocTrigger.java b/application-model/src/main/java/com/yahoo/vespa/applicationmodel/DummyJavadocTrigger.java new file mode 100644 index 00000000000..79406276885 --- /dev/null +++ b/application-model/src/main/java/com/yahoo/vespa/applicationmodel/DummyJavadocTrigger.java @@ -0,0 +1,13 @@ +// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.vespa.applicationmodel; + +/** + * Dummy class present only to satisfy javadoc plugin. + * + * See http://stackoverflow.com/questions/1138390/javadoc-for-package-info-java-only + * + * @author bakksjo + */ +final class DummyJavadocTrigger { + private DummyJavadocTrigger() {} // Prevents instantiation. +} diff --git a/application-model/src/main/java/com/yahoo/vespa/applicationmodel/package-info.java b/application-model/src/main/java/com/yahoo/vespa/applicationmodel/package-info.java new file mode 100644 index 00000000000..e01fa69999d --- /dev/null +++ b/application-model/src/main/java/com/yahoo/vespa/applicationmodel/package-info.java @@ -0,0 +1,5 @@ +// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +@ExportPackage +package com.yahoo.vespa.applicationmodel; + +import com.yahoo.osgi.annotation.ExportPackage; diff --git a/application-model/src/main/scala/com/yahoo/vespa/applicationmodel/ApplicationInstance.scala b/application-model/src/main/scala/com/yahoo/vespa/applicationmodel/ApplicationInstance.scala new file mode 100644 index 00000000000..7fadcbb52a6 --- /dev/null +++ b/application-model/src/main/scala/com/yahoo/vespa/applicationmodel/ApplicationInstance.scala @@ -0,0 +1,17 @@ +// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.vespa.applicationmodel + +/** + * TODO: What is this + * + * @author <a href="mailto:bakksjo@yahoo-inc.com">Oyvind Bakksjo</a> + */ +case class ApplicationInstance[S]( + tenantId: TenantId, + applicationInstanceId: ApplicationInstanceId, + + // TODO: What is this for? + serviceClusters: java.util.Set[ServiceCluster[S]]) { + + def reference = ApplicationInstanceReference(tenantId, applicationInstanceId) +} diff --git a/application-model/src/main/scala/com/yahoo/vespa/applicationmodel/ApplicationInstanceId.scala b/application-model/src/main/scala/com/yahoo/vespa/applicationmodel/ApplicationInstanceId.scala new file mode 100644 index 00000000000..f2152e82378 --- /dev/null +++ b/application-model/src/main/scala/com/yahoo/vespa/applicationmodel/ApplicationInstanceId.scala @@ -0,0 +1,15 @@ +// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.vespa.applicationmodel + +import com.fasterxml.jackson.annotation.JsonValue + +/** + * @author <a href="mailto:bakksjo@yahoo-inc.com">Oyvind Bakksjo</a> + */ + // TODO: Remove this and use ApplicationName/InstanceName instead (if you need it for the JSON stuff move it to that layer and don't let it leak) +case class ApplicationInstanceId(s: String) { + // Jackson's StdKeySerializer uses toString() (and ignores annotations) for objects used as Map keys. + // Therefore, we use toString() as the JSON-producing method, which is really sad. + @JsonValue + override def toString(): String = s +} diff --git a/application-model/src/main/scala/com/yahoo/vespa/applicationmodel/ApplicationInstanceReference.scala b/application-model/src/main/scala/com/yahoo/vespa/applicationmodel/ApplicationInstanceReference.scala new file mode 100644 index 00000000000..3d44656492e --- /dev/null +++ b/application-model/src/main/scala/com/yahoo/vespa/applicationmodel/ApplicationInstanceReference.scala @@ -0,0 +1,15 @@ +// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.vespa.applicationmodel + +import com.fasterxml.jackson.annotation.JsonValue + +/** + * @author <a href="mailto:bakksjo@yahoo-inc.com">Oyvind Bakksjo</a> + */ + // TODO: Remove this and use ApplicationId instead (if you need it for the JSON stuff move it to that layer and don't let it leak) +case class ApplicationInstanceReference(tenantId: TenantId, applicationInstanceId: ApplicationInstanceId) { + // Jackson's StdKeySerializer uses toString() (and ignores annotations) for objects used as Map keys. + // Therefore, we use toString() as the JSON-producing method, which is really sad. + @JsonValue + override def toString(): String = s"${tenantId.s}:${applicationInstanceId.s}" +} diff --git a/application-model/src/main/scala/com/yahoo/vespa/applicationmodel/ClusterId.scala b/application-model/src/main/scala/com/yahoo/vespa/applicationmodel/ClusterId.scala new file mode 100644 index 00000000000..e4a5da2c560 --- /dev/null +++ b/application-model/src/main/scala/com/yahoo/vespa/applicationmodel/ClusterId.scala @@ -0,0 +1,14 @@ +// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.vespa.applicationmodel + +import com.fasterxml.jackson.annotation.JsonValue + +/** + * @author <a href="mailto:bakksjo@yahoo-inc.com">Oyvind Bakksjo</a> + */ +case class ClusterId(s: String) { + // Jackson's StdKeySerializer uses toString() (and ignores annotations) for objects used as Map keys. + // Therefore, we use toString() as the JSON-producing method, which is really sad. + @JsonValue + override def toString(): String = s +} diff --git a/application-model/src/main/scala/com/yahoo/vespa/applicationmodel/ConfigId.scala b/application-model/src/main/scala/com/yahoo/vespa/applicationmodel/ConfigId.scala new file mode 100644 index 00000000000..40b828bfdba --- /dev/null +++ b/application-model/src/main/scala/com/yahoo/vespa/applicationmodel/ConfigId.scala @@ -0,0 +1,14 @@ +// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.vespa.applicationmodel + +import com.fasterxml.jackson.annotation.JsonValue + +/** + * @author <a href="mailto:bakksjo@yahoo-inc.com">Oyvind Bakksjo</a> + */ +case class ConfigId(s: String) { + // Jackson's StdKeySerializer uses toString() (and ignores annotations) for objects used as Map keys. + // Therefore, we use toString() as the JSON-producing method, which is really sad. + @JsonValue + override def toString(): String = s +} diff --git a/application-model/src/main/scala/com/yahoo/vespa/applicationmodel/HostName.scala b/application-model/src/main/scala/com/yahoo/vespa/applicationmodel/HostName.scala new file mode 100644 index 00000000000..87ed4d0c550 --- /dev/null +++ b/application-model/src/main/scala/com/yahoo/vespa/applicationmodel/HostName.scala @@ -0,0 +1,14 @@ +// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.vespa.applicationmodel + +import com.fasterxml.jackson.annotation.JsonValue + +/** + * @author <a href="mailto:bakksjo@yahoo-inc.com">Oyvind Bakksjo</a> + */ +case class HostName(s: String) { + // Jackson's StdKeySerializer uses toString() (and ignores annotations) for objects used as Map keys. + // Therefore, we use toString() as the JSON-producing method, which is really sad. + @JsonValue + override def toString(): String = s +} diff --git a/application-model/src/main/scala/com/yahoo/vespa/applicationmodel/ServiceCluster.scala b/application-model/src/main/scala/com/yahoo/vespa/applicationmodel/ServiceCluster.scala new file mode 100644 index 00000000000..e4b538a8a26 --- /dev/null +++ b/application-model/src/main/scala/com/yahoo/vespa/applicationmodel/ServiceCluster.scala @@ -0,0 +1,12 @@ +// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.vespa.applicationmodel + +/** + * Represents a collection of service instances that together make up a service with a single cluster id. + * + * @author <a href="mailto:bakksjo@yahoo-inc.com">Oyvind Bakksjo</a> + */ +case class ServiceCluster[S]( + clusterId: ClusterId, + serviceType: ServiceType, + serviceInstances: java.util.Set[ServiceInstance[S]]) diff --git a/application-model/src/main/scala/com/yahoo/vespa/applicationmodel/ServiceClusterKey.scala b/application-model/src/main/scala/com/yahoo/vespa/applicationmodel/ServiceClusterKey.scala new file mode 100644 index 00000000000..50c7422d358 --- /dev/null +++ b/application-model/src/main/scala/com/yahoo/vespa/applicationmodel/ServiceClusterKey.scala @@ -0,0 +1,15 @@ +// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.vespa.applicationmodel + +import com.fasterxml.jackson.annotation.JsonValue + +/** + * @author <a href="mailto:bakksjo@yahoo-inc.com">Oyvind Bakksjo</a> + */ +case class ServiceClusterKey(clusterId: ClusterId, serviceType: ServiceType) { + // Jackson's StdKeySerializer uses toString() (and ignores annotations) for objects used as Map keys. + // Therefore, we use toString() as the JSON-producing method, which is really sad. + @JsonValue + override def toString(): String = s"${clusterId}:${serviceType}" +} + diff --git a/application-model/src/main/scala/com/yahoo/vespa/applicationmodel/ServiceInstance.scala b/application-model/src/main/scala/com/yahoo/vespa/applicationmodel/ServiceInstance.scala new file mode 100644 index 00000000000..294b2c5e8f0 --- /dev/null +++ b/application-model/src/main/scala/com/yahoo/vespa/applicationmodel/ServiceInstance.scala @@ -0,0 +1,7 @@ +// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.vespa.applicationmodel + +/** + * @author <a href="mailto:bakksjo@yahoo-inc.com">Oyvind Bakksjo</a> + */ +case class ServiceInstance[S](configId: ConfigId, hostName: HostName, serviceStatus: S) diff --git a/application-model/src/main/scala/com/yahoo/vespa/applicationmodel/ServiceType.scala b/application-model/src/main/scala/com/yahoo/vespa/applicationmodel/ServiceType.scala new file mode 100644 index 00000000000..c1a91039ae5 --- /dev/null +++ b/application-model/src/main/scala/com/yahoo/vespa/applicationmodel/ServiceType.scala @@ -0,0 +1,14 @@ +// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.vespa.applicationmodel + +import com.fasterxml.jackson.annotation.JsonValue + +/** + * @author tonytv + */ +case class ServiceType(s: String) { + // Jackson's StdKeySerializer uses toString() (and ignores annotations) for objects used as Map keys. + // Therefore, we use toString() as the JSON-producing method, which is really sad. + @JsonValue + override def toString(): String = s +} diff --git a/application-model/src/main/scala/com/yahoo/vespa/applicationmodel/TenantId.scala b/application-model/src/main/scala/com/yahoo/vespa/applicationmodel/TenantId.scala new file mode 100644 index 00000000000..669c7ce900a --- /dev/null +++ b/application-model/src/main/scala/com/yahoo/vespa/applicationmodel/TenantId.scala @@ -0,0 +1,15 @@ +// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.vespa.applicationmodel + +import com.fasterxml.jackson.annotation.JsonValue + +/** + * @author <a href="mailto:bakksjo@yahoo-inc.com">Oyvind Bakksjo</a> + */ + // TODO: Remove this and use TenantName instead (if you need it for the JSON stuff move it to that layer and don't let it leak) +case class TenantId(s: String) { + // Jackson's StdKeySerializer uses toString() (and ignores annotations) for objects used as Map keys. + // Therefore, we use toString() as the JSON-producing method, which is really sad. + @JsonValue + override def toString(): String = s +} |