All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.deeplearning4j.ui.api.UIModule Maven / Gradle / Ivy

/* ******************************************************************************
 * Copyright (c) 2015-2018 Skymind, Inc.
 * Copyright (c) 2019 Konduit K.K.
 *
 * This program and the accompanying materials are made available under the
 * terms of the Apache License, Version 2.0 which is available at
 * https://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.
 *
 * SPDX-License-Identifier: Apache-2.0
 ******************************************************************************/

package org.deeplearning4j.ui.api;

import org.deeplearning4j.core.storage.StatsStorage;
import org.deeplearning4j.core.storage.StatsStorageEvent;
import org.deeplearning4j.ui.i18n.I18NResource;

import java.util.Collection;
import java.util.List;

/**
 * UIModule encapsulates the user interface functionality for a page or group of pages that rely on data coming
 * from a {@link StatsStorage} instance.
* When a {@link StatsStorage} object is attached to a {@link UIServer}, the UI server will * start receiving {@link StatsStorageEvent} instances; some of these (only the appropriate ones based on the specified * TypeIDs from the {@link #getCallbackTypeIDs()} method) will be routed to the UIModule, via {@link #reportStorageEvents(Collection)}. * Each UIModule will generally handle one (or at most a few) different types of data (Type IDs); note however that events * for a single Type ID can be routed to multiple UI modules, if required. *

* The UIModule also encapsulates the relevant routing information: i.e., what GET/PUT (etc) methods are available for this * module, and how those methods should be handled. * * @author Alex Black */ public interface UIModule { /** * Get the list of Type IDs that should be collected from the registered {@link StatsStorage} instances, and * passed on to the {@link #reportStorageEvents(Collection)} method. * * @return List of relevant Type IDs */ List getCallbackTypeIDs(); /** * Get a list of {@link Route} objects, that specify GET/SET etc methods, and how these should be handled. * * @return List of routes */ List getRoutes(); /** * Whenever the {@link UIServer} receives some {@link StatsStorageEvent}s from one of the registered {@link StatsStorage} * instances, it will filter these and pass on to the UI module those ones that match one of the Type IDs from * {@link #getCallbackTypeIDs()}.
* Typically, these will be batched together at least somewhat, rather than being reported individually. * * @param events List of relevant events (type IDs match one of those from {@link #getCallbackTypeIDs()} */ void reportStorageEvents(Collection events); /** * Notify the UI module that the given {@link StatsStorage} instance has been attached to the UI * * @param statsStorage Stats storage that has been attached */ void onAttach(StatsStorage statsStorage); /** * Notify the UI module that the given {@link StatsStorage} instance has been detached from the UI * * @param statsStorage Stats storage that has been detached */ void onDetach(StatsStorage statsStorage); /** * @return List of internationalization resources */ List getInternationalizationResources(); }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy