GUAC-547: Implement exceptions for remaining status codes.

This commit is contained in:
Michael Jumper
2014-03-18 17:05:01 -07:00
parent 494e611008
commit 377d8b62d0
10 changed files with 716 additions and 0 deletions

View File

@@ -0,0 +1,71 @@
/*
* Copyright (C) 2013 Glyptodon LLC
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.glyptodon.guacamole;
import org.glyptodon.guacamole.protocol.GuacamoleStatus;
/**
* An exception which is thrown when data has been submitted with an unsupported
* mimetype.
*
* @author Michael Jumper
*/
public class GuacamoleClientBadTypeException extends GuacamoleClientException {
/**
* Creates a new GuacamoleClientBadTypeException with the given message and cause.
*
* @param message A human readable description of the exception that
* occurred.
* @param cause The cause of this exception.
*/
public GuacamoleClientBadTypeException(String message, Throwable cause) {
super(message, cause);
}
/**
* Creates a new GuacamoleClientBadTypeException with the given message.
*
* @param message A human readable description of the exception that
* occurred.
*/
public GuacamoleClientBadTypeException(String message) {
super(message);
}
/**
* Creates a new GuacamoleClientBadTypeException with the given cause.
*
* @param cause The cause of this exception.
*/
public GuacamoleClientBadTypeException(Throwable cause) {
super(cause);
}
@Override
public GuacamoleStatus getStatus() {
return GuacamoleStatus.CLIENT_BAD_TYPE;
}
}

View File

@@ -0,0 +1,73 @@
/*
* Copyright (C) 2013 Glyptodon LLC
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.glyptodon.guacamole;
import org.glyptodon.guacamole.protocol.GuacamoleStatus;
/**
* An exception which is thrown when the client has sent too much data. This
* usually indicates that a server-side buffer is not large enough to
* accommodate the data, or protocol specifications prohibit data of the size
* received.
*
* @author Michael Jumper
*/
public class GuacamoleClientOverrunException extends GuacamoleClientException {
/**
* Creates a new GuacamoleClientOverrunException with the given message and cause.
*
* @param message A human readable description of the exception that
* occurred.
* @param cause The cause of this exception.
*/
public GuacamoleClientOverrunException(String message, Throwable cause) {
super(message, cause);
}
/**
* Creates a new GuacamoleClientOverrunException with the given message.
*
* @param message A human readable description of the exception that
* occurred.
*/
public GuacamoleClientOverrunException(String message) {
super(message);
}
/**
* Creates a new GuacamoleClientOverrunException with the given cause.
*
* @param cause The cause of this exception.
*/
public GuacamoleClientOverrunException(Throwable cause) {
super(cause);
}
@Override
public GuacamoleStatus getStatus() {
return GuacamoleStatus.CLIENT_OVERRUN;
}
}

View File

@@ -0,0 +1,70 @@
/*
* Copyright (C) 2013 Glyptodon LLC
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.glyptodon.guacamole;
import org.glyptodon.guacamole.protocol.GuacamoleStatus;
/**
* An exception which is thrown when the client is taking too long to respond.
*
* @author Michael Jumper
*/
public class GuacamoleClientTimeoutException extends GuacamoleClientException {
/**
* Creates a new GuacamoleClientTimeoutException with the given message and cause.
*
* @param message A human readable description of the exception that
* occurred.
* @param cause The cause of this exception.
*/
public GuacamoleClientTimeoutException(String message, Throwable cause) {
super(message, cause);
}
/**
* Creates a new GuacamoleClientTimeoutException with the given message.
*
* @param message A human readable description of the exception that
* occurred.
*/
public GuacamoleClientTimeoutException(String message) {
super(message);
}
/**
* Creates a new GuacamoleClientTimeoutException with the given cause.
*
* @param cause The cause of this exception.
*/
public GuacamoleClientTimeoutException(Throwable cause) {
super(cause);
}
@Override
public GuacamoleStatus getStatus() {
return GuacamoleStatus.CLIENT_TIMEOUT;
}
}

View File

@@ -0,0 +1,72 @@
/*
* Copyright (C) 2013 Glyptodon LLC
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.glyptodon.guacamole;
import org.glyptodon.guacamole.protocol.GuacamoleStatus;
/**
* An exception which is thrown when too many requests have been received
* by the current client, and further requests are being rejected, either
* temporarily or permanently.
*
* @author Michael Jumper
*/
public class GuacamoleClientTooManyException extends GuacamoleClientException {
/**
* Creates a new GuacamoleClientTooManyException with the given message and cause.
*
* @param message A human readable description of the exception that
* occurred.
* @param cause The cause of this exception.
*/
public GuacamoleClientTooManyException(String message, Throwable cause) {
super(message, cause);
}
/**
* Creates a new GuacamoleClientTooManyException with the given message.
*
* @param message A human readable description of the exception that
* occurred.
*/
public GuacamoleClientTooManyException(String message) {
super(message);
}
/**
* Creates a new GuacamoleClientTooManyException with the given cause.
*
* @param cause The cause of this exception.
*/
public GuacamoleClientTooManyException(Throwable cause) {
super(cause);
}
@Override
public GuacamoleStatus getStatus() {
return GuacamoleStatus.CLIENT_TOO_MANY;
}
}

View File

@@ -0,0 +1,72 @@
/*
* Copyright (C) 2013 Glyptodon LLC
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.glyptodon.guacamole;
import org.glyptodon.guacamole.protocol.GuacamoleStatus;
/**
* An exception which is thrown when a resource has been requested, but that
* resource is locked or currently in use, and cannot be accessed by the
* current user.
*
* @author Michael Jumper
*/
public class GuacamoleResourceConflictException extends GuacamoleClientException {
/**
* Creates a new GuacamoleResourceConflictException with the given message and cause.
*
* @param message A human readable description of the exception that
* occurred.
* @param cause The cause of this exception.
*/
public GuacamoleResourceConflictException(String message, Throwable cause) {
super(message, cause);
}
/**
* Creates a new GuacamoleResourceConflictException with the given message.
*
* @param message A human readable description of the exception that
* occurred.
*/
public GuacamoleResourceConflictException(String message) {
super(message);
}
/**
* Creates a new GuacamoleResourceConflictException with the given cause.
*
* @param cause The cause of this exception.
*/
public GuacamoleResourceConflictException(Throwable cause) {
super(cause);
}
@Override
public GuacamoleStatus getStatus() {
return GuacamoleStatus.RESOURCE_CONFLICT;
}
}

View File

@@ -0,0 +1,71 @@
/*
* Copyright (C) 2013 Glyptodon LLC
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.glyptodon.guacamole;
import org.glyptodon.guacamole.protocol.GuacamoleStatus;
/**
* An exception which is thrown when the server is too busy to service the
* request.
*
* @author Michael Jumper
*/
public class GuacamoleServerBusyException extends GuacamoleServerException {
/**
* Creates a new GuacamoleServerBusyException with the given message and cause.
*
* @param message A human readable description of the exception that
* occurred.
* @param cause The cause of this exception.
*/
public GuacamoleServerBusyException(String message, Throwable cause) {
super(message, cause);
}
/**
* Creates a new GuacamoleServerBusyException with the given message.
*
* @param message A human readable description of the exception that
* occurred.
*/
public GuacamoleServerBusyException(String message) {
super(message);
}
/**
* Creates a new GuacamoleServerBusyException with the given cause.
*
* @param cause The cause of this exception.
*/
public GuacamoleServerBusyException(Throwable cause) {
super(cause);
}
@Override
public GuacamoleStatus getStatus() {
return GuacamoleStatus.SERVER_BUSY;
}
}

View File

@@ -0,0 +1,72 @@
/*
* Copyright (C) 2013 Glyptodon LLC
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.glyptodon.guacamole;
import org.glyptodon.guacamole.protocol.GuacamoleStatus;
/**
* A security-related exception thrown when parts of the Guacamole API is
* denying access to a resource, but access MAY be granted were the user
* authorized (logged in).
*
* @author Michael Jumper
*/
public class GuacamoleUnauthorizedException extends GuacamoleSecurityException {
/**
* Creates a new GuacamoleUnauthorizedException with the given message and cause.
*
* @param message A human readable description of the exception that
* occurred.
* @param cause The cause of this exception.
*/
public GuacamoleUnauthorizedException(String message, Throwable cause) {
super(message, cause);
}
/**
* Creates a new GuacamoleUnauthorizedException with the given message.
*
* @param message A human readable description of the exception that
* occurred.
*/
public GuacamoleUnauthorizedException(String message) {
super(message);
}
/**
* Creates a new GuacamoleUnauthorizedException with the given cause.
*
* @param cause The cause of this exception.
*/
public GuacamoleUnauthorizedException(Throwable cause) {
super(cause);
}
@Override
public GuacamoleStatus getStatus() {
return GuacamoleStatus.CLIENT_UNAUTHORIZED;
}
}

View File

@@ -0,0 +1,71 @@
/*
* Copyright (C) 2013 Glyptodon LLC
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.glyptodon.guacamole;
import org.glyptodon.guacamole.protocol.GuacamoleStatus;
/**
* An exception which is thrown when the requested operation is unsupported
* or unimplemented.
*
* @author Michael Jumper
*/
public class GuacamoleUnsupportedException extends GuacamoleServerException {
/**
* Creates a new GuacamoleUnsupportedException with the given message and cause.
*
* @param message A human readable description of the exception that
* occurred.
* @param cause The cause of this exception.
*/
public GuacamoleUnsupportedException(String message, Throwable cause) {
super(message, cause);
}
/**
* Creates a new GuacamoleUnsupportedException with the given message.
*
* @param message A human readable description of the exception that
* occurred.
*/
public GuacamoleUnsupportedException(String message) {
super(message);
}
/**
* Creates a new GuacamoleUnsupportedException with the given cause.
*
* @param cause The cause of this exception.
*/
public GuacamoleUnsupportedException(Throwable cause) {
super(cause);
}
@Override
public GuacamoleStatus getStatus() {
return GuacamoleStatus.UNSUPPORTED;
}
}

View File

@@ -0,0 +1,72 @@
/*
* Copyright (C) 2013 Glyptodon LLC
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.glyptodon.guacamole;
import org.glyptodon.guacamole.protocol.GuacamoleStatus;
/**
* An exception which indicates than an upstream server (such as the remote
* desktop) is returning an error or is otherwise unreachable.
*
* @author Michael Jumper
*/
public class GuacamoleUpstreamException extends GuacamoleException {
/**
* Creates a new GuacamoleUpstreamException with the given message and
* cause.
*
* @param message A human readable description of the exception that
* occurred.
* @param cause The cause of this exception.
*/
public GuacamoleUpstreamException(String message, Throwable cause) {
super(message, cause);
}
/**
* Creates a new GuacamoleUpstreamException with the given message.
*
* @param message A human readable description of the exception that
* occurred.
*/
public GuacamoleUpstreamException(String message) {
super(message);
}
/**
* Creates a new GuacamoleUpstreamException with the given cause.
*
* @param cause The cause of this exception.
*/
public GuacamoleUpstreamException(Throwable cause) {
super(cause);
}
@Override
public GuacamoleStatus getStatus() {
return GuacamoleStatus.UPSTREAM_ERROR;
}
}

View File

@@ -0,0 +1,72 @@
/*
* Copyright (C) 2013 Glyptodon LLC
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.glyptodon.guacamole;
import org.glyptodon.guacamole.protocol.GuacamoleStatus;
/**
* An exception which indicates than an upstream server (such as the remote
* desktop) is taking too long to respond.
*
* @author Michael Jumper
*/
public class GuacamoleUpstreamTimeoutException extends GuacamoleUpstreamException {
/**
* Creates a new GuacamoleUpstreamException with the given message and
* cause.
*
* @param message A human readable description of the exception that
* occurred.
* @param cause The cause of this exception.
*/
public GuacamoleUpstreamTimeoutException(String message, Throwable cause) {
super(message, cause);
}
/**
* Creates a new GuacamoleUpstreamException with the given message.
*
* @param message A human readable description of the exception that
* occurred.
*/
public GuacamoleUpstreamTimeoutException(String message) {
super(message);
}
/**
* Creates a new GuacamoleUpstreamException with the given cause.
*
* @param cause The cause of this exception.
*/
public GuacamoleUpstreamTimeoutException(Throwable cause) {
super(cause);
}
@Override
public GuacamoleStatus getStatus() {
return GuacamoleStatus.UPSTREAM_TIMEOUT;
}
}