}
@Override
- public final ProvidedInterface[] getProvidedServices() {
+ public final ProvidedInterface[] getProvidedInterfaces() {
return _provided.toArray(new ProvidedInterface[0]);
}
@Override
- public final RequiredInterface[] getRequiredServices() {
+ public final RequiredInterface[] getRequiredInterfaces() {
return _required.toArray(new RequiredInterface[0]);
}
* Gets a description of the provided interfaces.
* @return Provided interfaces.
*/
- ProvidedInterface[] getProvidedServices();
+ ProvidedInterface[] getProvidedInterfaces();
/**
* Gets a description of the required interfaces.
* @return Required interfaces.
*/
- RequiredInterface[] getRequiredServices();
+ RequiredInterface[] getRequiredInterfaces();
/**
*/
void start();
- /**
- * Stops a subsystem.
- */
- void stop();
-
/**
* Gets the list of running services in the subsystem.
*
* @return
*/
ProvidedInterface[] getRunningServices();
+
+ /**
+ * Stops a subsystem.
+ */
+ void stop();
}
private void validate(RequiredInterface[] aRequired) {
List<ProvidedInterface> provided = new ArrayList<ProvidedInterface>();
for (Component system : _systems) {
- provided.addAll(Arrays.asList(system.getProvidedServices()));
+ provided.addAll(Arrays.asList(system.getProvidedInterfaces()));
}
List<RequiredInterface> required = new ArrayList<RequiredInterface>();
for (Component system : _systems) {
- required.addAll(Arrays.asList(system.getRequiredServices()));
+ required.addAll(Arrays.asList(system.getRequiredInterfaces()));
}
- for (ProvidedInterface service : getProvidedServices()) {
+ for (ProvidedInterface service : getProvidedInterfaces()) {
if (!(provided.contains(service))) {
throw new SystemAssemblyException(getName() + ": Service '" + service
+ "' is not provided by any of the subsystems");
}
}
- for (RequiredInterface service : getRequiredServices()) {
+ for (RequiredInterface service : getRequiredInterfaces()) {
if (!(required.contains(service))) {
info("Service '"
+ service
// all interfaces from the required list of this container are
// provided to the components inside it.
- RequiredInterface[] required = getRequiredServices();
+ RequiredInterface[] required = getRequiredInterfaces();
for (RequiredInterface intf: required) {
ProvidedInterface provider = intf.getProvider();
if ( provider == null ) {
// Add the provides of all externally required interfaces to the list of available
// interfaces
- for (RequiredInterface required: getRequiredServices()) {
+ for (RequiredInterface required: getRequiredInterfaces()) {
allProvided.add(required.getProvider());
}
for (Component system : _systems) {
// Check if all required services are already provided by earlier
// systems.
- RequiredInterface[] required = system.getRequiredServices();
+ RequiredInterface[] required = system.getRequiredInterfaces();
for (RequiredInterface descriptor : required) {
ProvidedInterface[] filtered = filterProvidedServices(
system.start();
// add all provided services
- ProvidedInterface[] provided = system.getProvidedServices();
+ ProvidedInterface[] provided = system.getProvidedInterfaces();
allProvided.addAll(Arrays.asList(provided));
}
}
new RequiredInterface[0]);
assertEquals(Status.NOT_STARTED, system.getStatus());
system.start();
- RequiredInterface[] required = system.getRequiredServices();
+ RequiredInterface[] required = system.getRequiredInterfaces();
assertEquals(0, required.length);
- ProvidedInterface[] provided = system.getProvidedServices();
+ ProvidedInterface[] provided = system.getProvidedInterfaces();
assertEquals(0, provided.length);
assertEquals(Status.RUNNING, environment.getStatus());
assertEquals(Status.RUNNING, application.getStatus());
application }, new ProvidedInterface[0],
new RequiredInterface[] { new DefaultRequiredInterface(
"string", String.class) });
- system.getRequiredServices()[0]
+ system.getRequiredInterfaces()[0]
.setProvider(new DefaultProvidedInterface("hallo", String.class));
system.start();
- RequiredInterface[] required = system.getRequiredServices();
+ RequiredInterface[] required = system.getRequiredInterfaces();
assertEquals(1, required.length);
- ProvidedInterface[] provided = system.getProvidedServices();
+ ProvidedInterface[] provided = system.getProvidedInterfaces();
assertEquals(0, provided.length);
}
Component application = new Application();
Container system = new Container("all",
new Component[] { application }, new ProvidedInterface[0],
- application.getRequiredServices());
+ application.getRequiredInterfaces());
system.start();
} catch (SystemAssemblyException e) {
return;
Component application = new Application();
Container system = new Container("all",
new Component[] { application }, new ProvidedInterface[0],
- application.getRequiredServices());
+ application.getRequiredInterfaces());
environment.start();
- system.getRequiredServices()[0].setProvider(environment
- .getProvidedServices()[0]);
- system.getRequiredServices()[1].setProvider(environment
- .getProvidedServices()[1]);
+ system.getRequiredInterfaces()[0].setProvider(environment
+ .getProvidedInterfaces()[0]);
+ system.getRequiredInterfaces()[1].setProvider(environment
+ .getProvidedInterfaces()[1]);
system.start();
- RequiredInterface[] required = system.getRequiredServices();
+ RequiredInterface[] required = system.getRequiredInterfaces();
assertEquals(2, required.length);
- ProvidedInterface[] provided = system.getProvidedServices();
+ ProvidedInterface[] provided = system.getProvidedInterfaces();
assertEquals(0, provided.length);
}
@Override
protected void doStart() {
- addService(getProvidedServices()[0], new Integer(1));
- addService(getProvidedServices()[1], new Integer(2));
+ addService(getProvidedInterfaces()[0], new Integer(1));
+ addService(getProvidedInterfaces()[1], new Integer(2));
track("start." + getName());
}
* @param aId Id of the bean in the service registry.
*/
public RequiredServiceBean(String aId) {
- RequiredInterface[] required = SpringComponent.THIS.get().getRequiredServices();
+ RequiredInterface[] required = SpringComponent.THIS.get().getRequiredInterfaces();
for ( RequiredInterface intf: required) {
if ( intf.getName().equals(aId)) {
_required = intf;
private void registerRequiredServices() {
// Register required services in a parent context
- for (RequiredInterface required: getRequiredServices()) {
+ for (RequiredInterface required: getRequiredInterfaces()) {
String beanName = _required.get(required);
ConstructorArgumentValues cargs = new ConstructorArgumentValues();
cargs.addGenericArgumentValue(required.getName());
HelloService helloObject = new HelloService("ladida");
ProvidedInterface helloService = new DefaultProvidedInterface("hello", HelloService.class);
helloService.publish(helloObject);
- system.getRequiredServices()[0].setProvider(helloService);
+ system.getRequiredInterfaces()[0].setProvider(helloService);
system.start();
system.stop();
ProvidedInterface helloService =
new DefaultProvidedInterface("hello", HelloService.class);
helloService.publish(helloObject);
- system.getRequiredServices()[0].setProvider(helloService);
+ system.getRequiredInterfaces()[0].setProvider(helloService);
system.start();
- ProvidedInterface started = system.getProvidedServices()[0];
+ ProvidedInterface started = system.getProvidedInterfaces()[0];
assertNotNull(started.getImplementation());
assertTrue(started.getImplementation() instanceof BlaService);