mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 13:17:41 +00:00
GUACAMOLE-1224: Extract base interface for events affecting objects stored in a Directory.
This commit is contained in:
@@ -24,13 +24,14 @@ import org.apache.guacamole.net.auth.Identifiable;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Abstract basis for events which involve a modification made to the objects
|
* Abstract basis for events which involve a modification made to the objects
|
||||||
* within a {@link Directory}.
|
* within a {@link Directory} through the operations exposed by the Directory
|
||||||
|
* interface.
|
||||||
*
|
*
|
||||||
* @param <ObjectType>
|
* @param <ObjectType>
|
||||||
* The type of object stored within the {@link Directory}.
|
* The type of object stored within the {@link Directory}.
|
||||||
*/
|
*/
|
||||||
public interface DirectoryEvent<ObjectType extends Identifiable>
|
public interface DirectoryEvent<ObjectType extends Identifiable>
|
||||||
extends AuthenticationProviderEvent, UserEvent {
|
extends DirectoryObjectEvent<ObjectType> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The types of directory operations that may be represented by a
|
* The types of directory operations that may be represented by a
|
||||||
@@ -70,15 +71,6 @@ public interface DirectoryEvent<ObjectType extends Identifiable>
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the type of objects stored within the {@link Directory}
|
|
||||||
* affected by the operation.
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
* The type of objects stored within the {@link Directory}.
|
|
||||||
*/
|
|
||||||
Directory.Type getDirectoryType();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the operation that was performed/attempted.
|
* Returns the operation that was performed/attempted.
|
||||||
*
|
*
|
||||||
@@ -88,24 +80,25 @@ public interface DirectoryEvent<ObjectType extends Identifiable>
|
|||||||
Operation getOperation();
|
Operation getOperation();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the identifier of the object affected by the operation. If the
|
* {@inheritDoc}
|
||||||
* object was just created, this will be the identifier of the new object.
|
* <p>
|
||||||
*
|
* If the object was just created, this will be the identifier of the new
|
||||||
* @return
|
* object.
|
||||||
* The identifier of the object affected by the operation.
|
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
String getObjectIdentifier();
|
String getObjectIdentifier();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the object affected by the operation, if available. For
|
* {@inheritDoc}
|
||||||
* deletions, there is no guarantee that the affected object will be
|
* <p>
|
||||||
* available within this event. If the object is not available, null is
|
* Currently, for object creation ({@link Operation#ADD}), retrieval
|
||||||
* returned.
|
* ({@link Operation#GET}), modification and ({@link Operation#UPDATE}),
|
||||||
*
|
* it can be expected that the affected object will be available, however
|
||||||
* @return
|
* the caller should verify this regardless. For deletions
|
||||||
* The object affected by the operation performed, or null if that
|
* ({@link Operation#REMOVE}), the object can only be made available for
|
||||||
* object is not available in the context of this event.
|
* single deletions, and cannot be made available for batch deletions.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
ObjectType getObject();
|
ObjectType getObject();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,65 @@
|
|||||||
|
/*
|
||||||
|
* 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.net.event;
|
||||||
|
|
||||||
|
import org.apache.guacamole.net.auth.Directory;
|
||||||
|
import org.apache.guacamole.net.auth.Identifiable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Abstract basis for events which affect or directly relate to objects that
|
||||||
|
* may be stored within a {@link Directory}.
|
||||||
|
*
|
||||||
|
* @param <ObjectType>
|
||||||
|
* The type of object stored within the {@link Directory}.
|
||||||
|
*/
|
||||||
|
public interface DirectoryObjectEvent<ObjectType extends Identifiable>
|
||||||
|
extends AuthenticationProviderEvent, UserEvent {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the type of {@link Directory} that contains the object affected
|
||||||
|
* by the operation.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
* The type of objects stored within the {@link Directory}.
|
||||||
|
*/
|
||||||
|
Directory.Type getDirectoryType();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the identifier of the object affected by the operation.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
* The identifier of the object affected by the operation.
|
||||||
|
*/
|
||||||
|
String getObjectIdentifier();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the object affected by the operation, if available. Whether the
|
||||||
|
* affected object is available is context- and implementation-dependent.
|
||||||
|
* There is no general guarantee across all implementations of this event
|
||||||
|
* that the affected object will be available. If the object is not
|
||||||
|
* available, null is returned.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
* The object affected by the operation performed, or null if that
|
||||||
|
* object is not available in the context of this event.
|
||||||
|
*/
|
||||||
|
ObjectType getObject();
|
||||||
|
|
||||||
|
}
|
@@ -20,9 +20,9 @@
|
|||||||
package org.apache.guacamole.event;
|
package org.apache.guacamole.event;
|
||||||
|
|
||||||
import org.apache.guacamole.net.auth.Nameable;
|
import org.apache.guacamole.net.auth.Nameable;
|
||||||
import org.apache.guacamole.net.event.DirectoryEvent;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.apache.guacamole.net.event.DirectoryObjectEvent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loggable representation of the object affected by an operation.
|
* Loggable representation of the object affected by an operation.
|
||||||
@@ -37,7 +37,7 @@ public class AffectedObject implements LoggableDetail {
|
|||||||
/**
|
/**
|
||||||
* The event representing the requested operation.
|
* The event representing the requested operation.
|
||||||
*/
|
*/
|
||||||
private final DirectoryEvent<?> event;
|
private final DirectoryObjectEvent<?> event;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new AffectedObject representing the object affected by the
|
* Creates a new AffectedObject representing the object affected by the
|
||||||
@@ -46,7 +46,7 @@ public class AffectedObject implements LoggableDetail {
|
|||||||
* @param event
|
* @param event
|
||||||
* The event representing the operation.
|
* The event representing the operation.
|
||||||
*/
|
*/
|
||||||
public AffectedObject(DirectoryEvent<?> event) {
|
public AffectedObject(DirectoryObjectEvent<?> event) {
|
||||||
this.event = event;
|
this.event = event;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user