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

org.kaazing.gateway.service.ServiceContext Maven / Gradle / Ivy

Go to download

Core service abstraction that has a list of accepting and connecting endpoints that provide functionality like echoing, broadcasting etc.

There is a newer version: 5.6.2
Show newest version
/**
 * Copyright 2007-2016, Kaazing Corporation. All rights reserved.
 *
 * Licensed 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.kaazing.gateway.service;

import java.io.File;
import java.util.Collection;
import java.util.List;
import java.util.Map;

import org.apache.mina.core.future.ConnectFuture;
import org.apache.mina.core.service.IoHandler;
import org.apache.mina.core.session.IoSessionInitializer;
import org.kaazing.gateway.resource.address.ResourceAddress;
import org.kaazing.gateway.security.CrossSiteConstraintContext;
import org.kaazing.gateway.security.RealmContext;
import org.kaazing.gateway.transport.BridgeSessionInitializer;
import org.kaazing.gateway.util.scheduler.SchedulerProvider;
import org.kaazing.mina.core.session.IoSessionEx;
import org.slf4j.Logger;

public interface ServiceContext {

    String SESSION_FILTER_NAME = "sessiontracker";

    RealmContext getServiceRealm();

    String getAuthorizationMode();

    String getSessionTimeout();

    String getServiceType();

    String getServiceName();

    String getServiceDescription();

    Collection getAccepts();

    Collection getBalances();

    Collection getConnects();
    
    Map getMimeMappings();

    ServiceProperties getProperties();

    Service getService();

    String[] getRequireRoles();
    
    /**
     * Return a MIME-type string for a given file extension, per the list of
     *  defined in gateway-config for this service and
     * in .  If the parameter is null or no MIME-type 
     * is configured for the given value, returns null.
     */
    String getContentType(String fileExtension);

    Map> getCrossSiteConstraints();

    File getWebDirectory();

    File getTempDirectory();

    void init() throws Exception;

    void start() throws Exception;

    void bind(Collection acceptURIs, IoHandler handler);

    void bind(Collection acceptURIs, IoHandler handler,
              AcceptOptionsContext acceptOptionsContext);
    
    void bind(Collection acceptURIs, IoHandler handler, AcceptOptionsContext acceptOptionsContext, BridgeSessionInitializer bridgeSessionInitializer);
    
    void bind(Collection acceptURIs, IoHandler handler, BridgeSessionInitializer bridgeSessionInitializer);

    void bindConnectsIfNecessary(Collection connectURIs);

    void unbind(Collection acceptURIs, IoHandler handler);

    void unbindConnectsIfNecessary(Collection connectURIs);

    void stop() throws Exception;

    void destroy() throws Exception;
    
    ConnectFuture connect(String connectURI, IoHandler connectHandler,
                          IoSessionInitializer ioSessionInitializer);

    ConnectFuture connect(ResourceAddress address, IoHandler connectHandler,
                          IoSessionInitializer connectSessionInitializer);

    Collection getActiveSessions();
    
    IoSessionEx getActiveSession(Long sessionId);
    
    void addActiveSession(IoSessionEx session);
    
    void removeActiveSession(IoSessionEx session);

//    public ClusterContext getClusterContext();

    AcceptOptionsContext getAcceptOptionsContext();

    ConnectOptionsContext getConnectOptionsContext();

    Logger getLogger();

    SchedulerProvider getSchedulerProvider();

    String decrypt(String encrypted) throws Exception;

    String encrypt(String plaintext) throws Exception;

    /**
     * For help with the Console, indicate whether the service supports accepts
     * and accept options.
     */
    boolean supportsAccepts();

    /**
     * For help with the Console, indicate whether the service supports connects
     * and connect options.
     */
    boolean supportsConnects();

    /**
     * For help with the Console, indicate whether the service supports connects
     * and connect options.
     */
    boolean supportsMimeMappings();

    int getProcessorCount();

    void setListsOfAcceptConstraintsByURI(List>> authorityToSetOfAcceptConstraintsByURI);

    // Used by the update.check.service, could be used by other services
    Map getServiceSpecificObjects();

    IoSessionInitializer getSessionInitializor();

    void setSessionInitializor(IoSessionInitializer ioSessionInitializer);

    MonitoringEntityFactory getMonitoringFactory();

    void setMonitoringFactory(MonitoringEntityFactory monitoringFactory);
    
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy