use of org.openstack4j.model.identity.v3.Endpoint in project wildfly by wildfly.
the class EJBRemoteConnectorService method start.
@Override
public void start(StartContext context) throws StartException {
final AssociationService associationService = associationServiceInjectedValue.getValue();
final Endpoint endpoint = endpointValue.getValue();
Executor executor = executorService.getOptionalValue();
if (executor != null) {
associationService.setExecutor(executor);
}
RemoteEJBService remoteEJBService = RemoteEJBService.create(associationService.getAssociation(), remotingTransactionServiceInjectedValue.getValue());
final ControlledProcessStateService processStateService = controlledProcessStateServiceInjectedValue.getValue();
if (processStateService.getCurrentState() == ControlledProcessState.State.STARTING) {
final PropertyChangeListener listener = new PropertyChangeListener() {
public void propertyChange(final PropertyChangeEvent evt) {
if (evt.getPropertyName().equals("currentState") && evt.getOldValue() == ControlledProcessState.State.STARTING) {
remoteEJBService.serverUp();
// can't use a lambda because of this line...
processStateService.removePropertyChangeListener(this);
}
}
};
processStateService.addPropertyChangeListener(listener);
// this is actually racy, so we have to double-check the state afterwards just to be sure it didn't transition before we got here.
if (processStateService.getCurrentState() != ControlledProcessState.State.STARTING) {
// this method is idempotent so it's OK if the listener got fired
remoteEJBService.serverUp();
// this one too
processStateService.removePropertyChangeListener(listener);
}
} else {
remoteEJBService.serverUp();
}
// Register an EJB channel open listener
OpenListener channelOpenListener = remoteEJBService.getOpenListener();
try {
registration = endpoint.registerService(EJB_CHANNEL_NAME, channelOpenListener, this.channelCreationOptions);
} catch (ServiceRegistrationException e) {
throw new StartException(e);
}
}
use of org.openstack4j.model.identity.v3.Endpoint in project camel by apache.
the class DomainProducerTest method setUp.
@Before
public void setUp() {
producer = new DomainProducer(endpoint, client);
when(domainService.create(any(Domain.class))).thenReturn(testOSdomain);
when(domainService.get(anyString())).thenReturn(testOSdomain);
List<Domain> getAllList = new ArrayList<>();
getAllList.add(testOSdomain);
getAllList.add(testOSdomain);
doReturn(getAllList).when(domainService).list();
dummyDomain = createDomain();
when(testOSdomain.getName()).thenReturn(dummyDomain.getName());
when(testOSdomain.getDescription()).thenReturn(dummyDomain.getDescription());
}
use of org.openstack4j.model.identity.v3.Endpoint in project camel by apache.
the class ProjectProducerTest method setUp.
@Before
public void setUp() {
producer = new ProjectProducer(endpoint, client);
when(projectService.create(any(Project.class))).thenReturn(testOSproject);
when(projectService.get(anyString())).thenReturn(testOSproject);
List<Project> getAllList = new ArrayList<>();
getAllList.add(testOSproject);
getAllList.add(testOSproject);
doReturn(getAllList).when(projectService).list();
dummyProject = createProject();
when(testOSproject.getName()).thenReturn(dummyProject.getName());
when(testOSproject.getDescription()).thenReturn(dummyProject.getDescription());
}
use of org.openstack4j.model.identity.v3.Endpoint in project camel by apache.
the class UserProducerTest method setUp.
@Before
public void setUp() {
producer = new UserProducer(endpoint, client);
when(userService.create(any(User.class))).thenReturn(testOSuser);
when(userService.get(anyString())).thenReturn(testOSuser);
List<User> getAllList = new ArrayList<>();
getAllList.add(testOSuser);
getAllList.add(testOSuser);
doReturn(getAllList).when(userService).list();
dummyUser = createUser();
when(testOSuser.getName()).thenReturn(dummyUser.getName());
when(testOSuser.getDescription()).thenReturn(dummyUser.getDescription());
when(testOSuser.getPassword()).thenReturn(dummyUser.getPassword());
when(testOSuser.getDomainId()).thenReturn(dummyUser.getDomainId());
when(testOSuser.getEmail()).thenReturn(dummyUser.getEmail());
}
use of org.openstack4j.model.identity.v3.Endpoint in project openstack4j by ContainX.
the class DefaultEndpointURLResolver method resolveV2.
private String resolveV2(URLResolverParams p) {
SortedSetMultimap<String, ? extends Access.Service> catalog = p.access.getAggregatedCatalog();
SortedSet<? extends Access.Service> services = catalog.get(p.type.getServiceName());
if (services.isEmpty()) {
services = catalog.get(p.type.getType());
}
if (!services.isEmpty()) {
Access.Service sc = p.getV2Resolver().resolveV2(p.type, services);
for (org.openstack4j.model.identity.v2.Endpoint ep : sc.getEndpoints()) {
if (p.region != null && !p.region.equalsIgnoreCase(ep.getRegion()))
continue;
if (sc.getServiceType() == ServiceType.NETWORK) {
sc.getEndpoints().get(0).toBuilder().type(sc.getServiceType().name());
}
if (p.perspective == null)
return getEndpointURL(p.access, ep);
switch(p.perspective) {
case ADMIN:
return ep.getAdminURL().toString();
case INTERNAL:
return ep.getInternalURL().toString();
case PUBLIC:
default:
return ep.getPublicURL().toString();
}
}
} else {
//if no catalog returned, if is identity service, just return endpoint
if (ServiceType.IDENTITY.equals(p.type)) {
return p.access.getEndpoint();
}
}
return null;
}
Aggregations