Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
eaff071
fix lock and registry typos, finish implementation of message regsitry.
DivineThreepwood Aug 23, 2023
c4a8d5c
introduce user message gql query
DivineThreepwood Aug 23, 2023
91461f4
Implement message registry and minor bug fixes.
DivineThreepwood Dec 26, 2023
7ed32dc
Merge branch 'dev' into 119-implement-low-battery-notification-system
DivineThreepwood Dec 26, 2023
61a8f45
fix compile issue
DivineThreepwood Dec 26, 2023
5b57814
Merge branch '119-implement-low-battery-notification-system' of https…
DivineThreepwood Dec 26, 2023
18b7798
fix unit pool test
DivineThreepwood Dec 27, 2023
7a6dc94
fix mock registry shutdown
DivineThreepwood Dec 27, 2023
511ea42
cleanup logs
DivineThreepwood Dec 27, 2023
0f55722
address some review issues by improving backend to get rid of test sl…
DivineThreepwood Jan 5, 2024
d7db06e
link against compatible jul version
DivineThreepwood Jan 5, 2024
5f0a5d9
fix test issues
DivineThreepwood Jan 5, 2024
a868456
Stablize location and connection consistency handling
DivineThreepwood Jan 8, 2024
e67c3e9
fix flaky location type detection test.
DivineThreepwood Jan 9, 2024
3c687dc
fix typos and fix canDo bug.
DivineThreepwood Jan 9, 2024
2ea5054
make code compile again
DivineThreepwood Jan 9, 2024
2d9daa9
link against latest jul version
DivineThreepwood Jan 9, 2024
a43692d
upgrade jul
DivineThreepwood Jan 16, 2024
3cbc144
link against latest jul version
DivineThreepwood Feb 13, 2024
7d65dcd
make docker image build tag configurable
DivineThreepwood Feb 13, 2024
733aea0
make compatible with latest jul version
DivineThreepwood Feb 13, 2024
3df18d8
link against latest jul version
DivineThreepwood Feb 13, 2024
c906ea1
link against latest jul version that hopefully fixes the registry sta…
DivineThreepwood Feb 20, 2024
96b514c
implement userMessage subscription.
DivineThreepwood Feb 20, 2024
37914dd
fix test issues
DivineThreepwood Feb 20, 2024
993923f
integrate user message subscription in schema
DivineThreepwood Feb 20, 2024
8c09442
fix exception handling in AuthorizationWithTokenHelper to handle user…
DivineThreepwood Feb 20, 2024
272736c
recover notification timing
DivineThreepwood Feb 20, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions build-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,13 @@ WHITE='\033[0;37m'

APP_NAME='docker images'
APP_NAME=${BLUE}${APP_NAME}${NC}
echo -e "=== ${APP_NAME} build docker image...${WHITE}${NC}" &&
docker build -f docker/Dockerfile -t openbaseorg/bco:local .
docker build -f docker/device-manager/openhab/Dockerfile -t openbaseorg/bco-device-manager-openhab:local --build-arg BCO_BASE_IMAGE_VERSION=local docker/device-manager/openhab
docker build -f docker/bco-demo/Dockerfile -t openbaseorg/bco-demo:local --build-arg BCO_BASE_IMAGE_VERSION=local docker/bco-demo
IMAGE_TAG=${1:-local}

echo -e "=== ${APP_NAME} build docker image...${WHITE}${NC}"

docker build -f docker/Dockerfile -t openbaseorg/bco:${IMAGE_TAG} .
docker build -f docker/device-manager/openhab/Dockerfile -t openbaseorg/bco-device-manager-openhab:${IMAGE_TAG} --build-arg BCO_BASE_IMAGE_VERSION=${IMAGE_TAG} docker/device-manager/openhab
docker build -f docker/bco-demo/Dockerfile -t openbaseorg/bco-demo:${IMAGE_TAG} --build-arg BCO_BASE_IMAGE_VERSION=${IMAGE_TAG} docker/bco-demo

# use this for debugging purpose: DOCKER_BUILDKIT=0 docker build -f docker/Dockerfile --progress=plain .
echo -e "=== ${APP_NAME} were ${GREEN}successfully${NC} build.${NC}"
2 changes: 1 addition & 1 deletion lib/jul
Submodule jul updated 33 files
+3 −3 gradle.properties
+1 −1 gradle/wrapper/gradle-wrapper.properties
+0 −37 module/audio/src/main/java/org/openbase/jul/audio/AudioData.java
+15 −0 module/audio/src/main/java/org/openbase/jul/audio/AudioData.kt
+0 −85 module/audio/src/main/java/org/openbase/jul/audio/AudioDataImpl.java
+44 −0 module/audio/src/main/java/org/openbase/jul/audio/AudioDataImpl.kt
+0 −33 module/audio/src/main/java/org/openbase/jul/audio/AudioFileHolder.java
+11 −0 module/audio/src/main/java/org/openbase/jul/audio/AudioFileHolder.kt
+0 −149 module/audio/src/main/java/org/openbase/jul/audio/AudioPlayer.java
+156 −0 module/audio/src/main/java/org/openbase/jul/audio/AudioPlayer.kt
+0 −31 module/audio/src/main/java/org/openbase/jul/audio/AudioSource.java
+7 −0 module/audio/src/main/java/org/openbase/jul/audio/AudioSource.kt
+1 −1 ...munication/controller/src/main/java/org/openbase/jul/communication/controller/AbstractControllerServer.java
+42 −26 .../communication/controller/src/main/java/org/openbase/jul/communication/controller/AbstractRemoteClient.java
+9 −6 module/communication/default/src/main/java/org/openbase/jul/communication/exception/RPCResolvedException.java
+11 −4 module/communication/mqtt/src/main/java/org/openbase/jul/communication/mqtt/RPCServerImpl.kt
+14 −11 module/exception/src/main/java/org/openbase/jul/exception/printer/ExceptionPrinter.java
+11 −3 module/extension/type/processing/src/main/java/org/openbase/jul/extension/type/processing/ScopeProcessor.java
+3 −3 ...xtension/type/util/src/main/java/org/openbase/jul/extension/type/util/TransactionSynchronizationFuture.java
+6 −9 module/pattern/default/src/main/java/org/openbase/jul/pattern/AbstractObservable.java
+3 −2 module/schedule/src/main/java/org/openbase/jul/schedule/RecurrenceEventFilter.java
+144 −47 module/storage/src/main/java/org/openbase/jul/storage/registry/AbstractRegistry.java
+2 −3 module/storage/src/main/java/org/openbase/jul/storage/registry/AbstractSynchronizer.java
+135 −62 module/storage/src/main/java/org/openbase/jul/storage/registry/FileSynchronizedRegistryImpl.java
+17 −18 module/storage/src/main/java/org/openbase/jul/storage/registry/version/GitVersionControl.java
+15 −18 module/visual/javafx/build.gradle.kts
+9 −4 module/visual/swing/build.gradle.kts
+0 −421 module/visual/swing/src/main/java/org/openbase/jul/visual/swing/engine/draw2d/AbstractResourcePanel.java
+413 −0 module/visual/swing/src/main/java/org/openbase/jul/visual/swing/engine/draw2d/AbstractResourcePanel.kt
+0 −267 module/visual/swing/src/main/java/org/openbase/jul/visual/swing/engine/draw2d/ResourceDisplayPanel.java
+236 −0 module/visual/swing/src/main/java/org/openbase/jul/visual/swing/engine/draw2d/ResourceDisplayPanel.kt
+36 −0 module/visual/swing/src/main/java/org/openbase/jul/visual/swing/engine/draw2d/ResourcePanel.kt
+28 −59 versions.properties
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ import org.springframework.context.annotation.Bean
* License along with this program. If not, see
* <http://www.gnu.org/licenses/gpl-3.0.html>.
* #L%
*/@SpringBootApplication
*/
@SpringBootApplication
open class BcoGraphQlApiSpringBootApplication {
private var injector: Injector? = null

Expand All @@ -84,6 +85,8 @@ open class BcoGraphQlApiSpringBootApplication {
)
val unitDataOutputType = schema.getType("openbase_type_domotic_unit_UnitData") as GraphQLOutputType?
val unitConfigOutputType = schema.getType("openbase_type_domotic_unit_UnitConfig") as GraphQLOutputType?
val userMessageOutputType =
schema.getType("openbase_type_domotic_communication_UserMessage") as GraphQLOutputType?
val unitFilterInputType = schema.getType("Input_openbase_type_domotic_unit_UnitFilter") as GraphQLInputType?
val unitFilterInputConverter =
GqlInputConverter.newBuilder().add(UnitFilterType.UnitFilter.getDescriptor().file).build()
Expand All @@ -99,6 +102,11 @@ open class BcoGraphQlApiSpringBootApplication {
.argument(GraphQLArgument.newArgument().name("includeDisabledUnits").type(Scalars.GraphQLBoolean))
.build()
)
builder.field(
GraphQLFieldDefinition.newFieldDefinition().name("userMessages")
.type(GraphQLList.list(userMessageOutputType))
.build()
)
val codeRegistry = GraphQLCodeRegistry.newCodeRegistry(schema.codeRegistry)
.dataFetcher(FieldCoordinates.coordinates("Subscription", "units"), DataFetcher { dataFetchingEnvironment ->
val unitFilter = unitFilterInputConverter.createProtoBuf(
Expand All @@ -122,6 +130,11 @@ open class BcoGraphQlApiSpringBootApplication {
}
SubscriptionModule.subscribeUnitConfigs(unitFilter, includeDisabledUnits)
})
.dataFetcher(
FieldCoordinates.coordinates("Subscription", "userMessages"),
DataFetcher {
SubscriptionModule.subscribeUserMessages()
})
.build()
return GraphQLSchema.newSchema(schema)
.subscription(builder.build())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ abstract class AbstractBCOGraphQLContext(
abstract val languageCode: String?

val auth: AuthTokenType.AuthToken?
get() = AuthTokenType.AuthToken.newBuilder().setAuthenticationToken(token).build()
get() = token?.let { AuthTokenType.AuthToken.newBuilder().setAuthenticationToken(it).build() }

companion object {
const val DATA_LOADER_UNITS = "units"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ import org.openbase.bco.api.graphql.error.GenericError
import org.openbase.bco.api.graphql.error.ServerError
import org.openbase.bco.authentication.lib.SessionManager
import org.openbase.bco.authentication.lib.iface.BCOSession
import org.openbase.bco.registry.message.remote.registerUserMessageAuthenticated
import org.openbase.bco.registry.message.remote.removeUserMessageAuthenticated
import org.openbase.bco.registry.message.remote.updateUserMessageAuthenticated
import org.openbase.bco.registry.remote.Registries
import org.openbase.bco.registry.remote.session.BCOSessionImpl
import org.openbase.bco.registry.unit.remote.registerUnitConfigAuthenticated
Expand All @@ -21,6 +24,7 @@ import org.openbase.jul.extension.type.processing.LabelProcessor.getBestMatch
import org.openbase.jul.extension.type.processing.LabelProcessor.replace
import org.openbase.type.configuration.EntryType
import org.openbase.type.configuration.MetaConfigType
import org.openbase.type.domotic.communication.UserMessageType.UserMessage
import org.openbase.type.domotic.service.ServiceTemplateType
import org.openbase.type.domotic.unit.UnitConfigType
import org.openbase.type.domotic.unit.UnitConfigType.UnitConfig
Expand Down Expand Up @@ -56,7 +60,8 @@ import java.util.concurrent.*
* License along with this program. If not, see
* <http://www.gnu.org/licenses/gpl-3.0.html>.
* #L%
*/ class RegistrySchemaModule : SchemaModule() {
*/
class RegistrySchemaModule : SchemaModule() {
/**
* Check if an authentication token retrieved by the login method is still valid.
*
Expand Down Expand Up @@ -157,6 +162,10 @@ import java.util.concurrent.*
@Arg("includeDisabledUnits") includeDisabledUnits: Boolean?,
): ImmutableList<UnitConfigType.UnitConfig> = getUnitConfigs(unitFilter, includeDisabledUnits)

@Query("userMessages")
@Throws(BCOGraphQLError::class)
fun userMessages(): ImmutableList<UserMessage> = getUserMessages()

@Query("gatewayClasses")
@Throws(CouldNotPerformException::class, InterruptedException::class)
fun gatewayClasses(): ImmutableList<GatewayClassType.GatewayClass> =
Expand Down Expand Up @@ -401,7 +410,7 @@ import java.util.concurrent.*
break
}
}
if (!entry.value.isEmpty()) {
if (entry.value.isNotEmpty()) {
metaConfigBuilder.addEntry(entry)
}

Expand All @@ -419,6 +428,92 @@ import java.util.concurrent.*
throw GenericError(ex)
}

@Mutation("updateUserMessage")
@Throws(BCOGraphQLError::class)
fun updateUserMessage(
@Arg("userMessage") userMessage: UserMessage,
env: DataFetchingEnvironment,
): UserMessage = try {
val userMessageBuilder = Registries.getMessageRegistry(
ServerError.BCO_TIMEOUT_SHORT,
ServerError.BCO_TIMEOUT_TIME_UNIT
)
.getUserMessageById(userMessage.id)
.toBuilder()
userMessageBuilder.mergeFromWithoutRepeatedFields(userMessage)
Registries.getMessageRegistry(
ServerError.BCO_TIMEOUT_SHORT,
ServerError.BCO_TIMEOUT_TIME_UNIT
).updateUserMessageAuthenticated(
userMessageBuilder.build(),
env.context.auth
)[ServerError.BCO_TIMEOUT_SHORT, ServerError.BCO_TIMEOUT_TIME_UNIT]
} catch (ex: RuntimeException) {
throw GenericError(ex)
} catch (ex: CouldNotPerformException) {
throw GenericError(ex)
} catch (ex: InterruptedException) {
throw GenericError(ex)
} catch (ex: ExecutionException) {
throw GenericError(ex)
} catch (ex: TimeoutException) {
throw GenericError(ex)
}

@Mutation("removeUserMessage")
@Throws(BCOGraphQLError::class)
fun removeUserMessage(
@Arg("unitId") unitId: String?,
env: DataFetchingEnvironment,
): UserMessage = try {
val userMessage = Registries.getMessageRegistry(
ServerError.BCO_TIMEOUT_SHORT,
ServerError.BCO_TIMEOUT_TIME_UNIT
).getUserMessageById(unitId)
Registries.getMessageRegistry(
ServerError.BCO_TIMEOUT_SHORT,
ServerError.BCO_TIMEOUT_TIME_UNIT
).removeUserMessageAuthenticated(
userMessage,
env.context.auth
)[ServerError.BCO_TIMEOUT_SHORT, ServerError.BCO_TIMEOUT_TIME_UNIT]
} catch (ex: RuntimeException) {
throw GenericError(ex)
} catch (ex: CouldNotPerformException) {
throw GenericError(ex)
} catch (ex: InterruptedException) {
throw GenericError(ex)
} catch (ex: ExecutionException) {
throw GenericError(ex)
} catch (ex: TimeoutException) {
throw GenericError(ex)
}

@Mutation("registerUserMessage")
@Throws(BCOGraphQLError::class)
fun registerUserMessage(
@Arg("userMessage") userMessage: UserMessage?,
env: DataFetchingEnvironment,
): UserMessage = try {
Registries.getMessageRegistry(
ServerError.BCO_TIMEOUT_SHORT,
ServerError.BCO_TIMEOUT_TIME_UNIT
).registerUserMessageAuthenticated(
userMessage,
env.context.auth
)[ServerError.BCO_TIMEOUT_SHORT, ServerError.BCO_TIMEOUT_TIME_UNIT]
} catch (ex: RuntimeException) {
throw GenericError(ex)
} catch (ex: CouldNotPerformException) {
throw GenericError(ex)
} catch (ex: InterruptedException) {
throw GenericError(ex)
} catch (ex: ExecutionException) {
throw GenericError(ex)
} catch (ex: TimeoutException) {
throw GenericError(ex)
}

companion object {
@Throws(BCOGraphQLError::class)
fun getUnitConfigs(
Expand All @@ -438,5 +533,22 @@ import java.util.concurrent.*
} catch (ex: InterruptedException) {
throw GenericError(ex)
}

@Throws(BCOGraphQLError::class)
fun getUserMessages(
): ImmutableList<UserMessage> = try {
ImmutableList.copyOf(
Registries.getMessageRegistry(
ServerError.BCO_TIMEOUT_SHORT,
ServerError.BCO_TIMEOUT_TIME_UNIT
).userMessages
)
} catch (ex: RuntimeException) {
throw GenericError(ex)
} catch (ex: CouldNotPerformException) {
throw GenericError(ex)
} catch (ex: InterruptedException) {
throw GenericError(ex)
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package org.openbase.bco.api.graphql.subscriptions

import com.google.common.collect.ImmutableList
import org.openbase.bco.api.graphql.error.ServerError
import org.openbase.bco.api.graphql.schema.RegistrySchemaModule
import org.openbase.bco.registry.remote.Registries
import org.openbase.jul.pattern.provider.DataProvider
import org.openbase.type.domotic.communication.UserMessageType
import org.openbase.type.domotic.registry.MessageRegistryDataType

class MessageRegistrySubscriptionObserver() :
AbstractObserverMapper<DataProvider<MessageRegistryDataType.MessageRegistryData>, MessageRegistryDataType.MessageRegistryData, List<UserMessageType.UserMessage>>() {
private val userMessages: MutableList<UserMessageType.UserMessage>

init {
Registries.getMessageRegistry(
ServerError.BCO_TIMEOUT_SHORT,
ServerError.BCO_TIMEOUT_TIME_UNIT
)
userMessages = ArrayList(
RegistrySchemaModule.getUserMessages()
)
}

@Throws(Exception::class)
override fun update(
source: DataProvider<MessageRegistryDataType.MessageRegistryData>,
target: MessageRegistryDataType.MessageRegistryData,
) {
val newUserMessages: ImmutableList<UserMessageType.UserMessage> =
RegistrySchemaModule.getUserMessages()
if (newUserMessages == userMessages) {
// nothing has changed
return
}

// store update
userMessages.clear()
userMessages.addAll(newUserMessages)
super.update(source, target)
}

@Throws(Exception::class)
override fun mapData(
source: DataProvider<MessageRegistryDataType.MessageRegistryData>,
data: MessageRegistryDataType.MessageRegistryData,
): List<UserMessageType.UserMessage> {
return userMessages
}
}
Loading