mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 05:07:41 +00:00
GUACAMOLE-38: Clean up lots of unnecessary code.
This commit is contained in:
@@ -25,6 +25,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
import org.apache.guacamole.GuacamoleException;
|
||||
import org.apache.guacamole.auth.quickconnect.utility.QCParser;
|
||||
import org.apache.guacamole.net.auth.ConnectionGroup;
|
||||
import org.apache.guacamole.net.auth.simple.SimpleConnection;
|
||||
import org.apache.guacamole.net.auth.simple.SimpleDirectory;
|
||||
import org.apache.guacamole.net.auth.Connection;
|
||||
import org.apache.guacamole.protocol.GuacamoleConfiguration;
|
||||
@@ -49,7 +50,7 @@ public class QuickConnectDirectory extends SimpleDirectory<Connection> {
|
||||
/**
|
||||
* The root connection group for this directory.
|
||||
*/
|
||||
private final QuickConnectConnectionGroup rootGroup;
|
||||
private final QuickConnectionGroup rootGroup;
|
||||
|
||||
/**
|
||||
* The internal counter for connection IDs.
|
||||
@@ -67,7 +68,7 @@ public class QuickConnectDirectory extends SimpleDirectory<Connection> {
|
||||
* A group that should be at the base of this directory.
|
||||
*/
|
||||
public QuickConnectDirectory(ConnectionGroup rootGroup) {
|
||||
this.rootGroup = (QuickConnectConnectionGroup)rootGroup;
|
||||
this.rootGroup = (QuickConnectionGroup)rootGroup;
|
||||
this.connectionId = new AtomicInteger();
|
||||
super.setObjects(this.connections);
|
||||
}
|
||||
@@ -89,13 +90,13 @@ public class QuickConnectDirectory extends SimpleDirectory<Connection> {
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a QuickConnection object from a GuacamoleConfiguration
|
||||
* Create a SimpleConnection object from a GuacamoleConfiguration
|
||||
* and get an ID and place it on the tree, returning the new
|
||||
* connection identifier value.
|
||||
*
|
||||
* @param config
|
||||
* The GuacamoleConfiguration to use to create the
|
||||
* QuickConnection object.
|
||||
* SimpleConnection object.
|
||||
*
|
||||
* @return
|
||||
* The identifier of the connection created in the directory.
|
||||
@@ -112,7 +113,7 @@ public class QuickConnectDirectory extends SimpleDirectory<Connection> {
|
||||
String name = QCParser.getName(config);
|
||||
|
||||
// Create a new connection and set parent identifier.
|
||||
Connection connection = new QuickConnection(name, connectionId, config);
|
||||
Connection connection = new SimpleConnection(name, connectionId, config);
|
||||
connection.setParentIdentifier(ROOT_IDENTIFIER);
|
||||
|
||||
// Place the object in directory
|
||||
|
@@ -54,12 +54,6 @@ public class QuickConnectUserContext extends AbstractUserContext {
|
||||
*/
|
||||
private final Directory<User> userDirectory;
|
||||
|
||||
/**
|
||||
* The Directory with access only to the root group associated with this
|
||||
* UserContext.
|
||||
*/
|
||||
private final Directory<ConnectionGroup> connectionGroupDirectory;
|
||||
|
||||
/**
|
||||
* The Directory with access to all connections within the root group
|
||||
* associated with this UserContext.
|
||||
@@ -87,7 +81,7 @@ public class QuickConnectUserContext extends AbstractUserContext {
|
||||
|
||||
// Initialize the rootGroup to a basic connection group with a
|
||||
// single root identifier.
|
||||
this.rootGroup = new QuickConnectConnectionGroup(
|
||||
this.rootGroup = new QuickConnectionGroup(
|
||||
DEFAULT_ROOT_CONNECTION_GROUP,
|
||||
DEFAULT_ROOT_CONNECTION_GROUP
|
||||
);
|
||||
@@ -102,7 +96,6 @@ public class QuickConnectUserContext extends AbstractUserContext {
|
||||
// Initialize each of the directories associated with the userContext.
|
||||
this.userDirectory = new SimpleDirectory<User>(self);
|
||||
this.connectionDirectory = new QuickConnectDirectory(this.rootGroup);
|
||||
this.connectionGroupDirectory = new SimpleDirectory<ConnectionGroup>(Collections.singleton(this.rootGroup));
|
||||
|
||||
// Set the authProvider to the calling authProvider object.
|
||||
this.authProvider = authProvider;
|
||||
@@ -135,12 +128,6 @@ public class QuickConnectUserContext extends AbstractUserContext {
|
||||
return userDirectory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Directory<ConnectionGroup> getConnectionGroupDirectory()
|
||||
throws GuacamoleException {
|
||||
return connectionGroupDirectory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConnectionGroup getRootConnectionGroup() throws GuacamoleException {
|
||||
return rootGroup;
|
||||
|
@@ -1,87 +0,0 @@
|
||||
/*
|
||||
* 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.auth.quickconnect;
|
||||
|
||||
import org.apache.guacamole.GuacamoleException;
|
||||
import org.apache.guacamole.net.auth.Connection;
|
||||
import org.apache.guacamole.net.auth.simple.SimpleConnection;
|
||||
import org.apache.guacamole.protocol.GuacamoleConfiguration;
|
||||
|
||||
/**
|
||||
* A type of Connection specific to this authentication extension.
|
||||
*/
|
||||
public class QuickConnection extends SimpleConnection {
|
||||
|
||||
/**
|
||||
* Number of active connections.
|
||||
*/
|
||||
private int activeConnections;
|
||||
|
||||
/**
|
||||
* Empty connection constructor.
|
||||
*/
|
||||
public QuickConnection() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor that takes a name, identifier, and GuacamoleConfiguration
|
||||
* and builds a QuickConnection from it.
|
||||
*
|
||||
* @param name
|
||||
* The name of the connection.
|
||||
*
|
||||
* @param identifier
|
||||
* The unique identifier of this connection within this
|
||||
* authentication module.
|
||||
*
|
||||
* @param config
|
||||
* The GuacamoleConfiguration object to store in this
|
||||
* QuickConnection.
|
||||
*/
|
||||
public QuickConnection(String name, String identifier,
|
||||
GuacamoleConfiguration config) {
|
||||
|
||||
super(name, identifier, config);
|
||||
|
||||
this.activeConnections = 0;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a QuickConnection from a generic Connection
|
||||
* object, copying over the relevant data and initializing
|
||||
* the rest.
|
||||
*
|
||||
* @param connection
|
||||
* The generic Connection to be copied.
|
||||
*/
|
||||
public QuickConnection(Connection connection) {
|
||||
|
||||
super(connection.getName(),connection.getIdentifier(),
|
||||
connection.getConfiguration());
|
||||
|
||||
setParentIdentifier(connection.getParentIdentifier());
|
||||
|
||||
this.activeConnections = 0;
|
||||
|
||||
}
|
||||
|
||||
}
|
@@ -35,7 +35,7 @@ import org.apache.guacamole.protocol.GuacamoleClientInformation;
|
||||
* for temporarily storing the QuickConnections created by
|
||||
* users.
|
||||
*/
|
||||
public class QuickConnectConnectionGroup extends AbstractConnectionGroup {
|
||||
public class QuickConnectionGroup extends AbstractConnectionGroup {
|
||||
|
||||
/**
|
||||
* The connection identifiers for this group.
|
||||
@@ -43,16 +43,16 @@ public class QuickConnectConnectionGroup extends AbstractConnectionGroup {
|
||||
private Set<String> connectionIdentifiers;
|
||||
|
||||
/**
|
||||
* Set up a QuickConnectConnectionGroup with a name and identifier, and
|
||||
* Set up a QuickConnectionGroup with a name and identifier, and
|
||||
* an empty set of child connections.
|
||||
*
|
||||
* @param name
|
||||
* The name of the QuickConnectConnectionGroup.
|
||||
* The name of the QuickConnectionGroup.
|
||||
*
|
||||
* @param identifier
|
||||
* The identifier of the QuickConnectConnectionGroup.
|
||||
* The identifier of the QuickConnectionGroup.
|
||||
*/
|
||||
public QuickConnectConnectionGroup(String name, String identifier) {
|
||||
public QuickConnectionGroup(String name, String identifier) {
|
||||
|
||||
setName(name);
|
||||
setIdentifier(identifier);
|
Reference in New Issue
Block a user