diff --git a/guacamole-ext/src/main/java/org/apache/guacamole/language/TranslatableGuacamoleClientBadTypeException.java b/guacamole-ext/src/main/java/org/apache/guacamole/language/TranslatableGuacamoleClientBadTypeException.java new file mode 100644 index 000000000..e48b1cf11 --- /dev/null +++ b/guacamole-ext/src/main/java/org/apache/guacamole/language/TranslatableGuacamoleClientBadTypeException.java @@ -0,0 +1,122 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.guacamole.language; + +import org.apache.guacamole.GuacamoleClientBadTypeException; + +/** + * A {@link GuacamoleClientBadTypeException} whose associated message is + * translatable and can be passed through an arbitrary translation service, + * producing a human-readable message in the user's native language. + */ +public class TranslatableGuacamoleClientBadTypeException extends GuacamoleClientBadTypeException implements Translatable { + + /** + * A translatable, human-readable description of the exception that + * occurred. + */ + private final TranslatableMessage translatableMessage; + + /** + * Creates a new TranslatableGuacamoleClientBadTypeException with the given + * message and cause. The message must be provided in both non-translatable + * (readable as-written) and translatable forms. + * + * @param message + * A human-readable description of the exception that occurred. This + * message should be readable on its own and as-written, without + * requiring a translation service. + * + * @param translatableMessage + * A translatable, human-readable description of the exception that + * occurred. + * + * @param cause + * The cause of this exception. + */ + public TranslatableGuacamoleClientBadTypeException(String message, TranslatableMessage translatableMessage, Throwable cause) { + super(message, cause); + this.translatableMessage = translatableMessage; + } + + /** + * Creates a new TranslatableGuacamoleClientBadTypeException with the given + * message. The message must be provided in both non-translatable (readable + * as-written) and translatable forms. + * + * @param message + * A human-readable description of the exception that occurred. This + * message should be readable on its own and as-written, without + * requiring a translation service. + * + * @param translatableMessage + * A translatable, human-readable description of the exception that + * occurred. + */ + public TranslatableGuacamoleClientBadTypeException(String message, TranslatableMessage translatableMessage) { + super(message); + this.translatableMessage = translatableMessage; + } + + /** + * Creates a new TranslatableGuacamoleClientBadTypeException with the given + * message and cause. The message must be provided in both non-translatable + * (readable as-written) and translatable forms. + * + * @param message + * A human-readable description of the exception that occurred. This + * message should be readable on its own and as-written, without + * requiring a translation service. + * + * @param key + * The arbitrary key which can be used to look up the message to be + * displayed in the user's native language. + * + * @param cause + * The cause of this exception. + */ + public TranslatableGuacamoleClientBadTypeException(String message, String key, Throwable cause) { + this(message, new TranslatableMessage(key), cause); + } + + /** + * Creates a new TranslatableGuacamoleClientBadTypeException with the given + * message. The message must be provided in both non-translatable (readable + * as-written) and translatable forms. + * + * @param message + * A human-readable description of the exception that occurred. This + * message should be readable on its own and as-written, without + * requiring a translation service. + * + * @param key + * The arbitrary key which can be used to look up the message to be + * displayed in the user's native language. + */ + public TranslatableGuacamoleClientBadTypeException(String message, String key) { + this(message, new TranslatableMessage(key)); + } + + @Override + public TranslatableMessage getTranslatableMessage() { + return translatableMessage; + } + +} diff --git a/guacamole-ext/src/main/java/org/apache/guacamole/language/TranslatableGuacamoleClientException.java b/guacamole-ext/src/main/java/org/apache/guacamole/language/TranslatableGuacamoleClientException.java new file mode 100644 index 000000000..59818ed95 --- /dev/null +++ b/guacamole-ext/src/main/java/org/apache/guacamole/language/TranslatableGuacamoleClientException.java @@ -0,0 +1,122 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.guacamole.language; + +import org.apache.guacamole.GuacamoleClientException; + +/** + * A {@link GuacamoleClientException} whose associated message is translatable + * and can be passed through an arbitrary translation service, producing a + * human-readable message in the user's native language. + */ +public class TranslatableGuacamoleClientException extends GuacamoleClientException implements Translatable { + + /** + * A translatable, human-readable description of the exception that + * occurred. + */ + private final TranslatableMessage translatableMessage; + + /** + * Creates a new TranslatableGuacamoleClientException with the given + * message and cause. The message must be provided in both non-translatable + * (readable as-written) and translatable forms. + * + * @param message + * A human-readable description of the exception that occurred. This + * message should be readable on its own and as-written, without + * requiring a translation service. + * + * @param translatableMessage + * A translatable, human-readable description of the exception that + * occurred. + * + * @param cause + * The cause of this exception. + */ + public TranslatableGuacamoleClientException(String message, TranslatableMessage translatableMessage, Throwable cause) { + super(message, cause); + this.translatableMessage = translatableMessage; + } + + /** + * Creates a new TranslatableGuacamoleClientException with the given + * message. The message must be provided in both non-translatable (readable + * as-written) and translatable forms. + * + * @param message + * A human-readable description of the exception that occurred. This + * message should be readable on its own and as-written, without + * requiring a translation service. + * + * @param translatableMessage + * A translatable, human-readable description of the exception that + * occurred. + */ + public TranslatableGuacamoleClientException(String message, TranslatableMessage translatableMessage) { + super(message); + this.translatableMessage = translatableMessage; + } + + /** + * Creates a new TranslatableGuacamoleClientException with the given + * message and cause. The message must be provided in both non-translatable + * (readable as-written) and translatable forms. + * + * @param message + * A human-readable description of the exception that occurred. This + * message should be readable on its own and as-written, without + * requiring a translation service. + * + * @param key + * The arbitrary key which can be used to look up the message to be + * displayed in the user's native language. + * + * @param cause + * The cause of this exception. + */ + public TranslatableGuacamoleClientException(String message, String key, Throwable cause) { + this(message, new TranslatableMessage(key), cause); + } + + /** + * Creates a new TranslatableGuacamoleClientException with the given + * message. The message must be provided in both non-translatable (readable + * as-written) and translatable forms. + * + * @param message + * A human-readable description of the exception that occurred. This + * message should be readable on its own and as-written, without + * requiring a translation service. + * + * @param key + * The arbitrary key which can be used to look up the message to be + * displayed in the user's native language. + */ + public TranslatableGuacamoleClientException(String message, String key) { + this(message, new TranslatableMessage(key)); + } + + @Override + public TranslatableMessage getTranslatableMessage() { + return translatableMessage; + } + +} diff --git a/guacamole-ext/src/main/java/org/apache/guacamole/language/TranslatableGuacamoleClientOverrunException.java b/guacamole-ext/src/main/java/org/apache/guacamole/language/TranslatableGuacamoleClientOverrunException.java new file mode 100644 index 000000000..3ad94c896 --- /dev/null +++ b/guacamole-ext/src/main/java/org/apache/guacamole/language/TranslatableGuacamoleClientOverrunException.java @@ -0,0 +1,122 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.guacamole.language; + +import org.apache.guacamole.GuacamoleClientOverrunException; + +/** + * A {@link GuacamoleClientOverrunException} whose associated message is + * translatable and can be passed through an arbitrary translation service, + * producing a human-readable message in the user's native language. + */ +public class TranslatableGuacamoleClientOverrunException extends GuacamoleClientOverrunException implements Translatable { + + /** + * A translatable, human-readable description of the exception that + * occurred. + */ + private final TranslatableMessage translatableMessage; + + /** + * Creates a new TranslatableGuacamoleClientOverrunException with the given + * message and cause. The message must be provided in both non-translatable + * (readable as-written) and translatable forms. + * + * @param message + * A human-readable description of the exception that occurred. This + * message should be readable on its own and as-written, without + * requiring a translation service. + * + * @param translatableMessage + * A translatable, human-readable description of the exception that + * occurred. + * + * @param cause + * The cause of this exception. + */ + public TranslatableGuacamoleClientOverrunException(String message, TranslatableMessage translatableMessage, Throwable cause) { + super(message, cause); + this.translatableMessage = translatableMessage; + } + + /** + * Creates a new TranslatableGuacamoleClientOverrunException with the given + * message. The message must be provided in both non-translatable (readable + * as-written) and translatable forms. + * + * @param message + * A human-readable description of the exception that occurred. This + * message should be readable on its own and as-written, without + * requiring a translation service. + * + * @param translatableMessage + * A translatable, human-readable description of the exception that + * occurred. + */ + public TranslatableGuacamoleClientOverrunException(String message, TranslatableMessage translatableMessage) { + super(message); + this.translatableMessage = translatableMessage; + } + + /** + * Creates a new TranslatableGuacamoleClientOverrunException with the given + * message and cause. The message must be provided in both non-translatable + * (readable as-written) and translatable forms. + * + * @param message + * A human-readable description of the exception that occurred. This + * message should be readable on its own and as-written, without + * requiring a translation service. + * + * @param key + * The arbitrary key which can be used to look up the message to be + * displayed in the user's native language. + * + * @param cause + * The cause of this exception. + */ + public TranslatableGuacamoleClientOverrunException(String message, String key, Throwable cause) { + this(message, new TranslatableMessage(key), cause); + } + + /** + * Creates a new TranslatableGuacamoleClientOverrunException with the given + * message. The message must be provided in both non-translatable (readable + * as-written) and translatable forms. + * + * @param message + * A human-readable description of the exception that occurred. This + * message should be readable on its own and as-written, without + * requiring a translation service. + * + * @param key + * The arbitrary key which can be used to look up the message to be + * displayed in the user's native language. + */ + public TranslatableGuacamoleClientOverrunException(String message, String key) { + this(message, new TranslatableMessage(key)); + } + + @Override + public TranslatableMessage getTranslatableMessage() { + return translatableMessage; + } + +} diff --git a/guacamole-ext/src/main/java/org/apache/guacamole/language/TranslatableGuacamoleClientTimeoutException.java b/guacamole-ext/src/main/java/org/apache/guacamole/language/TranslatableGuacamoleClientTimeoutException.java new file mode 100644 index 000000000..6b9ea7e5b --- /dev/null +++ b/guacamole-ext/src/main/java/org/apache/guacamole/language/TranslatableGuacamoleClientTimeoutException.java @@ -0,0 +1,122 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.guacamole.language; + +import org.apache.guacamole.GuacamoleClientTimeoutException; + +/** + * A {@link GuacamoleClientTimeoutException} whose associated message is + * translatable and can be passed through an arbitrary translation service, + * producing a human-readable message in the user's native language. + */ +public class TranslatableGuacamoleClientTimeoutException extends GuacamoleClientTimeoutException implements Translatable { + + /** + * A translatable, human-readable description of the exception that + * occurred. + */ + private final TranslatableMessage translatableMessage; + + /** + * Creates a new TranslatableGuacamoleClientTimeoutException with the given + * message and cause. The message must be provided in both non-translatable + * (readable as-written) and translatable forms. + * + * @param message + * A human-readable description of the exception that occurred. This + * message should be readable on its own and as-written, without + * requiring a translation service. + * + * @param translatableMessage + * A translatable, human-readable description of the exception that + * occurred. + * + * @param cause + * The cause of this exception. + */ + public TranslatableGuacamoleClientTimeoutException(String message, TranslatableMessage translatableMessage, Throwable cause) { + super(message, cause); + this.translatableMessage = translatableMessage; + } + + /** + * Creates a new TranslatableGuacamoleClientTimeoutException with the given + * message. The message must be provided in both non-translatable (readable + * as-written) and translatable forms. + * + * @param message + * A human-readable description of the exception that occurred. This + * message should be readable on its own and as-written, without + * requiring a translation service. + * + * @param translatableMessage + * A translatable, human-readable description of the exception that + * occurred. + */ + public TranslatableGuacamoleClientTimeoutException(String message, TranslatableMessage translatableMessage) { + super(message); + this.translatableMessage = translatableMessage; + } + + /** + * Creates a new TranslatableGuacamoleClientTimeoutException with the given + * message and cause. The message must be provided in both non-translatable + * (readable as-written) and translatable forms. + * + * @param message + * A human-readable description of the exception that occurred. This + * message should be readable on its own and as-written, without + * requiring a translation service. + * + * @param key + * The arbitrary key which can be used to look up the message to be + * displayed in the user's native language. + * + * @param cause + * The cause of this exception. + */ + public TranslatableGuacamoleClientTimeoutException(String message, String key, Throwable cause) { + this(message, new TranslatableMessage(key), cause); + } + + /** + * Creates a new TranslatableGuacamoleClientTimeoutException with the given + * message. The message must be provided in both non-translatable (readable + * as-written) and translatable forms. + * + * @param message + * A human-readable description of the exception that occurred. This + * message should be readable on its own and as-written, without + * requiring a translation service. + * + * @param key + * The arbitrary key which can be used to look up the message to be + * displayed in the user's native language. + */ + public TranslatableGuacamoleClientTimeoutException(String message, String key) { + this(message, new TranslatableMessage(key)); + } + + @Override + public TranslatableMessage getTranslatableMessage() { + return translatableMessage; + } + +} diff --git a/guacamole-ext/src/main/java/org/apache/guacamole/language/TranslatableGuacamoleClientTooManyException.java b/guacamole-ext/src/main/java/org/apache/guacamole/language/TranslatableGuacamoleClientTooManyException.java new file mode 100644 index 000000000..d1ba1cab4 --- /dev/null +++ b/guacamole-ext/src/main/java/org/apache/guacamole/language/TranslatableGuacamoleClientTooManyException.java @@ -0,0 +1,122 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.guacamole.language; + +import org.apache.guacamole.GuacamoleClientTooManyException; + +/** + * A {@link GuacamoleClientTooManyException} whose associated message is + * translatable and can be passed through an arbitrary translation service, + * producing a human-readable message in the user's native language. + */ +public class TranslatableGuacamoleClientTooManyException extends GuacamoleClientTooManyException implements Translatable { + + /** + * A translatable, human-readable description of the exception that + * occurred. + */ + private final TranslatableMessage translatableMessage; + + /** + * Creates a new TranslatableGuacamoleClientTooManyException with the given + * message and cause. The message must be provided in both non-translatable + * (readable as-written) and translatable forms. + * + * @param message + * A human-readable description of the exception that occurred. This + * message should be readable on its own and as-written, without + * requiring a translation service. + * + * @param translatableMessage + * A translatable, human-readable description of the exception that + * occurred. + * + * @param cause + * The cause of this exception. + */ + public TranslatableGuacamoleClientTooManyException(String message, TranslatableMessage translatableMessage, Throwable cause) { + super(message, cause); + this.translatableMessage = translatableMessage; + } + + /** + * Creates a new TranslatableGuacamoleClientTooManyException with the given + * message. The message must be provided in both non-translatable (readable + * as-written) and translatable forms. + * + * @param message + * A human-readable description of the exception that occurred. This + * message should be readable on its own and as-written, without + * requiring a translation service. + * + * @param translatableMessage + * A translatable, human-readable description of the exception that + * occurred. + */ + public TranslatableGuacamoleClientTooManyException(String message, TranslatableMessage translatableMessage) { + super(message); + this.translatableMessage = translatableMessage; + } + + /** + * Creates a new TranslatableGuacamoleClientTooManyException with the given + * message and cause. The message must be provided in both non-translatable + * (readable as-written) and translatable forms. + * + * @param message + * A human-readable description of the exception that occurred. This + * message should be readable on its own and as-written, without + * requiring a translation service. + * + * @param key + * The arbitrary key which can be used to look up the message to be + * displayed in the user's native language. + * + * @param cause + * The cause of this exception. + */ + public TranslatableGuacamoleClientTooManyException(String message, String key, Throwable cause) { + this(message, new TranslatableMessage(key), cause); + } + + /** + * Creates a new TranslatableGuacamoleClientTooManyException with the given + * message. The message must be provided in both non-translatable (readable + * as-written) and translatable forms. + * + * @param message + * A human-readable description of the exception that occurred. This + * message should be readable on its own and as-written, without + * requiring a translation service. + * + * @param key + * The arbitrary key which can be used to look up the message to be + * displayed in the user's native language. + */ + public TranslatableGuacamoleClientTooManyException(String message, String key) { + this(message, new TranslatableMessage(key)); + } + + @Override + public TranslatableMessage getTranslatableMessage() { + return translatableMessage; + } + +} diff --git a/guacamole-ext/src/main/java/org/apache/guacamole/language/TranslatableGuacamoleConnectionClosedException.java b/guacamole-ext/src/main/java/org/apache/guacamole/language/TranslatableGuacamoleConnectionClosedException.java new file mode 100644 index 000000000..9b615a5d3 --- /dev/null +++ b/guacamole-ext/src/main/java/org/apache/guacamole/language/TranslatableGuacamoleConnectionClosedException.java @@ -0,0 +1,122 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.guacamole.language; + +import org.apache.guacamole.GuacamoleConnectionClosedException; + +/** + * A {@link GuacamoleConnectionClosedException} whose associated message is + * translatable and can be passed through an arbitrary translation service, + * producing a human-readable message in the user's native language. + */ +public class TranslatableGuacamoleConnectionClosedException extends GuacamoleConnectionClosedException implements Translatable { + + /** + * A translatable, human-readable description of the exception that + * occurred. + */ + private final TranslatableMessage translatableMessage; + + /** + * Creates a new TranslatableGuacamoleConnectionClosedException with the + * given message and cause. The message must be provided in both + * non-translatable (readable as-written) and translatable forms. + * + * @param message + * A human-readable description of the exception that occurred. This + * message should be readable on its own and as-written, without + * requiring a translation service. + * + * @param translatableMessage + * A translatable, human-readable description of the exception that + * occurred. + * + * @param cause + * The cause of this exception. + */ + public TranslatableGuacamoleConnectionClosedException(String message, TranslatableMessage translatableMessage, Throwable cause) { + super(message, cause); + this.translatableMessage = translatableMessage; + } + + /** + * Creates a new TranslatableGuacamoleConnectionClosedException with the + * given message. The message must be provided in both non-translatable + * (readable as-written) and translatable forms. + * + * @param message + * A human-readable description of the exception that occurred. This + * message should be readable on its own and as-written, without + * requiring a translation service. + * + * @param translatableMessage + * A translatable, human-readable description of the exception that + * occurred. + */ + public TranslatableGuacamoleConnectionClosedException(String message, TranslatableMessage translatableMessage) { + super(message); + this.translatableMessage = translatableMessage; + } + + /** + * Creates a new TranslatableGuacamoleConnectionClosedException with the + * given message and cause. The message must be provided in both + * non-translatable (readable as-written) and translatable forms. + * + * @param message + * A human-readable description of the exception that occurred. This + * message should be readable on its own and as-written, without + * requiring a translation service. + * + * @param key + * The arbitrary key which can be used to look up the message to be + * displayed in the user's native language. + * + * @param cause + * The cause of this exception. + */ + public TranslatableGuacamoleConnectionClosedException(String message, String key, Throwable cause) { + this(message, new TranslatableMessage(key), cause); + } + + /** + * Creates a new TranslatableGuacamoleConnectionClosedException with the + * given message. The message must be provided in both non-translatable + * (readable as-written) and translatable forms. + * + * @param message + * A human-readable description of the exception that occurred. This + * message should be readable on its own and as-written, without + * requiring a translation service. + * + * @param key + * The arbitrary key which can be used to look up the message to be + * displayed in the user's native language. + */ + public TranslatableGuacamoleConnectionClosedException(String message, String key) { + this(message, new TranslatableMessage(key)); + } + + @Override + public TranslatableMessage getTranslatableMessage() { + return translatableMessage; + } + +} diff --git a/guacamole-ext/src/main/java/org/apache/guacamole/language/TranslatableGuacamoleCredentialsException.java b/guacamole-ext/src/main/java/org/apache/guacamole/language/TranslatableGuacamoleCredentialsException.java new file mode 100644 index 000000000..86c04b825 --- /dev/null +++ b/guacamole-ext/src/main/java/org/apache/guacamole/language/TranslatableGuacamoleCredentialsException.java @@ -0,0 +1,144 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.guacamole.language; + +import org.apache.guacamole.net.auth.credentials.CredentialsInfo; +import org.apache.guacamole.net.auth.credentials.GuacamoleCredentialsException; + +/** + * A {@link GuacamoleCredentialsException} whose associated message is + * translatable and can be passed through an arbitrary translation service, + * producing a human-readable message in the user's native language. + */ +public class TranslatableGuacamoleCredentialsException + extends GuacamoleCredentialsException implements Translatable { + + /** + * A translatable, human-readable description of the exception that + * occurred. + */ + private final TranslatableMessage translatableMessage; + + /** + * Creates a new TranslatableGuacamoleCredentialsException with the given + * message, cause, and associated credential information. The message must + * be provided in both non-translatable (readable as-written) and + * translatable forms. + * + * @param message + * A human-readable description of the exception that occurred. This + * message should be readable on its own and as-written, without + * requiring a translation service. + * + * @param translatableMessage + * A translatable, human-readable description of the exception that + * occurred. + * + * @param cause + * The cause of this exception. + * + * @param credentialsInfo + * Information describing the form of valid credentials. + */ + public TranslatableGuacamoleCredentialsException(String message, + TranslatableMessage translatableMessage, Throwable cause, CredentialsInfo credentialsInfo) { + super(message, cause, credentialsInfo); + this.translatableMessage = translatableMessage; + } + + /** + * Creates a new TranslatableGuacamoleCredentialsException with the given + * message, and associated credential information. The message must be + * provided in both non-translatable (readable as-written) and translatable + * forms. + * + * @param message + * A human-readable description of the exception that occurred. This + * message should be readable on its own and as-written, without + * requiring a translation service. + * + * @param translatableMessage + * A translatable, human-readable description of the exception that + * occurred. + * + * @param credentialsInfo + * Information describing the form of valid credentials. + */ + public TranslatableGuacamoleCredentialsException(String message, + TranslatableMessage translatableMessage, CredentialsInfo credentialsInfo) { + super(message, credentialsInfo); + this.translatableMessage = translatableMessage; + } + + /** + * Creates a new TranslatableGuacamoleCredentialsException with the given + * message, cause, and associated credential information. The message must + * be provided in both non-translatable (readable as-written) and + * translatable forms. + * + * @param message + * A human-readable description of the exception that occurred. This + * message should be readable on its own and as-written, without + * requiring a translation service. + * + * @param key + * The arbitrary key which can be used to look up the message to be + * displayed in the user's native language. + * + * @param cause + * The cause of this exception. + * + * @param credentialsInfo + * Information describing the form of valid credentials. + */ + public TranslatableGuacamoleCredentialsException(String message, + String key, Throwable cause, CredentialsInfo credentialsInfo) { + this(message, new TranslatableMessage(key), cause, credentialsInfo); + } + + /** + * Creates a new TranslatableGuacamoleCredentialsException with the given + * message, and associated credential information. The message must be + * provided in both non-translatable (readable as-written) and translatable + * forms. + * + * @param message + * A human-readable description of the exception that occurred. This + * message should be readable on its own and as-written, without + * requiring a translation service. + * + * @param key + * The arbitrary key which can be used to look up the message to be + * displayed in the user's native language. + * + * @param credentialsInfo + * Information describing the form of valid credentials. + */ + public TranslatableGuacamoleCredentialsException(String message, + String key, CredentialsInfo credentialsInfo) { + this(message, new TranslatableMessage(key), credentialsInfo); + } + + @Override + public TranslatableMessage getTranslatableMessage() { + return translatableMessage; + } + +} diff --git a/guacamole-ext/src/main/java/org/apache/guacamole/language/TranslatableGuacamoleInsufficientCredentialsException.java b/guacamole-ext/src/main/java/org/apache/guacamole/language/TranslatableGuacamoleInsufficientCredentialsException.java new file mode 100644 index 000000000..5b51d2ce9 --- /dev/null +++ b/guacamole-ext/src/main/java/org/apache/guacamole/language/TranslatableGuacamoleInsufficientCredentialsException.java @@ -0,0 +1,144 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.guacamole.language; + +import org.apache.guacamole.net.auth.credentials.CredentialsInfo; +import org.apache.guacamole.net.auth.credentials.GuacamoleInsufficientCredentialsException; + +/** + * A {@link GuacamoleInsufficientCredentialsException} whose associated message + * is translatable and can be passed through an arbitrary translation service, + * producing a human-readable message in the user's native language. + */ +public class TranslatableGuacamoleInsufficientCredentialsException + extends GuacamoleInsufficientCredentialsException implements Translatable { + + /** + * A translatable, human-readable description of the exception that + * occurred. + */ + private final TranslatableMessage translatableMessage; + + /** + * Creates a new TranslatableGuacamoleInsufficientCredentialsException with + * the given message, cause, and associated credential information. The + * message must be provided in both non-translatable (readable as-written) + * and translatable forms. + * + * @param message + * A human-readable description of the exception that occurred. This + * message should be readable on its own and as-written, without + * requiring a translation service. + * + * @param translatableMessage + * A translatable, human-readable description of the exception that + * occurred. + * + * @param cause + * The cause of this exception. + * + * @param credentialsInfo + * Information describing the form of valid credentials. + */ + public TranslatableGuacamoleInsufficientCredentialsException(String message, + TranslatableMessage translatableMessage, Throwable cause, CredentialsInfo credentialsInfo) { + super(message, cause, credentialsInfo); + this.translatableMessage = translatableMessage; + } + + /** + * Creates a new TranslatableGuacamoleInsufficientCredentialsException with + * the given message, and associated credential information. The message + * must be provided in both non-translatable (readable as-written) and + * translatable forms. + * + * @param message + * A human-readable description of the exception that occurred. This + * message should be readable on its own and as-written, without + * requiring a translation service. + * + * @param translatableMessage + * A translatable, human-readable description of the exception that + * occurred. + * + * @param credentialsInfo + * Information describing the form of valid credentials. + */ + public TranslatableGuacamoleInsufficientCredentialsException(String message, + TranslatableMessage translatableMessage, CredentialsInfo credentialsInfo) { + super(message, credentialsInfo); + this.translatableMessage = translatableMessage; + } + + /** + * Creates a new TranslatableGuacamoleInsufficientCredentialsException with + * the given message, cause, and associated credential information. The + * message must be provided in both non-translatable (readable as-written) + * and translatable forms. + * + * @param message + * A human-readable description of the exception that occurred. This + * message should be readable on its own and as-written, without + * requiring a translation service. + * + * @param key + * The arbitrary key which can be used to look up the message to be + * displayed in the user's native language. + * + * @param cause + * The cause of this exception. + * + * @param credentialsInfo + * Information describing the form of valid credentials. + */ + public TranslatableGuacamoleInsufficientCredentialsException(String message, + String key, Throwable cause, CredentialsInfo credentialsInfo) { + this(message, new TranslatableMessage(key), cause, credentialsInfo); + } + + /** + * Creates a new TranslatableGuacamoleInsufficientCredentialsException with + * the given message, and associated credential information. The message + * must be provided in both non-translatable (readable as-written) and + * translatable forms. + * + * @param message + * A human-readable description of the exception that occurred. This + * message should be readable on its own and as-written, without + * requiring a translation service. + * + * @param key + * The arbitrary key which can be used to look up the message to be + * displayed in the user's native language. + * + * @param credentialsInfo + * Information describing the form of valid credentials. + */ + public TranslatableGuacamoleInsufficientCredentialsException(String message, + String key, CredentialsInfo credentialsInfo) { + this(message, new TranslatableMessage(key), credentialsInfo); + } + + @Override + public TranslatableMessage getTranslatableMessage() { + return translatableMessage; + } + +} diff --git a/guacamole-ext/src/main/java/org/apache/guacamole/language/TranslatableGuacamoleInvalidCredentialsException.java b/guacamole-ext/src/main/java/org/apache/guacamole/language/TranslatableGuacamoleInvalidCredentialsException.java new file mode 100644 index 000000000..7d878ece6 --- /dev/null +++ b/guacamole-ext/src/main/java/org/apache/guacamole/language/TranslatableGuacamoleInvalidCredentialsException.java @@ -0,0 +1,144 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.guacamole.language; + +import org.apache.guacamole.net.auth.credentials.CredentialsInfo; +import org.apache.guacamole.net.auth.credentials.GuacamoleInvalidCredentialsException; + +/** + * A {@link GuacamoleInvalidCredentialsException} whose associated message + * is translatable and can be passed through an arbitrary translation service, + * producing a human-readable message in the user's native language. + */ +public class TranslatableGuacamoleInvalidCredentialsException + extends GuacamoleInvalidCredentialsException implements Translatable { + + /** + * A translatable, human-readable description of the exception that + * occurred. + */ + private final TranslatableMessage translatableMessage; + + /** + * Creates a new TranslatableGuacamoleInvalidCredentialsException with + * the given message, cause, and associated credential information. The + * message must be provided in both non-translatable (readable as-written) + * and translatable forms. + * + * @param message + * A human-readable description of the exception that occurred. This + * message should be readable on its own and as-written, without + * requiring a translation service. + * + * @param translatableMessage + * A translatable, human-readable description of the exception that + * occurred. + * + * @param cause + * The cause of this exception. + * + * @param credentialsInfo + * Information describing the form of valid credentials. + */ + public TranslatableGuacamoleInvalidCredentialsException(String message, + TranslatableMessage translatableMessage, Throwable cause, CredentialsInfo credentialsInfo) { + super(message, cause, credentialsInfo); + this.translatableMessage = translatableMessage; + } + + /** + * Creates a new TranslatableGuacamoleInvalidCredentialsException with + * the given message, and associated credential information. The message + * must be provided in both non-translatable (readable as-written) and + * translatable forms. + * + * @param message + * A human-readable description of the exception that occurred. This + * message should be readable on its own and as-written, without + * requiring a translation service. + * + * @param translatableMessage + * A translatable, human-readable description of the exception that + * occurred. + * + * @param credentialsInfo + * Information describing the form of valid credentials. + */ + public TranslatableGuacamoleInvalidCredentialsException(String message, + TranslatableMessage translatableMessage, CredentialsInfo credentialsInfo) { + super(message, credentialsInfo); + this.translatableMessage = translatableMessage; + } + + /** + * Creates a new TranslatableGuacamoleInvalidCredentialsException with + * the given message, cause, and associated credential information. The + * message must be provided in both non-translatable (readable as-written) + * and translatable forms. + * + * @param message + * A human-readable description of the exception that occurred. This + * message should be readable on its own and as-written, without + * requiring a translation service. + * + * @param key + * The arbitrary key which can be used to look up the message to be + * displayed in the user's native language. + * + * @param cause + * The cause of this exception. + * + * @param credentialsInfo + * Information describing the form of valid credentials. + */ + public TranslatableGuacamoleInvalidCredentialsException(String message, + String key, Throwable cause, CredentialsInfo credentialsInfo) { + this(message, new TranslatableMessage(key), cause, credentialsInfo); + } + + /** + * Creates a new TranslatableGuacamoleInvalidCredentialsException with + * the given message, and associated credential information. The message + * must be provided in both non-translatable (readable as-written) and + * translatable forms. + * + * @param message + * A human-readable description of the exception that occurred. This + * message should be readable on its own and as-written, without + * requiring a translation service. + * + * @param key + * The arbitrary key which can be used to look up the message to be + * displayed in the user's native language. + * + * @param credentialsInfo + * Information describing the form of valid credentials. + */ + public TranslatableGuacamoleInvalidCredentialsException(String message, + String key, CredentialsInfo credentialsInfo) { + this(message, new TranslatableMessage(key), credentialsInfo); + } + + @Override + public TranslatableMessage getTranslatableMessage() { + return translatableMessage; + } + +} diff --git a/guacamole-ext/src/main/java/org/apache/guacamole/language/TranslatableGuacamoleResourceClosedException.java b/guacamole-ext/src/main/java/org/apache/guacamole/language/TranslatableGuacamoleResourceClosedException.java new file mode 100644 index 000000000..b0e5b4851 --- /dev/null +++ b/guacamole-ext/src/main/java/org/apache/guacamole/language/TranslatableGuacamoleResourceClosedException.java @@ -0,0 +1,122 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.guacamole.language; + +import org.apache.guacamole.GuacamoleResourceClosedException; + +/** + * A {@link GuacamoleResourceClosedException} whose associated message is + * translatable and can be passed through an arbitrary translation service, + * producing a human-readable message in the user's native language. + */ +public class TranslatableGuacamoleResourceClosedException extends GuacamoleResourceClosedException implements Translatable { + + /** + * A translatable, human-readable description of the exception that + * occurred. + */ + private final TranslatableMessage translatableMessage; + + /** + * Creates a new TranslatableGuacamoleResourceClosedException with the given + * message and cause. The message must be provided in both non-translatable + * (readable as-written) and translatable forms. + * + * @param message + * A human-readable description of the exception that occurred. This + * message should be readable on its own and as-written, without + * requiring a translation service. + * + * @param translatableMessage + * A translatable, human-readable description of the exception that + * occurred. + * + * @param cause + * The cause of this exception. + */ + public TranslatableGuacamoleResourceClosedException(String message, TranslatableMessage translatableMessage, Throwable cause) { + super(message, cause); + this.translatableMessage = translatableMessage; + } + + /** + * Creates a new TranslatableGuacamoleResourceClosedException with the given + * message. The message must be provided in both non-translatable (readable + * as-written) and translatable forms. + * + * @param message + * A human-readable description of the exception that occurred. This + * message should be readable on its own and as-written, without + * requiring a translation service. + * + * @param translatableMessage + * A translatable, human-readable description of the exception that + * occurred. + */ + public TranslatableGuacamoleResourceClosedException(String message, TranslatableMessage translatableMessage) { + super(message); + this.translatableMessage = translatableMessage; + } + + /** + * Creates a new TranslatableGuacamoleResourceClosedException with the given + * message and cause. The message must be provided in both non-translatable + * (readable as-written) and translatable forms. + * + * @param message + * A human-readable description of the exception that occurred. This + * message should be readable on its own and as-written, without + * requiring a translation service. + * + * @param key + * The arbitrary key which can be used to look up the message to be + * displayed in the user's native language. + * + * @param cause + * The cause of this exception. + */ + public TranslatableGuacamoleResourceClosedException(String message, String key, Throwable cause) { + this(message, new TranslatableMessage(key), cause); + } + + /** + * Creates a new TranslatableGuacamoleResourceClosedException with the given + * message. The message must be provided in both non-translatable (readable + * as-written) and translatable forms. + * + * @param message + * A human-readable description of the exception that occurred. This + * message should be readable on its own and as-written, without + * requiring a translation service. + * + * @param key + * The arbitrary key which can be used to look up the message to be + * displayed in the user's native language. + */ + public TranslatableGuacamoleResourceClosedException(String message, String key) { + this(message, new TranslatableMessage(key)); + } + + @Override + public TranslatableMessage getTranslatableMessage() { + return translatableMessage; + } + +} diff --git a/guacamole-ext/src/main/java/org/apache/guacamole/language/TranslatableGuacamoleResourceConflictException.java b/guacamole-ext/src/main/java/org/apache/guacamole/language/TranslatableGuacamoleResourceConflictException.java new file mode 100644 index 000000000..e73020638 --- /dev/null +++ b/guacamole-ext/src/main/java/org/apache/guacamole/language/TranslatableGuacamoleResourceConflictException.java @@ -0,0 +1,122 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.guacamole.language; + +import org.apache.guacamole.GuacamoleResourceConflictException; + +/** + * A {@link GuacamoleResourceConflictException} whose associated message is + * translatable and can be passed through an arbitrary translation service, + * producing a human-readable message in the user's native language. + */ +public class TranslatableGuacamoleResourceConflictException extends GuacamoleResourceConflictException implements Translatable { + + /** + * A translatable, human-readable description of the exception that + * occurred. + */ + private final TranslatableMessage translatableMessage; + + /** + * Creates a new TranslatableGuacamoleResourceConflictException with the + * given message and cause. The message must be provided in both + * non-translatable (readable as-written) and translatable forms. + * + * @param message + * A human-readable description of the exception that occurred. This + * message should be readable on its own and as-written, without + * requiring a translation service. + * + * @param translatableMessage + * A translatable, human-readable description of the exception that + * occurred. + * + * @param cause + * The cause of this exception. + */ + public TranslatableGuacamoleResourceConflictException(String message, TranslatableMessage translatableMessage, Throwable cause) { + super(message, cause); + this.translatableMessage = translatableMessage; + } + + /** + * Creates a new TranslatableGuacamoleResourceConflictException with the + * given message. The message must be provided in both non-translatable + * (readable as-written) and translatable forms. + * + * @param message + * A human-readable description of the exception that occurred. This + * message should be readable on its own and as-written, without + * requiring a translation service. + * + * @param translatableMessage + * A translatable, human-readable description of the exception that + * occurred. + */ + public TranslatableGuacamoleResourceConflictException(String message, TranslatableMessage translatableMessage) { + super(message); + this.translatableMessage = translatableMessage; + } + + /** + * Creates a new TranslatableGuacamoleResourceConflictException with the + * given message and cause. The message must be provided in both + * non-translatable (readable as-written) and translatable forms. + * + * @param message + * A human-readable description of the exception that occurred. This + * message should be readable on its own and as-written, without + * requiring a translation service. + * + * @param key + * The arbitrary key which can be used to look up the message to be + * displayed in the user's native language. + * + * @param cause + * The cause of this exception. + */ + public TranslatableGuacamoleResourceConflictException(String message, String key, Throwable cause) { + this(message, new TranslatableMessage(key), cause); + } + + /** + * Creates a new TranslatableGuacamoleResourceConflictException with the + * given message. The message must be provided in both non-translatable + * (readable as-written) and translatable forms. + * + * @param message + * A human-readable description of the exception that occurred. This + * message should be readable on its own and as-written, without + * requiring a translation service. + * + * @param key + * The arbitrary key which can be used to look up the message to be + * displayed in the user's native language. + */ + public TranslatableGuacamoleResourceConflictException(String message, String key) { + this(message, new TranslatableMessage(key)); + } + + @Override + public TranslatableMessage getTranslatableMessage() { + return translatableMessage; + } + +} diff --git a/guacamole-ext/src/main/java/org/apache/guacamole/language/TranslatableGuacamoleResourceNotFoundException.java b/guacamole-ext/src/main/java/org/apache/guacamole/language/TranslatableGuacamoleResourceNotFoundException.java new file mode 100644 index 000000000..138da0e15 --- /dev/null +++ b/guacamole-ext/src/main/java/org/apache/guacamole/language/TranslatableGuacamoleResourceNotFoundException.java @@ -0,0 +1,122 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.guacamole.language; + +import org.apache.guacamole.GuacamoleResourceNotFoundException; + +/** + * A {@link GuacamoleResourceNotFoundException} whose associated message is + * translatable and can be passed through an arbitrary translation service, + * producing a human-readable message in the user's native language. + */ +public class TranslatableGuacamoleResourceNotFoundException extends GuacamoleResourceNotFoundException implements Translatable { + + /** + * A translatable, human-readable description of the exception that + * occurred. + */ + private final TranslatableMessage translatableMessage; + + /** + * Creates a new TranslatableGuacamoleResourceNotFoundException with the + * given message and cause. The message must be provided in both + * non-translatable (readable as-written) and translatable forms. + * + * @param message + * A human-readable description of the exception that occurred. This + * message should be readable on its own and as-written, without + * requiring a translation service. + * + * @param translatableMessage + * A translatable, human-readable description of the exception that + * occurred. + * + * @param cause + * The cause of this exception. + */ + public TranslatableGuacamoleResourceNotFoundException(String message, TranslatableMessage translatableMessage, Throwable cause) { + super(message, cause); + this.translatableMessage = translatableMessage; + } + + /** + * Creates a new TranslatableGuacamoleResourceNotFoundException with the + * given message. The message must be provided in both non-translatable + * (readable as-written) and translatable forms. + * + * @param message + * A human-readable description of the exception that occurred. This + * message should be readable on its own and as-written, without + * requiring a translation service. + * + * @param translatableMessage + * A translatable, human-readable description of the exception that + * occurred. + */ + public TranslatableGuacamoleResourceNotFoundException(String message, TranslatableMessage translatableMessage) { + super(message); + this.translatableMessage = translatableMessage; + } + + /** + * Creates a new TranslatableGuacamoleResourceNotFoundException with the + * given message and cause. The message must be provided in both + * non-translatable (readable as-written) and translatable forms. + * + * @param message + * A human-readable description of the exception that occurred. This + * message should be readable on its own and as-written, without + * requiring a translation service. + * + * @param key + * The arbitrary key which can be used to look up the message to be + * displayed in the user's native language. + * + * @param cause + * The cause of this exception. + */ + public TranslatableGuacamoleResourceNotFoundException(String message, String key, Throwable cause) { + this(message, new TranslatableMessage(key), cause); + } + + /** + * Creates a new TranslatableGuacamoleResourceNotFoundException with the + * given message. The message must be provided in both non-translatable + * (readable as-written) and translatable forms. + * + * @param message + * A human-readable description of the exception that occurred. This + * message should be readable on its own and as-written, without + * requiring a translation service. + * + * @param key + * The arbitrary key which can be used to look up the message to be + * displayed in the user's native language. + */ + public TranslatableGuacamoleResourceNotFoundException(String message, String key) { + this(message, new TranslatableMessage(key)); + } + + @Override + public TranslatableMessage getTranslatableMessage() { + return translatableMessage; + } + +} diff --git a/guacamole-ext/src/main/java/org/apache/guacamole/language/TranslatableGuacamoleSecurityException.java b/guacamole-ext/src/main/java/org/apache/guacamole/language/TranslatableGuacamoleSecurityException.java new file mode 100644 index 000000000..e6a9ecd15 --- /dev/null +++ b/guacamole-ext/src/main/java/org/apache/guacamole/language/TranslatableGuacamoleSecurityException.java @@ -0,0 +1,122 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.guacamole.language; + +import org.apache.guacamole.GuacamoleSecurityException; + +/** + * A {@link GuacamoleSecurityException} whose associated message is translatable + * and can be passed through an arbitrary translation service, producing a + * human-readable message in the user's native language. + */ +public class TranslatableGuacamoleSecurityException extends GuacamoleSecurityException implements Translatable { + + /** + * A translatable, human-readable description of the exception that + * occurred. + */ + private final TranslatableMessage translatableMessage; + + /** + * Creates a new TranslatableGuacamoleSecurityException with the given + * message and cause. The message must be provided in both non-translatable + * (readable as-written) and translatable forms. + * + * @param message + * A human-readable description of the exception that occurred. This + * message should be readable on its own and as-written, without + * requiring a translation service. + * + * @param translatableMessage + * A translatable, human-readable description of the exception that + * occurred. + * + * @param cause + * The cause of this exception. + */ + public TranslatableGuacamoleSecurityException(String message, TranslatableMessage translatableMessage, Throwable cause) { + super(message, cause); + this.translatableMessage = translatableMessage; + } + + /** + * Creates a new TranslatableGuacamoleSecurityException with the given + * message. The message must be provided in both non-translatable (readable + * as-written) and translatable forms. + * + * @param message + * A human-readable description of the exception that occurred. This + * message should be readable on its own and as-written, without + * requiring a translation service. + * + * @param translatableMessage + * A translatable, human-readable description of the exception that + * occurred. + */ + public TranslatableGuacamoleSecurityException(String message, TranslatableMessage translatableMessage) { + super(message); + this.translatableMessage = translatableMessage; + } + + /** + * Creates a new TranslatableGuacamoleSecurityException with the given + * message and cause. The message must be provided in both non-translatable + * (readable as-written) and translatable forms. + * + * @param message + * A human-readable description of the exception that occurred. This + * message should be readable on its own and as-written, without + * requiring a translation service. + * + * @param key + * The arbitrary key which can be used to look up the message to be + * displayed in the user's native language. + * + * @param cause + * The cause of this exception. + */ + public TranslatableGuacamoleSecurityException(String message, String key, Throwable cause) { + this(message, new TranslatableMessage(key), cause); + } + + /** + * Creates a new TranslatableGuacamoleSecurityException with the given + * message. The message must be provided in both non-translatable (readable + * as-written) and translatable forms. + * + * @param message + * A human-readable description of the exception that occurred. This + * message should be readable on its own and as-written, without + * requiring a translation service. + * + * @param key + * The arbitrary key which can be used to look up the message to be + * displayed in the user's native language. + */ + public TranslatableGuacamoleSecurityException(String message, String key) { + this(message, new TranslatableMessage(key)); + } + + @Override + public TranslatableMessage getTranslatableMessage() { + return translatableMessage; + } + +} diff --git a/guacamole-ext/src/main/java/org/apache/guacamole/language/TranslatableGuacamoleServerBusyException.java b/guacamole-ext/src/main/java/org/apache/guacamole/language/TranslatableGuacamoleServerBusyException.java new file mode 100644 index 000000000..7d735b4d2 --- /dev/null +++ b/guacamole-ext/src/main/java/org/apache/guacamole/language/TranslatableGuacamoleServerBusyException.java @@ -0,0 +1,122 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.guacamole.language; + +import org.apache.guacamole.GuacamoleServerBusyException; + +/** + * A {@link GuacamoleServerBusyException} whose associated message is + * translatable and can be passed through an arbitrary translation service, + * producing a human-readable message in the user's native language. + */ +public class TranslatableGuacamoleServerBusyException extends GuacamoleServerBusyException implements Translatable { + + /** + * A translatable, human-readable description of the exception that + * occurred. + */ + private final TranslatableMessage translatableMessage; + + /** + * Creates a new TranslatableGuacamoleServerBusyException with the given + * message and cause. The message must be provided in both non-translatable + * (readable as-written) and translatable forms. + * + * @param message + * A human-readable description of the exception that occurred. This + * message should be readable on its own and as-written, without + * requiring a translation service. + * + * @param translatableMessage + * A translatable, human-readable description of the exception that + * occurred. + * + * @param cause + * The cause of this exception. + */ + public TranslatableGuacamoleServerBusyException(String message, TranslatableMessage translatableMessage, Throwable cause) { + super(message, cause); + this.translatableMessage = translatableMessage; + } + + /** + * Creates a new TranslatableGuacamoleServerBusyException with the given + * message. The message must be provided in both non-translatable (readable + * as-written) and translatable forms. + * + * @param message + * A human-readable description of the exception that occurred. This + * message should be readable on its own and as-written, without + * requiring a translation service. + * + * @param translatableMessage + * A translatable, human-readable description of the exception that + * occurred. + */ + public TranslatableGuacamoleServerBusyException(String message, TranslatableMessage translatableMessage) { + super(message); + this.translatableMessage = translatableMessage; + } + + /** + * Creates a new TranslatableGuacamoleServerBusyException with the given + * message and cause. The message must be provided in both non-translatable + * (readable as-written) and translatable forms. + * + * @param message + * A human-readable description of the exception that occurred. This + * message should be readable on its own and as-written, without + * requiring a translation service. + * + * @param key + * The arbitrary key which can be used to look up the message to be + * displayed in the user's native language. + * + * @param cause + * The cause of this exception. + */ + public TranslatableGuacamoleServerBusyException(String message, String key, Throwable cause) { + this(message, new TranslatableMessage(key), cause); + } + + /** + * Creates a new TranslatableGuacamoleServerBusyException with the given + * message. The message must be provided in both non-translatable (readable + * as-written) and translatable forms. + * + * @param message + * A human-readable description of the exception that occurred. This + * message should be readable on its own and as-written, without + * requiring a translation service. + * + * @param key + * The arbitrary key which can be used to look up the message to be + * displayed in the user's native language. + */ + public TranslatableGuacamoleServerBusyException(String message, String key) { + this(message, new TranslatableMessage(key)); + } + + @Override + public TranslatableMessage getTranslatableMessage() { + return translatableMessage; + } + +} diff --git a/guacamole-ext/src/main/java/org/apache/guacamole/language/TranslatableGuacamoleServerException.java b/guacamole-ext/src/main/java/org/apache/guacamole/language/TranslatableGuacamoleServerException.java new file mode 100644 index 000000000..686498c55 --- /dev/null +++ b/guacamole-ext/src/main/java/org/apache/guacamole/language/TranslatableGuacamoleServerException.java @@ -0,0 +1,122 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.guacamole.language; + +import org.apache.guacamole.GuacamoleServerException; + +/** + * A {@link GuacamoleServerException} whose associated message is translatable + * and can be passed through an arbitrary translation service, producing a + * human-readable message in the user's native language. + */ +public class TranslatableGuacamoleServerException extends GuacamoleServerException implements Translatable { + + /** + * A translatable, human-readable description of the exception that + * occurred. + */ + private final TranslatableMessage translatableMessage; + + /** + * Creates a new TranslatableGuacamoleServerException with the given + * message and cause. The message must be provided in both non-translatable + * (readable as-written) and translatable forms. + * + * @param message + * A human-readable description of the exception that occurred. This + * message should be readable on its own and as-written, without + * requiring a translation service. + * + * @param translatableMessage + * A translatable, human-readable description of the exception that + * occurred. + * + * @param cause + * The cause of this exception. + */ + public TranslatableGuacamoleServerException(String message, TranslatableMessage translatableMessage, Throwable cause) { + super(message, cause); + this.translatableMessage = translatableMessage; + } + + /** + * Creates a new TranslatableGuacamoleServerException with the given + * message. The message must be provided in both non-translatable (readable + * as-written) and translatable forms. + * + * @param message + * A human-readable description of the exception that occurred. This + * message should be readable on its own and as-written, without + * requiring a translation service. + * + * @param translatableMessage + * A translatable, human-readable description of the exception that + * occurred. + */ + public TranslatableGuacamoleServerException(String message, TranslatableMessage translatableMessage) { + super(message); + this.translatableMessage = translatableMessage; + } + + /** + * Creates a new TranslatableGuacamoleServerException with the given + * message and cause. The message must be provided in both non-translatable + * (readable as-written) and translatable forms. + * + * @param message + * A human-readable description of the exception that occurred. This + * message should be readable on its own and as-written, without + * requiring a translation service. + * + * @param key + * The arbitrary key which can be used to look up the message to be + * displayed in the user's native language. + * + * @param cause + * The cause of this exception. + */ + public TranslatableGuacamoleServerException(String message, String key, Throwable cause) { + this(message, new TranslatableMessage(key), cause); + } + + /** + * Creates a new TranslatableGuacamoleServerException with the given + * message. The message must be provided in both non-translatable (readable + * as-written) and translatable forms. + * + * @param message + * A human-readable description of the exception that occurred. This + * message should be readable on its own and as-written, without + * requiring a translation service. + * + * @param key + * The arbitrary key which can be used to look up the message to be + * displayed in the user's native language. + */ + public TranslatableGuacamoleServerException(String message, String key) { + this(message, new TranslatableMessage(key)); + } + + @Override + public TranslatableMessage getTranslatableMessage() { + return translatableMessage; + } + +} diff --git a/guacamole-ext/src/main/java/org/apache/guacamole/language/TranslatableGuacamoleSessionClosedException.java b/guacamole-ext/src/main/java/org/apache/guacamole/language/TranslatableGuacamoleSessionClosedException.java new file mode 100644 index 000000000..ca9a025af --- /dev/null +++ b/guacamole-ext/src/main/java/org/apache/guacamole/language/TranslatableGuacamoleSessionClosedException.java @@ -0,0 +1,122 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.guacamole.language; + +import org.apache.guacamole.GuacamoleSessionClosedException; + +/** + * A {@link GuacamoleSessionClosedException} whose associated message is + * translatable and can be passed through an arbitrary translation service, + * producing a human-readable message in the user's native language. + */ +public class TranslatableGuacamoleSessionClosedException extends GuacamoleSessionClosedException implements Translatable { + + /** + * A translatable, human-readable description of the exception that + * occurred. + */ + private final TranslatableMessage translatableMessage; + + /** + * Creates a new TranslatableGuacamoleSessionClosedException with the given + * message and cause. The message must be provided in both non-translatable + * (readable as-written) and translatable forms. + * + * @param message + * A human-readable description of the exception that occurred. This + * message should be readable on its own and as-written, without + * requiring a translation service. + * + * @param translatableMessage + * A translatable, human-readable description of the exception that + * occurred. + * + * @param cause + * The cause of this exception. + */ + public TranslatableGuacamoleSessionClosedException(String message, TranslatableMessage translatableMessage, Throwable cause) { + super(message, cause); + this.translatableMessage = translatableMessage; + } + + /** + * Creates a new TranslatableGuacamoleSessionClosedException with the given + * message. The message must be provided in both non-translatable (readable + * as-written) and translatable forms. + * + * @param message + * A human-readable description of the exception that occurred. This + * message should be readable on its own and as-written, without + * requiring a translation service. + * + * @param translatableMessage + * A translatable, human-readable description of the exception that + * occurred. + */ + public TranslatableGuacamoleSessionClosedException(String message, TranslatableMessage translatableMessage) { + super(message); + this.translatableMessage = translatableMessage; + } + + /** + * Creates a new TranslatableGuacamoleSessionClosedException with the given + * message and cause. The message must be provided in both non-translatable + * (readable as-written) and translatable forms. + * + * @param message + * A human-readable description of the exception that occurred. This + * message should be readable on its own and as-written, without + * requiring a translation service. + * + * @param key + * The arbitrary key which can be used to look up the message to be + * displayed in the user's native language. + * + * @param cause + * The cause of this exception. + */ + public TranslatableGuacamoleSessionClosedException(String message, String key, Throwable cause) { + this(message, new TranslatableMessage(key), cause); + } + + /** + * Creates a new TranslatableGuacamoleSessionClosedException with the given + * message. The message must be provided in both non-translatable (readable + * as-written) and translatable forms. + * + * @param message + * A human-readable description of the exception that occurred. This + * message should be readable on its own and as-written, without + * requiring a translation service. + * + * @param key + * The arbitrary key which can be used to look up the message to be + * displayed in the user's native language. + */ + public TranslatableGuacamoleSessionClosedException(String message, String key) { + this(message, new TranslatableMessage(key)); + } + + @Override + public TranslatableMessage getTranslatableMessage() { + return translatableMessage; + } + +} diff --git a/guacamole-ext/src/main/java/org/apache/guacamole/language/TranslatableGuacamoleSessionConflictException.java b/guacamole-ext/src/main/java/org/apache/guacamole/language/TranslatableGuacamoleSessionConflictException.java new file mode 100644 index 000000000..b20575b51 --- /dev/null +++ b/guacamole-ext/src/main/java/org/apache/guacamole/language/TranslatableGuacamoleSessionConflictException.java @@ -0,0 +1,122 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.guacamole.language; + +import org.apache.guacamole.GuacamoleSessionConflictException; + +/** + * A {@link GuacamoleSessionConflictException} whose associated message is + * translatable and can be passed through an arbitrary translation service, + * producing a human-readable message in the user's native language. + */ +public class TranslatableGuacamoleSessionConflictException extends GuacamoleSessionConflictException implements Translatable { + + /** + * A translatable, human-readable description of the exception that + * occurred. + */ + private final TranslatableMessage translatableMessage; + + /** + * Creates a new TranslatableGuacamoleSessionConflictException with the + * given message and cause. The message must be provided in both + * non-translatable (readable as-written) and translatable forms. + * + * @param message + * A human-readable description of the exception that occurred. This + * message should be readable on its own and as-written, without + * requiring a translation service. + * + * @param translatableMessage + * A translatable, human-readable description of the exception that + * occurred. + * + * @param cause + * The cause of this exception. + */ + public TranslatableGuacamoleSessionConflictException(String message, TranslatableMessage translatableMessage, Throwable cause) { + super(message, cause); + this.translatableMessage = translatableMessage; + } + + /** + * Creates a new TranslatableGuacamoleSessionConflictException with the + * given message. The message must be provided in both non-translatable + * (readable as-written) and translatable forms. + * + * @param message + * A human-readable description of the exception that occurred. This + * message should be readable on its own and as-written, without + * requiring a translation service. + * + * @param translatableMessage + * A translatable, human-readable description of the exception that + * occurred. + */ + public TranslatableGuacamoleSessionConflictException(String message, TranslatableMessage translatableMessage) { + super(message); + this.translatableMessage = translatableMessage; + } + + /** + * Creates a new TranslatableGuacamoleSessionConflictException with the + * given message and cause. The message must be provided in both + * non-translatable (readable as-written) and translatable forms. + * + * @param message + * A human-readable description of the exception that occurred. This + * message should be readable on its own and as-written, without + * requiring a translation service. + * + * @param key + * The arbitrary key which can be used to look up the message to be + * displayed in the user's native language. + * + * @param cause + * The cause of this exception. + */ + public TranslatableGuacamoleSessionConflictException(String message, String key, Throwable cause) { + this(message, new TranslatableMessage(key), cause); + } + + /** + * Creates a new TranslatableGuacamoleSessionConflictException with the + * given message. The message must be provided in both non-translatable + * (readable as-written) and translatable forms. + * + * @param message + * A human-readable description of the exception that occurred. This + * message should be readable on its own and as-written, without + * requiring a translation service. + * + * @param key + * The arbitrary key which can be used to look up the message to be + * displayed in the user's native language. + */ + public TranslatableGuacamoleSessionConflictException(String message, String key) { + this(message, new TranslatableMessage(key)); + } + + @Override + public TranslatableMessage getTranslatableMessage() { + return translatableMessage; + } + +} diff --git a/guacamole-ext/src/main/java/org/apache/guacamole/language/TranslatableGuacamoleSessionTimeoutException.java b/guacamole-ext/src/main/java/org/apache/guacamole/language/TranslatableGuacamoleSessionTimeoutException.java new file mode 100644 index 000000000..700a3ee16 --- /dev/null +++ b/guacamole-ext/src/main/java/org/apache/guacamole/language/TranslatableGuacamoleSessionTimeoutException.java @@ -0,0 +1,122 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.guacamole.language; + +import org.apache.guacamole.GuacamoleSessionTimeoutException; + +/** + * A {@link GuacamoleSessionTimeoutException} whose associated message is + * translatable and can be passed through an arbitrary translation service, + * producing a human-readable message in the user's native language. + */ +public class TranslatableGuacamoleSessionTimeoutException extends GuacamoleSessionTimeoutException implements Translatable { + + /** + * A translatable, human-readable description of the exception that + * occurred. + */ + private final TranslatableMessage translatableMessage; + + /** + * Creates a new TranslatableGuacamoleSessionTimeoutException with the given + * message and cause. The message must be provided in both non-translatable + * (readable as-written) and translatable forms. + * + * @param message + * A human-readable description of the exception that occurred. This + * message should be readable on its own and as-written, without + * requiring a translation service. + * + * @param translatableMessage + * A translatable, human-readable description of the exception that + * occurred. + * + * @param cause + * The cause of this exception. + */ + public TranslatableGuacamoleSessionTimeoutException(String message, TranslatableMessage translatableMessage, Throwable cause) { + super(message, cause); + this.translatableMessage = translatableMessage; + } + + /** + * Creates a new TranslatableGuacamoleSessionTimeoutException with the given + * message. The message must be provided in both non-translatable (readable + * as-written) and translatable forms. + * + * @param message + * A human-readable description of the exception that occurred. This + * message should be readable on its own and as-written, without + * requiring a translation service. + * + * @param translatableMessage + * A translatable, human-readable description of the exception that + * occurred. + */ + public TranslatableGuacamoleSessionTimeoutException(String message, TranslatableMessage translatableMessage) { + super(message); + this.translatableMessage = translatableMessage; + } + + /** + * Creates a new TranslatableGuacamoleSessionTimeoutException with the given + * message and cause. The message must be provided in both non-translatable + * (readable as-written) and translatable forms. + * + * @param message + * A human-readable description of the exception that occurred. This + * message should be readable on its own and as-written, without + * requiring a translation service. + * + * @param key + * The arbitrary key which can be used to look up the message to be + * displayed in the user's native language. + * + * @param cause + * The cause of this exception. + */ + public TranslatableGuacamoleSessionTimeoutException(String message, String key, Throwable cause) { + this(message, new TranslatableMessage(key), cause); + } + + /** + * Creates a new TranslatableGuacamoleSessionTimeoutException with the given + * message. The message must be provided in both non-translatable (readable + * as-written) and translatable forms. + * + * @param message + * A human-readable description of the exception that occurred. This + * message should be readable on its own and as-written, without + * requiring a translation service. + * + * @param key + * The arbitrary key which can be used to look up the message to be + * displayed in the user's native language. + */ + public TranslatableGuacamoleSessionTimeoutException(String message, String key) { + this(message, new TranslatableMessage(key)); + } + + @Override + public TranslatableMessage getTranslatableMessage() { + return translatableMessage; + } + +} diff --git a/guacamole-ext/src/main/java/org/apache/guacamole/language/TranslatableGuacamoleUnauthorizedException.java b/guacamole-ext/src/main/java/org/apache/guacamole/language/TranslatableGuacamoleUnauthorizedException.java new file mode 100644 index 000000000..340acedb7 --- /dev/null +++ b/guacamole-ext/src/main/java/org/apache/guacamole/language/TranslatableGuacamoleUnauthorizedException.java @@ -0,0 +1,122 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.guacamole.language; + +import org.apache.guacamole.GuacamoleUnauthorizedException; + +/** + * A {@link GuacamoleUnauthorizedException} whose associated message is + * translatable and can be passed through an arbitrary translation service, + * producing a human-readable message in the user's native language. + */ +public class TranslatableGuacamoleUnauthorizedException extends GuacamoleUnauthorizedException implements Translatable { + + /** + * A translatable, human-readable description of the exception that + * occurred. + */ + private final TranslatableMessage translatableMessage; + + /** + * Creates a new TranslatableGuacamoleUnauthorizedException with the given + * message and cause. The message must be provided in both non-translatable + * (readable as-written) and translatable forms. + * + * @param message + * A human-readable description of the exception that occurred. This + * message should be readable on its own and as-written, without + * requiring a translation service. + * + * @param translatableMessage + * A translatable, human-readable description of the exception that + * occurred. + * + * @param cause + * The cause of this exception. + */ + public TranslatableGuacamoleUnauthorizedException(String message, TranslatableMessage translatableMessage, Throwable cause) { + super(message, cause); + this.translatableMessage = translatableMessage; + } + + /** + * Creates a new TranslatableGuacamoleUnauthorizedException with the given + * message. The message must be provided in both non-translatable (readable + * as-written) and translatable forms. + * + * @param message + * A human-readable description of the exception that occurred. This + * message should be readable on its own and as-written, without + * requiring a translation service. + * + * @param translatableMessage + * A translatable, human-readable description of the exception that + * occurred. + */ + public TranslatableGuacamoleUnauthorizedException(String message, TranslatableMessage translatableMessage) { + super(message); + this.translatableMessage = translatableMessage; + } + + /** + * Creates a new TranslatableGuacamoleUnauthorizedException with the given + * message and cause. The message must be provided in both non-translatable + * (readable as-written) and translatable forms. + * + * @param message + * A human-readable description of the exception that occurred. This + * message should be readable on its own and as-written, without + * requiring a translation service. + * + * @param key + * The arbitrary key which can be used to look up the message to be + * displayed in the user's native language. + * + * @param cause + * The cause of this exception. + */ + public TranslatableGuacamoleUnauthorizedException(String message, String key, Throwable cause) { + this(message, new TranslatableMessage(key), cause); + } + + /** + * Creates a new TranslatableGuacamoleUnauthorizedException with the given + * message. The message must be provided in both non-translatable (readable + * as-written) and translatable forms. + * + * @param message + * A human-readable description of the exception that occurred. This + * message should be readable on its own and as-written, without + * requiring a translation service. + * + * @param key + * The arbitrary key which can be used to look up the message to be + * displayed in the user's native language. + */ + public TranslatableGuacamoleUnauthorizedException(String message, String key) { + this(message, new TranslatableMessage(key)); + } + + @Override + public TranslatableMessage getTranslatableMessage() { + return translatableMessage; + } + +} diff --git a/guacamole-ext/src/main/java/org/apache/guacamole/language/TranslatableGuacamoleUnsupportedException.java b/guacamole-ext/src/main/java/org/apache/guacamole/language/TranslatableGuacamoleUnsupportedException.java new file mode 100644 index 000000000..184f65a69 --- /dev/null +++ b/guacamole-ext/src/main/java/org/apache/guacamole/language/TranslatableGuacamoleUnsupportedException.java @@ -0,0 +1,122 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.guacamole.language; + +import org.apache.guacamole.GuacamoleUnsupportedException; + +/** + * A {@link GuacamoleUnsupportedException} whose associated message is + * translatable and can be passed through an arbitrary translation service, + * producing a human-readable message in the user's native language. + */ +public class TranslatableGuacamoleUnsupportedException extends GuacamoleUnsupportedException implements Translatable { + + /** + * A translatable, human-readable description of the exception that + * occurred. + */ + private final TranslatableMessage translatableMessage; + + /** + * Creates a new TranslatableGuacamoleUnsupportedException with the given + * message and cause. The message must be provided in both non-translatable + * (readable as-written) and translatable forms. + * + * @param message + * A human-readable description of the exception that occurred. This + * message should be readable on its own and as-written, without + * requiring a translation service. + * + * @param translatableMessage + * A translatable, human-readable description of the exception that + * occurred. + * + * @param cause + * The cause of this exception. + */ + public TranslatableGuacamoleUnsupportedException(String message, TranslatableMessage translatableMessage, Throwable cause) { + super(message, cause); + this.translatableMessage = translatableMessage; + } + + /** + * Creates a new TranslatableGuacamoleUnsupportedException with the given + * message. The message must be provided in both non-translatable (readable + * as-written) and translatable forms. + * + * @param message + * A human-readable description of the exception that occurred. This + * message should be readable on its own and as-written, without + * requiring a translation service. + * + * @param translatableMessage + * A translatable, human-readable description of the exception that + * occurred. + */ + public TranslatableGuacamoleUnsupportedException(String message, TranslatableMessage translatableMessage) { + super(message); + this.translatableMessage = translatableMessage; + } + + /** + * Creates a new TranslatableGuacamoleUnsupportedException with the given + * message and cause. The message must be provided in both non-translatable + * (readable as-written) and translatable forms. + * + * @param message + * A human-readable description of the exception that occurred. This + * message should be readable on its own and as-written, without + * requiring a translation service. + * + * @param key + * The arbitrary key which can be used to look up the message to be + * displayed in the user's native language. + * + * @param cause + * The cause of this exception. + */ + public TranslatableGuacamoleUnsupportedException(String message, String key, Throwable cause) { + this(message, new TranslatableMessage(key), cause); + } + + /** + * Creates a new TranslatableGuacamoleUnsupportedException with the given + * message. The message must be provided in both non-translatable (readable + * as-written) and translatable forms. + * + * @param message + * A human-readable description of the exception that occurred. This + * message should be readable on its own and as-written, without + * requiring a translation service. + * + * @param key + * The arbitrary key which can be used to look up the message to be + * displayed in the user's native language. + */ + public TranslatableGuacamoleUnsupportedException(String message, String key) { + this(message, new TranslatableMessage(key)); + } + + @Override + public TranslatableMessage getTranslatableMessage() { + return translatableMessage; + } + +} diff --git a/guacamole-ext/src/main/java/org/apache/guacamole/language/TranslatableGuacamoleUpstreamException.java b/guacamole-ext/src/main/java/org/apache/guacamole/language/TranslatableGuacamoleUpstreamException.java new file mode 100644 index 000000000..0122acbf4 --- /dev/null +++ b/guacamole-ext/src/main/java/org/apache/guacamole/language/TranslatableGuacamoleUpstreamException.java @@ -0,0 +1,122 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.guacamole.language; + +import org.apache.guacamole.GuacamoleUpstreamException; + +/** + * A {@link GuacamoleUpstreamException} whose associated message is translatable + * and can be passed through an arbitrary translation service, producing a + * human-readable message in the user's native language. + */ +public class TranslatableGuacamoleUpstreamException extends GuacamoleUpstreamException implements Translatable { + + /** + * A translatable, human-readable description of the exception that + * occurred. + */ + private final TranslatableMessage translatableMessage; + + /** + * Creates a new TranslatableGuacamoleUpstreamException with the given + * message and cause. The message must be provided in both non-translatable + * (readable as-written) and translatable forms. + * + * @param message + * A human-readable description of the exception that occurred. This + * message should be readable on its own and as-written, without + * requiring a translation service. + * + * @param translatableMessage + * A translatable, human-readable description of the exception that + * occurred. + * + * @param cause + * The cause of this exception. + */ + public TranslatableGuacamoleUpstreamException(String message, TranslatableMessage translatableMessage, Throwable cause) { + super(message, cause); + this.translatableMessage = translatableMessage; + } + + /** + * Creates a new TranslatableGuacamoleUpstreamException with the given + * message. The message must be provided in both non-translatable (readable + * as-written) and translatable forms. + * + * @param message + * A human-readable description of the exception that occurred. This + * message should be readable on its own and as-written, without + * requiring a translation service. + * + * @param translatableMessage + * A translatable, human-readable description of the exception that + * occurred. + */ + public TranslatableGuacamoleUpstreamException(String message, TranslatableMessage translatableMessage) { + super(message); + this.translatableMessage = translatableMessage; + } + + /** + * Creates a new TranslatableGuacamoleUpstreamException with the given + * message and cause. The message must be provided in both non-translatable + * (readable as-written) and translatable forms. + * + * @param message + * A human-readable description of the exception that occurred. This + * message should be readable on its own and as-written, without + * requiring a translation service. + * + * @param key + * The arbitrary key which can be used to look up the message to be + * displayed in the user's native language. + * + * @param cause + * The cause of this exception. + */ + public TranslatableGuacamoleUpstreamException(String message, String key, Throwable cause) { + this(message, new TranslatableMessage(key), cause); + } + + /** + * Creates a new TranslatableGuacamoleUpstreamException with the given + * message. The message must be provided in both non-translatable (readable + * as-written) and translatable forms. + * + * @param message + * A human-readable description of the exception that occurred. This + * message should be readable on its own and as-written, without + * requiring a translation service. + * + * @param key + * The arbitrary key which can be used to look up the message to be + * displayed in the user's native language. + */ + public TranslatableGuacamoleUpstreamException(String message, String key) { + this(message, new TranslatableMessage(key)); + } + + @Override + public TranslatableMessage getTranslatableMessage() { + return translatableMessage; + } + +} diff --git a/guacamole-ext/src/main/java/org/apache/guacamole/language/TranslatableGuacamoleUpstreamNotFoundException.java b/guacamole-ext/src/main/java/org/apache/guacamole/language/TranslatableGuacamoleUpstreamNotFoundException.java new file mode 100644 index 000000000..e9b32143d --- /dev/null +++ b/guacamole-ext/src/main/java/org/apache/guacamole/language/TranslatableGuacamoleUpstreamNotFoundException.java @@ -0,0 +1,122 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.guacamole.language; + +import org.apache.guacamole.GuacamoleUpstreamNotFoundException; + +/** + * A {@link GuacamoleUpstreamNotFoundException} whose associated message is + * translatable and can be passed through an arbitrary translation service, + * producing a human-readable message in the user's native language. + */ +public class TranslatableGuacamoleUpstreamNotFoundException extends GuacamoleUpstreamNotFoundException implements Translatable { + + /** + * A translatable, human-readable description of the exception that + * occurred. + */ + private final TranslatableMessage translatableMessage; + + /** + * Creates a new TranslatableGuacamoleUpstreamNotFoundException with the + * given message and cause. The message must be provided in both + * non-translatable (readable as-written) and translatable forms. + * + * @param message + * A human-readable description of the exception that occurred. This + * message should be readable on its own and as-written, without + * requiring a translation service. + * + * @param translatableMessage + * A translatable, human-readable description of the exception that + * occurred. + * + * @param cause + * The cause of this exception. + */ + public TranslatableGuacamoleUpstreamNotFoundException(String message, TranslatableMessage translatableMessage, Throwable cause) { + super(message, cause); + this.translatableMessage = translatableMessage; + } + + /** + * Creates a new TranslatableGuacamoleUpstreamNotFoundException with the + * given message. The message must be provided in both non-translatable + * (readable as-written) and translatable forms. + * + * @param message + * A human-readable description of the exception that occurred. This + * message should be readable on its own and as-written, without + * requiring a translation service. + * + * @param translatableMessage + * A translatable, human-readable description of the exception that + * occurred. + */ + public TranslatableGuacamoleUpstreamNotFoundException(String message, TranslatableMessage translatableMessage) { + super(message); + this.translatableMessage = translatableMessage; + } + + /** + * Creates a new TranslatableGuacamoleUpstreamNotFoundException with the + * given message and cause. The message must be provided in both + * non-translatable (readable as-written) and translatable forms. + * + * @param message + * A human-readable description of the exception that occurred. This + * message should be readable on its own and as-written, without + * requiring a translation service. + * + * @param key + * The arbitrary key which can be used to look up the message to be + * displayed in the user's native language. + * + * @param cause + * The cause of this exception. + */ + public TranslatableGuacamoleUpstreamNotFoundException(String message, String key, Throwable cause) { + this(message, new TranslatableMessage(key), cause); + } + + /** + * Creates a new TranslatableGuacamoleUpstreamNotFoundException with the + * given message. The message must be provided in both non-translatable + * (readable as-written) and translatable forms. + * + * @param message + * A human-readable description of the exception that occurred. This + * message should be readable on its own and as-written, without + * requiring a translation service. + * + * @param key + * The arbitrary key which can be used to look up the message to be + * displayed in the user's native language. + */ + public TranslatableGuacamoleUpstreamNotFoundException(String message, String key) { + this(message, new TranslatableMessage(key)); + } + + @Override + public TranslatableMessage getTranslatableMessage() { + return translatableMessage; + } + +} diff --git a/guacamole-ext/src/main/java/org/apache/guacamole/language/TranslatableGuacamoleUpstreamTimeoutException.java b/guacamole-ext/src/main/java/org/apache/guacamole/language/TranslatableGuacamoleUpstreamTimeoutException.java new file mode 100644 index 000000000..9cac87c9f --- /dev/null +++ b/guacamole-ext/src/main/java/org/apache/guacamole/language/TranslatableGuacamoleUpstreamTimeoutException.java @@ -0,0 +1,122 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.guacamole.language; + +import org.apache.guacamole.GuacamoleUpstreamTimeoutException; + +/** + * A {@link GuacamoleUpstreamTimeoutException} whose associated message is + * translatable and can be passed through an arbitrary translation service, + * producing a human-readable message in the user's native language. + */ +public class TranslatableGuacamoleUpstreamTimeoutException extends GuacamoleUpstreamTimeoutException implements Translatable { + + /** + * A translatable, human-readable description of the exception that + * occurred. + */ + private final TranslatableMessage translatableMessage; + + /** + * Creates a new TranslatableGuacamoleUpstreamTimeoutException with the + * given message and cause. The message must be provided in both + * non-translatable (readable as-written) and translatable forms. + * + * @param message + * A human-readable description of the exception that occurred. This + * message should be readable on its own and as-written, without + * requiring a translation service. + * + * @param translatableMessage + * A translatable, human-readable description of the exception that + * occurred. + * + * @param cause + * The cause of this exception. + */ + public TranslatableGuacamoleUpstreamTimeoutException(String message, TranslatableMessage translatableMessage, Throwable cause) { + super(message, cause); + this.translatableMessage = translatableMessage; + } + + /** + * Creates a new TranslatableGuacamoleUpstreamTimeoutException with the + * given message. The message must be provided in both non-translatable + * (readable as-written) and translatable forms. + * + * @param message + * A human-readable description of the exception that occurred. This + * message should be readable on its own and as-written, without + * requiring a translation service. + * + * @param translatableMessage + * A translatable, human-readable description of the exception that + * occurred. + */ + public TranslatableGuacamoleUpstreamTimeoutException(String message, TranslatableMessage translatableMessage) { + super(message); + this.translatableMessage = translatableMessage; + } + + /** + * Creates a new TranslatableGuacamoleUpstreamTimeoutException with the + * given message and cause. The message must be provided in both + * non-translatable (readable as-written) and translatable forms. + * + * @param message + * A human-readable description of the exception that occurred. This + * message should be readable on its own and as-written, without + * requiring a translation service. + * + * @param key + * The arbitrary key which can be used to look up the message to be + * displayed in the user's native language. + * + * @param cause + * The cause of this exception. + */ + public TranslatableGuacamoleUpstreamTimeoutException(String message, String key, Throwable cause) { + this(message, new TranslatableMessage(key), cause); + } + + /** + * Creates a new TranslatableGuacamoleUpstreamTimeoutException with the + * given message. The message must be provided in both non-translatable + * (readable as-written) and translatable forms. + * + * @param message + * A human-readable description of the exception that occurred. This + * message should be readable on its own and as-written, without + * requiring a translation service. + * + * @param key + * The arbitrary key which can be used to look up the message to be + * displayed in the user's native language. + */ + public TranslatableGuacamoleUpstreamTimeoutException(String message, String key) { + this(message, new TranslatableMessage(key)); + } + + @Override + public TranslatableMessage getTranslatableMessage() { + return translatableMessage; + } + +} diff --git a/guacamole-ext/src/main/java/org/apache/guacamole/language/TranslatableGuacamoleUpstreamUnavailableException.java b/guacamole-ext/src/main/java/org/apache/guacamole/language/TranslatableGuacamoleUpstreamUnavailableException.java new file mode 100644 index 000000000..2962eb6f6 --- /dev/null +++ b/guacamole-ext/src/main/java/org/apache/guacamole/language/TranslatableGuacamoleUpstreamUnavailableException.java @@ -0,0 +1,122 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.guacamole.language; + +import org.apache.guacamole.GuacamoleUpstreamUnavailableException; + +/** + * A {@link GuacamoleUpstreamUnavailableException} whose associated message is + * translatable and can be passed through an arbitrary translation service, + * producing a human-readable message in the user's native language. + */ +public class TranslatableGuacamoleUpstreamUnavailableException extends GuacamoleUpstreamUnavailableException implements Translatable { + + /** + * A translatable, human-readable description of the exception that + * occurred. + */ + private final TranslatableMessage translatableMessage; + + /** + * Creates a new TranslatableGuacamoleUpstreamUnavailableException with the + * given message and cause. The message must be provided in both + * non-translatable (readable as-written) and translatable forms. + * + * @param message + * A human-readable description of the exception that occurred. This + * message should be readable on its own and as-written, without + * requiring a translation service. + * + * @param translatableMessage + * A translatable, human-readable description of the exception that + * occurred. + * + * @param cause + * The cause of this exception. + */ + public TranslatableGuacamoleUpstreamUnavailableException(String message, TranslatableMessage translatableMessage, Throwable cause) { + super(message, cause); + this.translatableMessage = translatableMessage; + } + + /** + * Creates a new TranslatableGuacamoleUpstreamUnavailableException with the + * given message. The message must be provided in both non-translatable + * (readable as-written) and translatable forms. + * + * @param message + * A human-readable description of the exception that occurred. This + * message should be readable on its own and as-written, without + * requiring a translation service. + * + * @param translatableMessage + * A translatable, human-readable description of the exception that + * occurred. + */ + public TranslatableGuacamoleUpstreamUnavailableException(String message, TranslatableMessage translatableMessage) { + super(message); + this.translatableMessage = translatableMessage; + } + + /** + * Creates a new TranslatableGuacamoleUpstreamUnavailableException with the + * given message and cause. The message must be provided in both + * non-translatable (readable as-written) and translatable forms. + * + * @param message + * A human-readable description of the exception that occurred. This + * message should be readable on its own and as-written, without + * requiring a translation service. + * + * @param key + * The arbitrary key which can be used to look up the message to be + * displayed in the user's native language. + * + * @param cause + * The cause of this exception. + */ + public TranslatableGuacamoleUpstreamUnavailableException(String message, String key, Throwable cause) { + this(message, new TranslatableMessage(key), cause); + } + + /** + * Creates a new TranslatableGuacamoleUpstreamUnavailableException with the + * given message. The message must be provided in both non-translatable + * (readable as-written) and translatable forms. + * + * @param message + * A human-readable description of the exception that occurred. This + * message should be readable on its own and as-written, without + * requiring a translation service. + * + * @param key + * The arbitrary key which can be used to look up the message to be + * displayed in the user's native language. + */ + public TranslatableGuacamoleUpstreamUnavailableException(String message, String key) { + this(message, new TranslatableMessage(key)); + } + + @Override + public TranslatableMessage getTranslatableMessage() { + return translatableMessage; + } + +}