protected Peer createPeer(int rating, String uri, String ip, String portRange, MetaData metaData, Configuration config, Configuration peerConfig, IFsmFactory fsmFactory, ITransportLayerFactory transportFactory, IStatisticManager statisticFactory, IConcurrentFactory concurrentFactory, IMessageParser parser) throws InternalException, TransportException, URISyntaxException, UnknownServiceException { return new PeerImpl(this, rating, new URI(uri), ip, portRange, metaData.unwrap(IMetaData.class), config, peerConfig, fsmFactory, transportFactory, statisticFactory, concurrentFactory, parser, this.sessionDatasource); }
public Peer addPeer(String name, String realm, boolean connecting) { if (manager != null) { try { return manager.addPeer(new URI(name), realm, connecting); } catch (Exception e) { logger.error("Failed to add peer with name[" + name + "] and realm[" + realm + "] (connecting=" + connecting + ")", e); return null; } } else { logger.debug("Failed to add peer with name[{}] and realm[{}] (connecting={}) as peer manager is null.", new Object[]{name, realm, connecting}); return null; } }
@Override protected Peer createPeer(int rating, String uri, String ip, String portRange, MetaData metaData, Configuration globalConfig, Configuration peerConfig, org.jdiameter.client.api.fsm.IFsmFactory fsmFactory, org.jdiameter.client.api.io.ITransportLayerFactory transportFactory, IStatisticManager statisticFactory, IConcurrentFactory concurrentFactory, IMessageParser parser) throws InternalException, TransportException, URISyntaxException, UnknownServiceException { logger.debug("Creating Peer for URI [{}]", uri); if (predefinedPeerTable == null) { logger.debug("Creating new empty predefined peer table"); predefinedPeerTable = new CopyOnWriteArraySet<String>(); } logger.debug("Adding URI [{}] to predefinedPeerTable", uri); predefinedPeerTable.add(new URI(uri).getFQDN()); if (peerConfig.getBooleanValue(PeerAttemptConnection.ordinal(), false)) { logger.debug("Peer at URI [{}] is configured to attempt a connection (acting as a client) and a new peer instance will be created and returned", uri); return newPeerInstance(rating, new URI(uri), ip, portRange, true, null, metaData, globalConfig, peerConfig, (IFsmFactory) fsmFactory, (ITransportLayerFactory) transportFactory, parser, statisticFactory, concurrentFactory); } else { logger.debug("Peer at URI [{}] is configured to NOT attempt a connection (i.e. acting as a server) and null will be returned", uri); return null; } }
@Override public URI getUri() { try { return new URI(stack.getConfiguration().getStringValue(OwnDiameterURI.ordinal(), (String) OwnDiameterURI.defValue())); } catch (URISyntaxException e) { throw new IllegalArgumentException(e); } catch (UnknownServiceException e) { throw new IllegalArgumentException(e); } }
@Override public URI getDiameterURI() throws AvpDataException { try { return new URI(parser.bytesToOctetString(rawData)); } catch (URISyntaxException e) { throw new AvpDataException(e, this); } catch (UnknownServiceException e) { throw new AvpDataException(e, this); } }
String localHost = config.getStringValue(Parameters.OwnDiameterURI.ordinal(), null); try { this.realmTable.addLocalRealm(localRealm, new URI(localHost).getFQDN());