Search in sources :

Example 1 with PublicInterface

use of org.bimserver.shared.interfaces.PublicInterface in project BIMserver by opensourceBIM.

the class ServiceMap method get.

@SuppressWarnings("unchecked")
public <T extends PublicInterface> T get(Class<T> clazz) {
    PublicInterface publicInterface = interfaces.get(clazz);
    if (publicInterface != null) {
        return (T) publicInterface;
    }
    if (clazz == ServiceInterface.class) {
        publicInterface = new ServiceImpl(this);
    } else if (clazz == NewServicesInterface.class) {
        publicInterface = new NewServicesImpl(this);
    } else if (clazz == AuthInterface.class) {
        publicInterface = new AuthServiceImpl(this);
    } else if (clazz == AdminInterface.class) {
        publicInterface = new AdminServiceImpl(this);
    } else if (clazz == LowLevelInterface.class) {
        publicInterface = new LowLevelServiceImpl(this);
    } else if (clazz == MetaInterface.class) {
        publicInterface = new MetaServiceImpl(this);
    } else if (clazz == SettingsInterface.class) {
        publicInterface = new SettingsServiceImpl(this);
    } else if (clazz == RemoteServiceInterface.class) {
        publicInterface = new RemoteServiceImpl(bimServer, this);
    } else if (clazz == NotificationRegistryInterface.class) {
        publicInterface = new NotificationRegistryServiceImpl(this);
    } else if (clazz == NotificationInterface.class) {
        publicInterface = new NotificationInterfaceAdaptor();
    } else if (clazz == PluginInterface.class) {
        publicInterface = new PluginServiceImpl(this);
    } else if (clazz == OAuthInterface.class) {
        publicInterface = new OAuthServiceImpl(this);
    } else {
        throw new RuntimeException("Unknown interface: " + clazz.getName());
    }
    interfaces.put((Class<PublicInterface>) clazz, publicInterface);
    return (T) publicInterface;
}
Also used : RemoteServiceInterface(org.bimserver.shared.interfaces.RemoteServiceInterface) NewServicesInterface(org.bimserver.shared.interfaces.NewServicesInterface) AuthServiceImpl(org.bimserver.webservices.impl.AuthServiceImpl) AdminServiceImpl(org.bimserver.webservices.impl.AdminServiceImpl) OAuthServiceImpl(org.bimserver.webservices.impl.OAuthServiceImpl) LowLevelServiceImpl(org.bimserver.webservices.impl.LowLevelServiceImpl) MetaServiceImpl(org.bimserver.webservices.impl.MetaServiceImpl) ServiceImpl(org.bimserver.webservices.impl.ServiceImpl) PluginServiceImpl(org.bimserver.webservices.impl.PluginServiceImpl) RemoteServiceImpl(org.bimserver.webservices.impl.RemoteServiceImpl) NotificationRegistryServiceImpl(org.bimserver.webservices.impl.NotificationRegistryServiceImpl) SettingsServiceImpl(org.bimserver.webservices.impl.SettingsServiceImpl) OAuthInterface(org.bimserver.shared.interfaces.OAuthInterface) OAuthServiceImpl(org.bimserver.webservices.impl.OAuthServiceImpl) PluginServiceImpl(org.bimserver.webservices.impl.PluginServiceImpl) NotificationRegistryServiceImpl(org.bimserver.webservices.impl.NotificationRegistryServiceImpl) AdminInterface(org.bimserver.shared.interfaces.AdminInterface) AsyncAdminInterface(org.bimserver.shared.interfaces.async.AsyncAdminInterface) MetaInterface(org.bimserver.shared.interfaces.MetaInterface) AsyncMetaInterface(org.bimserver.shared.interfaces.async.AsyncMetaInterface) MetaServiceImpl(org.bimserver.webservices.impl.MetaServiceImpl) AdminServiceImpl(org.bimserver.webservices.impl.AdminServiceImpl) SettingsServiceImpl(org.bimserver.webservices.impl.SettingsServiceImpl) PublicInterface(org.bimserver.shared.interfaces.PublicInterface) NewServicesImpl(org.bimserver.webservices.impl.NewServicesImpl) LowLevelServiceImpl(org.bimserver.webservices.impl.LowLevelServiceImpl) RemoteServiceImpl(org.bimserver.webservices.impl.RemoteServiceImpl) AuthServiceImpl(org.bimserver.webservices.impl.AuthServiceImpl) OAuthServiceImpl(org.bimserver.webservices.impl.OAuthServiceImpl) NotificationInterface(org.bimserver.shared.interfaces.NotificationInterface) NotificationInterfaceAdaptor(org.bimserver.shared.interfaces.NotificationInterfaceAdaptor)

Example 2 with PublicInterface

use of org.bimserver.shared.interfaces.PublicInterface in project BIMserver by opensourceBIM.

the class JsonChannel method connect.

public void connect(TokenHolder tokenHolder) throws ChannelConnectionException {
    reflector = jsonReflectorFactory.create(address, tokenHolder);
    for (Class<? extends PublicInterface> interface1 : sServicesMap.getInterfaceClasses()) {
        PublicInterface createReflector = reflectorFactory.createReflector(interface1, reflector);
        add(interface1.getName(), createReflector);
    }
    finish(reflector, reflectorFactory);
}
Also used : PublicInterface(org.bimserver.shared.interfaces.PublicInterface)

Example 3 with PublicInterface

use of org.bimserver.shared.interfaces.PublicInterface in project BIMserver by opensourceBIM.

the class ProtocolBuffersChannel method connect.

public void connect(TokenHolder tokenHolder) throws ChannelConnectionException {
    protocolBuffersChannel = new SocketProtocolBuffersChannel(tokenHolder);
    protocolBuffersChannel.registerConnectDisconnectListener(this);
    ProtocolBuffersReflector reflector = new ProtocolBuffersReflector(protocolBuffersMetaData, servicesMap, protocolBuffersChannel);
    for (Class<? extends PublicInterface> interface1 : servicesMap.getInterfaceClasses()) {
        PublicInterface createReflector = reflectorFactory.createReflector(interface1, reflector);
        add(interface1.getName(), createReflector);
    }
    finish(reflector, reflectorFactory);
    try {
        protocolBuffersChannel.connect(new InetSocketAddress(address, port));
    } catch (IOException e) {
        throw new ChannelConnectionException(e);
    }
}
Also used : ProtocolBuffersReflector(org.bimserver.shared.pb.ProtocolBuffersReflector) PublicInterface(org.bimserver.shared.interfaces.PublicInterface) ChannelConnectionException(org.bimserver.shared.ChannelConnectionException) InetSocketAddress(java.net.InetSocketAddress) SocketProtocolBuffersChannel(org.bimserver.shared.pb.SocketProtocolBuffersChannel) IOException(java.io.IOException)

Example 4 with PublicInterface

use of org.bimserver.shared.interfaces.PublicInterface in project BIMserver by opensourceBIM.

the class SoapChannel method newToken.

@Override
public void newToken(String token) {
    if (useSoapHeaderSessions) {
        for (PublicInterface p : getServiceInterfaces().values()) {
            List<Header> headers = new ArrayList<Header>();
            try {
                Token tokenObject = new Token(token);
                Header sessionHeader = new Header(new QName("uri:org.bimserver.shared", "token"), tokenObject, new JAXBDataBinding(Token.class));
                headers.add(sessionHeader);
            } catch (JAXBException e) {
                LOGGER.error("", e);
            }
            ((BindingProvider) p).getRequestContext().put(Header.HEADER_LIST, headers);
        }
    }
}
Also used : PublicInterface(org.bimserver.shared.interfaces.PublicInterface) Header(org.apache.cxf.headers.Header) QName(javax.xml.namespace.QName) JAXBException(javax.xml.bind.JAXBException) ArrayList(java.util.ArrayList) Token(org.bimserver.shared.Token) JAXBDataBinding(org.apache.cxf.jaxb.JAXBDataBinding)

Example 5 with PublicInterface

use of org.bimserver.shared.interfaces.PublicInterface in project BIMserver by opensourceBIM.

the class SoapChannel method connect.

public void connect(TokenHolder tokenHolder) {
    for (Class<? extends PublicInterface> interface1 : interfaces) {
        JaxWsProxyFactoryBean cpfb = new JaxWsProxyFactoryBean();
        cpfb.setServiceClass(interface1);
        cpfb.setAddress(address + "/" + interface1.getSimpleName());
        Map<String, Object> properties = new HashMap<String, Object>();
        properties.put("mtom-enabled", Boolean.TRUE);
        cpfb.setProperties(properties);
        PublicInterface serviceInterface = (PublicInterface) cpfb.create();
        client = ClientProxy.getClient(serviceInterface);
        HTTPConduit http = (HTTPConduit) client.getConduit();
        http.getClient().setConnectionTimeout(360000);
        http.getClient().setAllowChunking(false);
        http.getClient().setReceiveTimeout(320000);
        if (!useSoapHeaderSessions) {
            ((BindingProvider) serviceInterface).getRequestContext().put(BindingProvider.SESSION_MAINTAIN_PROPERTY, Boolean.TRUE);
        }
        add(interface1.getName(), serviceInterface);
    }
    tokenHolder.registerTokenChangeListener(this);
    notifyOfConnect();
}
Also used : HTTPConduit(org.apache.cxf.transport.http.HTTPConduit) PublicInterface(org.bimserver.shared.interfaces.PublicInterface) HashMap(java.util.HashMap) JaxWsProxyFactoryBean(org.apache.cxf.jaxws.JaxWsProxyFactoryBean)

Aggregations

PublicInterface (org.bimserver.shared.interfaces.PublicInterface)8 UserException (org.bimserver.shared.exceptions.UserException)3 IOException (java.io.IOException)2 QName (javax.xml.namespace.QName)2 Header (org.apache.cxf.headers.Header)2 SMethod (org.bimserver.shared.meta.SMethod)2 SService (org.bimserver.shared.meta.SService)2 JsonObject (com.google.gson.JsonObject)1 DynamicMessage (com.google.protobuf.DynamicMessage)1 Builder (com.google.protobuf.DynamicMessage.Builder)1 Message (com.google.protobuf.Message)1 EOFException (java.io.EOFException)1 InetSocketAddress (java.net.InetSocketAddress)1 SocketException (java.net.SocketException)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 JAXBException (javax.xml.bind.JAXBException)1 SoapMessage (org.apache.cxf.binding.soap.SoapMessage)1 JAXBDataBinding (org.apache.cxf.jaxb.JAXBDataBinding)1 JaxWsProxyFactoryBean (org.apache.cxf.jaxws.JaxWsProxyFactoryBean)1