FileDocCategorySizeDatePackage
AdditionalContextLauncher.javaAPI DocExample1758Thu Nov 08 00:22:54 GMT 2001com.ora.rmibook.chapter15.basicapps

AdditionalContextLauncher

public class AdditionalContextLauncher extends Object

Fields Summary
Constructors Summary
Methods Summary
private static voidlaunchContext(java.lang.String baseContextMachine, java.lang.String pathPlusName)

        StringTokenizer tokenizer = new StringTokenizer(pathPlusName, "/", false);
        int numberOfPathTokens = tokenizer.countTokens() - 1;
        Path path = null;

        if (0 != numberOfPathTokens) {
            String[] pathComponents = new String[numberOfPathTokens];

            for (int counter = 0; counter < numberOfPathTokens; counter++) {
                pathComponents[counter] = tokenizer.nextToken();
            }
            path = Path.buildPath(pathComponents);
        }
        String name = tokenizer.nextToken();

        try {
            ContextImpl newContext = new ContextImpl();
            Context startingContext = BaseContextImpl.getStubFromServer(baseContextMachine);

            startingContext.bindSubContext(path, name, newContext);
        } catch (NamingException e) {
            System.out.println("Failed to launched context " + pathPlusName);
            System.out.println(e.getDescription());
            e.printStackTrace();
        } catch (Exception ee) {
            ee.printStackTrace();
        }
    
public static voidmain(java.lang.String[] args)

        for (int i = 0; i < args.length; i++) {
            launchContext(args[0], args[i]);
        }