timeout = Long.parseLong(args[0]);
}
System.out.println("Starting the Sample SCA BigBank server...");
ClassLoader cl = BigBankServer.class.getClassLoader();
EmbeddedSCADomain domain = new EmbeddedSCADomain(cl, "http://localhost");
//Start the domain
domain.start();
// Contribute the SCA contribution
ContributionService contributionService = domain.getContributionService();
URL javaContribURL = getContributionURL(SavingsAccountService.class);
Contribution bigbankAcContribution = contributionService.contribute("http://bigbank-account", javaContribURL, false);
for (Composite deployable : bigbankAcContribution.getDeployables()) {
domain.getDomainComposite().getIncludes().add(deployable);
domain.buildComposite(deployable);
}
URL bigbankContribUrl = getContributionURL(BigBankServer.class);
Contribution bigbankContribution = contributionService.contribute("http://bigbank", bigbankContribUrl, false);
for (Composite deployable : bigbankContribution.getDeployables()) {
domain.getDomainComposite().getIncludes().add(deployable);
domain.buildComposite(deployable);
}
//Start Components from composite
for (Composite deployable : bigbankAcContribution.getDeployables()) {
domain.getCompositeActivator().activate(deployable);
domain.getCompositeActivator().start(deployable);
}
for (Composite deployable : bigbankContribution.getDeployables()) {
domain.getCompositeActivator().activate(deployable);
domain.getCompositeActivator().start(deployable);
}
if (timeout < 0) {
System.out.println("Press Enter to Exit...");
System.in.read();
} else {
Thread.sleep(timeout);
}
contributionService.remove("http://bigbank-account");
contributionService.remove("http://bigbank");
// Stop Components from composite
for (Composite deployable : bigbankContribution.getDeployables()) {
domain.getCompositeActivator().stop(deployable);
domain.getCompositeActivator().deactivate(deployable);
}
domain.stop();
domain.close();
/*SCADomain domain = SCADomain.newInstance("BigBank.composite");
if (timeout < 0) {