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;
}
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);
}
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);
}
}
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);
}
}
}
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();
}
Aggregations