Java Code Examples for java.rmi.NotBoundException

The following are top voted examples for showing how to use java.rmi.NotBoundException. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: lams   File: RmiServiceExporter.java   Source Code and License 6 votes vote down vote up
/**
 * Unbind the RMI service from the registry on bean factory shutdown.
 */
@Override
public void destroy() throws RemoteException {
	if (logger.isInfoEnabled()) {
		logger.info("Unbinding RMI service '" + this.serviceName +
				"' from registry" + (this.createdRegistry ? (" at port '" + this.registryPort + "'") : ""));
	}
	try {
		this.registry.unbind(this.serviceName);
	}
	catch (NotBoundException ex) {
		if (logger.isWarnEnabled()) {
			logger.warn("RMI service '" + this.serviceName + "' is not bound to registry"
					+ (this.createdRegistry ? (" at port '" + this.registryPort + "' anymore") : ""), ex);
		}
	}
	finally {
		unexportObjectSilently();
	}
}
 
Example 2
Project: Voice_Activated_EV3_Robot   File: EV3Agent.java   Source Code and License 6 votes vote down vote up
protected boolean setUp(){
	try{
		setUpEV3();
		setUpPorts();
		setUpShooter();
		return true;
	} catch(RemoteException | MalformedURLException | NotBoundException e){
		logger.error("Could not open ports " + e.getMessage());
		try{
			closePorts();
		} catch(RemoteException e1){
			logger.error("Error closing ports " + e1.getMessage());
		}
		return false;
	}
}
 
Example 3
Project: monarch   File: DUnitLauncher.java   Source Code and License 6 votes vote down vote up
private static void startLocator(Registry registry) throws IOException, NotBoundException {
  RemoteDUnitVMIF remote = (RemoteDUnitVMIF) registry.lookup("vm" + LOCATOR_VM_NUM);
  final File locatorLogFile =
      LOCATOR_LOG_TO_DISK ? new File("locator-" + locatorPort + ".log") : new File("");
  MethExecutorResult result = remote.executeMethodOnObject(new SerializableCallable() {
    public Object call() throws IOException {
      Properties p = getDistributedSystemProperties();
      // I never want this locator to end up starting a jmx manager
      // since it is part of the unit test framework
      p.setProperty("jmx-manager", "false");
      //Disable the shared configuration on this locator.
      //Shared configuration tests create their own locator
      p.setProperty("enable-cluster-configuration", "false");
      Locator.startLocatorAndDS(locatorPort, locatorLogFile, p);
      return null;
    }
  }, "call");
  if(result.getException() != null) {
    RuntimeException ex = new RuntimeException("Failed to start locator", result.getException());
    ex.printStackTrace();
    throw ex;
  }
}
 
Example 4
Project: jdk8u-jdk   File: InheritedChannelNotServerSocket.java   Source Code and License 6 votes vote down vote up
public synchronized Channel inheritedChannel() throws IOException {
    System.err.println("SP.inheritedChannel");
    if (channel == null) {
        channel = SocketChannel.open();
        Socket socket = channel.socket();
        System.err.println("socket = " + socket);

        /*
         * Notify test that inherited channel was created.
         */
        try {
            System.err.println("notify test...");
            Registry registry =
                LocateRegistry.getRegistry(TestLibrary.INHERITEDCHANNELNOTSERVERSOCKET_REGISTRY_PORT);
            Callback obj = (Callback) registry.lookup("Callback");
            obj.notifyTest();
        } catch (NotBoundException nbe) {
            throw (IOException)
                new IOException("callback object not bound").
                    initCause(nbe);
        }
    }
    return channel;
}
 
Example 5
Project: openNaEF   File: VrfRefresher.java   Source Code and License 6 votes vote down vote up
@Override
public List<? extends IModel> refresh() throws RemoteException,
        ExternalServiceException, IOException, AuthenticationException,
        NotBoundException, InstantiationException, IllegalAccessException {
    List<Vrf> result = new ArrayList<Vrf>();

    List<String> inventoryIds = new ArrayList<String>();
    for (IModel target : getTargets()) {
        inventoryIds.add(target.getId());
    }
    for (String inventoryId : inventoryIds) {
        Vrf vrfModel = VrfModelCreator.createModel(VrfHandler.getVrfIfDto(inventoryId), inventoryId);
        result.add((Vrf) new VplsModelDisplayNameConverter().convertModel(vrfModel));
    }

    return result;
}
 
Example 6
Project: openNaEF   File: VlanLinkListViewMaker.java   Source Code and License 6 votes vote down vote up
@Override
public TableInput makeListView() throws RemoteException,
        AuthenticationException, InventoryException,
        ExternalServiceException, IOException, NotBoundException,
        InstantiationException, IllegalAccessException, ParseException {

    List<? extends IModel> vlanLinkList = new ArrayList<IModel>();

    for (String str : getQuery().keySet()) {
        log.debug(str + " : " + getQuery().getMatcher(str).hashCode());
    }

    if (hasMvoIdAsKeyInQuery()) {
        String mvoId = getMvoIdFromQuery();
        vlanLinkList = VlanLinkHandler.getList(mvoId);
    }
    return getConverter().convertList(vlanLinkList);
}
 
Example 7
Project: openNaEF   File: SubnetIpListViewMaker.java   Source Code and License 6 votes vote down vote up
@Override
public TableInput makeListView() throws RemoteException,
        AuthenticationException, InventoryException,
        ExternalServiceException, IOException, NotBoundException,
        InstantiationException, IllegalAccessException, ParseException {

    List<? extends IModel> subnetList = new ArrayList<IModel>();

    if (hasInventoryIdAsKeyInQuery()) {
        String mvoId = getInventoryIdFromQuery();
        subnetList = SubnetIpHandler.getList(getQuery(), mvoId);
    } else {
        subnetList = SubnetIpHandler.getList(getQuery());
    }
    return getConverter().convertList(subnetList);
}
 
Example 8
Project: openNaEF   File: WholeRsvpLspDiagramBuilder.java   Source Code and License 6 votes vote down vote up
public IDiagram build() throws RemoteException, InventoryException, ExternalServiceException, IOException, AuthenticationException, NotBoundException {
    IDiagram diagram = new Diagram();
    List<String> iRefs = new ArrayList<String>();
    diagram.setPropertyValue(IPropertyConstants.PROPERTY_INVENTORY_REFS, iRefs);
    diagram.setText("Whole LSP Topology");

    MplsNmsInventoryConnector conn = MplsNmsInventoryConnector.getInstance();
    for (RsvpLspIdPoolDto pool : conn.getRsvpLspIdPool()) {
        for (RsvpLspDto lsp : pool.getUsers()) {
            if (lsp.getHopSeries1() != null) {
                setModelsOnHopSeries(diagram, lsp.getHopSeries1().getHops(), true);
            }
            if (lsp.getHopSeries2() != null) {
                setModelsOnHopSeries(diagram, lsp.getHopSeries2().getHops(), false);
            }
        }
    }
    for (PhysicalLink link : this.linkCache.values()) {
        setPathStyle(link);
    }
    return diagram;
}
 
Example 9
Project: DocIT   File: Client.java   Source Code and License 5 votes vote down vote up
public Client(String server) throws Exception {
	try {
		sampleCompany = (Company) Naming.lookup("//" + server + "/meganalysis");
	} catch (MalformedURLException malformedException) {
		System.err.println("Bad URL: " + malformedException);
	} catch (NotBoundException notBoundException) {
		System.err.println("Not Bound: " + notBoundException);
	} catch (RemoteException remoteException) {
		System.err.println("Remote Exception: " + remoteException);
	}
	
	demo();
}
 
Example 10
Project: Proyecto-DASI   File: AdaptadorRegRMI.java   Source Code and License 5 votes vote down vote up
public static ItfUsoAgenteReactivo getItfAgteReactRemoto(String host, String nombreAgente) throws RemoteException, NotBoundException {
//        Registry regCliente = LocateRegistry.getRegistry(ip, 1099);
//        ItfUsoAgenteReactivo agenteRemoto = null;
//        if (regCliente == null) return null;
//        else {
//            agenteRemoto = (ItfUsoAgenteReactivo) regCliente.lookup(nombreAgente);
//            return agenteRemoto;
//        }
        return getItfAgteReactRemoto (host, 1099, nombreAgente);
    }
 
Example 11
Project: openNaEF   File: VrfHandler.java   Source Code and License 5 votes vote down vote up
public static List<Vrf> get(String inventoryId) throws NotBoundException, AuthenticationException, IOException, ExternalServiceException {
    List<Vrf> vrfList = new ArrayList<Vrf>();

    for (VrfIfDto vrf : VrfExtUtil.getVrfIfDtos()) {
        if (InventoryIdUtil.getInventoryId(vrf).equals(inventoryId)) {
            vrfList.add(VrfModelCreator.createModel(vrf, InventoryIdUtil.getInventoryId(vrf)));
        }
    }

    return vrfList;
}
 
Example 12
Project: Proyecto-DASI   File: AdaptadorRegRMI.java   Source Code and License 5 votes vote down vote up
public static Remote getItfUsoRecursoRemoto(String identHost, String nombreRecurso) throws RemoteException, NotBoundException {
            Registry regCliente = LocateRegistry.getRegistry(identHost);
            InterfazGestion agenteRemoto = null;
            if (regCliente == null) return null;
         else
//            agenteRemoto = (ItfUsoAgenteReactivo) regCliente.lookup(nombreAgente);
//            return agenteRemoto;
//        }
        return regCliente.lookup(NombresPredefinidos.ITF_USO+nombreRecurso);
    }
 
Example 13
Project: openNaEF   File: LinkHandler.java   Source Code and License 5 votes vote down vote up
public static List<PhysicalLink> getList(ObjectFilterQuery query) throws NotBoundException, AuthenticationException, IOException, ExternalServiceException {
    List<PhysicalLink> linkList = new ArrayList<PhysicalLink>();

    for (IpSubnetDto link : filterLinks(query, MplsNmsInventoryConnector.getInstance().getActiveIpSubnets())) {
        linkList.add(LinkModelCreator.createModel(link, InventoryIdUtil.getInventoryId(link)));
    }

    return linkList;
}
 
Example 14
Project: openNaEF   File: RsvpLspHandler.java   Source Code and License 5 votes vote down vote up
public static List<LabelSwitchedPath> getListUnderPseudoWire(String pwInventoryId) throws AuthenticationException, NotBoundException, IOException, ExternalServiceException {
    List<LabelSwitchedPath> lspList = new ArrayList<LabelSwitchedPath>();

    for (PseudowireDto pw : MplsNmsInventoryConnector.getInstance().getDtoFacade().getPseudowires()) {
        if (PseudoWireRenderer.getPseudoWireID(pw).equals(PseudoWireHandler.parseVcId(pwInventoryId))) {
            appendLSPList(lspList, pw.getRsvpLsps());
        }
    }

    return lspList;
}
 
Example 15
Project: openNaEF   File: PseudoWireHandler.java   Source Code and License 5 votes vote down vote up
public static List<PseudoWire> getListUpperLsp(String lspInventoryId) throws AuthenticationException,
        NotBoundException, IOException, ExternalServiceException {
    List<PseudoWire> pwList = new ArrayList<PseudoWire>();

    for (RsvpLspDto lsp : MplsNmsInventoryConnector.getInstance().getDtoFacade().getRsvpLsps()) {
        if (InventoryIdUtil.getInventoryId(lsp).equals(lspInventoryId)) {
            appendPwList(pwList, getPseudoWiresOn(lsp));
        }
    }
    return pwList;
}
 
Example 16
Project: openNaEF   File: SubnetIpHandler.java   Source Code and License 5 votes vote down vote up
public static List<SubnetIp> getList(ObjectFilterQuery query) throws NotBoundException, AuthenticationException, IOException, InventoryException, ExternalServiceException {
    List<SubnetIp> subnetIpList = new ArrayList<SubnetIp>();

    if (!(query.containsKey("TargetNodeName") || query.containsKey("TargetIfName"))) {
        IMatcher subnetMatcher = query.get("SubnetIP");
        for (IpSubnetNamespaceDto ipSubnetNameSpace : SubnetRenderer.getAllIpSubnetNamespace()) {
            Set<IpSubnetDto> ipSubnets = ipSubnetNameSpace.getUsers();
            if (ipSubnets == null) {
                continue;
            }
            for (IpSubnetDto ipSubnet : ipSubnets) {
                subnetIpList.addAll(createIpList(ipSubnet, subnetMatcher));
            }
        }
    }

    List<PortDto> ipIfList = new ArrayList<PortDto>();
    for (NodeDto node : MplsNmsInventoryConnector.getInstance().getActiveNodes()) {
        for (PortDto port : node.getPorts()) {
            if (isTargetPort(port)) {
                ipIfList.add((IpIfDto) port);
            }
        }
    }

    for (PortDto ipif : filter(query, ipIfList)) {
        SubnetIp model = SubnetIpModelCreator.createModel(ipif, InventoryIdCalculator.getId(ipif));
        int i = ipContains(subnetIpList, model);
        if (i < 0) {
            subnetIpList.add(model);
        } else {
            subnetIpList.set(i, model);
        }
    }

    return subnetIpList;
}
 
Example 17
Project: openNaEF   File: PseudoWireDiagramBuilder.java   Source Code and License 5 votes vote down vote up
public IDiagram build(String inventoryId) throws RemoteException, ExternalServiceException, IOException, AuthenticationException, NotBoundException {
    IDiagram diagram = new Diagram();

    FakePseudoWire fpw = PseudoWireHandler.getPseudowireDto(inventoryId);
    RsvpLspDto lsp = null;
    PortDto ingress = null;
    PortDto egress = null;
    if (fpw.isPipe()) {
        lsp = null;
        ingress = fpw.getAc1();
        egress = fpw.getAc2();
    } else {
        lsp = PseudoWireHandler.getLspOnSrc(inventoryId);
        ingress = PseudoWireHandler.getAcOnIngress(fpw.getPseudowireDto(), lsp);
        egress = PseudoWireHandler.getAcOnEgress(fpw.getPseudowireDto(), lsp);
    }

    List<String> iRefs = new ArrayList<String>();
    iRefs.add(inventoryId);
    diagram.setPropertyValue(IPropertyConstants.PROPERTY_INVENTORY_REFS, iRefs);
    diagram.setPropertyValue(IPropertyConstants.PROPERTY_DIAGRAM_SORUCE,
            PseudoWireModelCreator.createModel(fpw, lsp, inventoryId, ingress, egress));
    diagram.setText(InventoryIdUtil.unEscape(inventoryId));

    if (fpw.isPseudoWire()) {
        attachLsp(diagram, fpw.getPseudowireDto());
    } else {
        drawPipe(diagram, fpw);
    }

    return diagram;
}
 
Example 18
Project: common-services   File: ServiceMessagingTest.java   Source Code and License 5 votes vote down vote up
@Test(expected = IllegalArgumentException.class)
public void testRemoteException() throws NotBoundException, RemoteException {
  when(testService.getString(any())).thenAnswer(i -> {
    System.out.println("Got request to server mock");
    throw new IllegalArgumentException("Illegal argument");
  });
  TestService srv = client.getInstance();
  srv.getString("string");
}
 
Example 19
Project: common-services   File: ServiceMessagingTest.java   Source Code and License 5 votes vote down vote up
@Test
public void testRemoteRequestSerialTiming() throws NotBoundException, RemoteException {
  int count = 100;
  TestService srv = client.getInstance();

  long start = System.currentTimeMillis();
  for (int i = 0; i < count; i++) {
    srv.getString("str" + i);
  }
  long end = System.currentTimeMillis();
  long time = end - start;
  System.out.println(String.format("Executed %d invocations in %d ms (%.2f ms/req)", count, time, ((double) time) / count));
}
 
Example 20
Project: openNaEF   File: RsvpLspHandler.java   Source Code and License 5 votes vote down vote up
public static List<LabelSwitchedPath> getList(ObjectFilterQuery query) throws NotBoundException, AuthenticationException, IOException, ExternalServiceException {
    List<LabelSwitchedPath> lspList = new ArrayList<LabelSwitchedPath>();

    List<RsvpLspDto> lsps = new ArrayList<RsvpLspDto>();
    for (RsvpLspDto lsp : MplsNmsInventoryConnector.getInstance().getRegularRsvpLspPool().getUsers()) {
        lsps.add(lsp);
    }
    appendLSPList(lspList, filterLSPs(query, lsps));

    return lspList;
}
 
Example 21
Project: monarch   File: DUnitLauncher.java   Source Code and License 5 votes vote down vote up
public void init(Registry registry, int numVMs) throws AccessException, RemoteException, NotBoundException, InterruptedException {
  for(int i = 0; i < numVMs; i++) {
    RemoteDUnitVMIF remote = processManager.getStub(i);
    addVM(i, remote);
  }

  addLocator(LOCATOR_VM_NUM, processManager.getStub(LOCATOR_VM_NUM));

  addHost(this);
}
 
Example 22
Project: monarch   File: DUnitLauncher.java   Source Code and License 5 votes vote down vote up
@Override
public VM getVM(int n) {

  if(n == DEBUGGING_VM_NUM) {
    //for ease of debugging, pass -1 to get the local VM
    return debuggingVM;
  }

  int oldVMCount = getVMCount();
  if(n >= oldVMCount) {
    //If we don't have a VM with that number, dynamically create it.
    try {
      for(int i = oldVMCount; i <= n; i++) {
        processManager.launchVM(i);
      }
      processManager.waitForVMs(STARTUP_TIMEOUT);

      for(int i = oldVMCount; i <= n; i++) {
        addVM(i, processManager.getStub(i));
      }

    } catch (IOException | InterruptedException | NotBoundException e) {
      throw new RuntimeException("Could not dynamically launch vm + " + n, e);
    }
  }

  return super.getVM(n);
}
 
Example 23
Project: monarch   File: RMIRegistryService.java   Source Code and License 5 votes vote down vote up
/**
 * Removes the binding for the specified <code>name</code> in the rmiregistry
 * 
 * @see java.rmi.registry.Registry#unbind(String)
 */
public void unbind(String name) throws RemoteException, NotBoundException {
  if (!isRunning()) {
    throw new IllegalStateException("RMIRegistryService is not running");
  }
  registry.unbind(name);
}
 
Example 24
Project: openNaEF   File: TransactionManager.java   Source Code and License 5 votes vote down vote up
static void initializeLocalSide(String transactionCoordinatorServiceUrl)
        throws RemoteException, NotBoundException, MalformedURLException {
    distributedTransactionService__
            = (DistributedTransactionService) Naming
            .lookup(transactionCoordinatorServiceUrl);

    TefServiceProxy tefServiceProxy = new TefServiceProxy.Impl();
    UnicastRemoteObject.exportObject(tefServiceProxy);
    distributedTransactionService__.enlist(tefServiceProxy);
}
 
Example 25
Project: monarch   File: DUnitLauncher.java   Source Code and License 5 votes vote down vote up
private static int startLocator(Registry registry) throws IOException, NotBoundException {
  RemoteDUnitVMIF remote = (RemoteDUnitVMIF) registry.lookup("vm" + LOCATOR_VM_NUM);
  final File locatorLogFile =
      LOCATOR_LOG_TO_DISK ? new File("locator-" + locatorPort + ".log") : new File("");
  MethExecutorResult result = remote.executeMethodOnObject(new SerializableCallable() {
    public Object call() throws IOException {
      Properties p = getDistributedSystemProperties();
      // I never want this locator to end up starting a jmx manager
      // since it is part of the unit test framework
      p.setProperty(JMX_MANAGER, "false");
      // Disable the shared configuration on this locator.
      // Shared configuration tests create their own locator
      p.setProperty(ENABLE_CLUSTER_CONFIGURATION, "false");
      // Tell the locator it's the first in the system for
      // faster boot-up
      System.setProperty(GMSJoinLeave.BYPASS_DISCOVERY_PROPERTY, "true");
      // disable auto-reconnect - tests fly by so fast that it will never be
      // able to do so successfully anyway
      p.setProperty(DISABLE_AUTO_RECONNECT, "true");

      try {
        Locator.startLocatorAndDS(0, locatorLogFile, p);
        InternalLocator internalLocator = (InternalLocator) Locator.getLocator();
        locatorPort = internalLocator.getPort();
        internalLocator.resetInternalLocatorFileNamesWithCorrectPortNumber(locatorPort);
      } finally {
        System.getProperties().remove(GMSJoinLeave.BYPASS_DISCOVERY_PROPERTY);
      }

      return locatorPort;
    }
  }, "call");
  if (result.getException() != null) {
    RuntimeException ex = new RuntimeException("Failed to start locator", result.getException());
    ex.printStackTrace();
    throw ex;
  }
  return (Integer) result.getResult();
}
 
Example 26
Project: monarch   File: DUnitLauncher.java   Source Code and License 5 votes vote down vote up
public void init(Registry registry, int numVMs)
    throws AccessException, RemoteException, NotBoundException, InterruptedException {
  for (int i = 0; i < numVMs; i++) {
    RemoteDUnitVMIF remote = processManager.getStub(i);
    addVM(i, remote);
  }

  addLocator(LOCATOR_VM_NUM, processManager.getStub(LOCATOR_VM_NUM));

  addHost(this);
}
 
Example 27
Project: monarch   File: InternalBlackboardImpl.java   Source Code and License 5 votes vote down vote up
private static synchronized void initialize() throws Exception {
  if (blackboard == null) {
    System.out.println(
        DUnitLauncher.RMI_PORT_PARAM + "=" + System.getProperty(DUnitLauncher.RMI_PORT_PARAM));
    int namingPort = Integer.getInteger(DUnitLauncher.RMI_PORT_PARAM).intValue();
    String name = "//localhost:" + namingPort + "/" + "InternalBlackboard";
    try {
      blackboard = (InternalBlackboard) Naming.lookup(name);
    } catch (NotBoundException e) {
      // create the master blackboard in this VM
      blackboard = new InternalBlackboardImpl();
      Naming.bind(name, blackboard);
    }
  }
}
 
Example 28
Project: openNaEF   File: JournalReceiver.java   Source Code and License 5 votes vote down vote up
private JournalMirroringServer connectMasterServer()
        throws RemoteException, NotBoundException, MalformedURLException {
    String distributorUrl
            = tefService_.getTefServiceConfig().getMasterServerConfig().distributorUrl;
    logMessage("connecting master, " + distributorUrl);
    return (JournalMirroringServer) Naming.lookup(distributorUrl);
}
 
Example 29
Project: jdk8u-jdk   File: Activation.java   Source Code and License 5 votes vote down vote up
/**
 * Returns the activation system stub if the specified name
 * matches the activation system's class name, otherwise
 * returns the result of invoking super.lookup with the specified
 * name.
 */
public Remote lookup(String name)
    throws RemoteException, NotBoundException
{
    if (name.equals(NAME)) {
        return systemStub;
    } else {
        return super.lookup(name);
    }
}
 
Example 30
Project: jdk8u-jdk   File: Activation.java   Source Code and License 5 votes vote down vote up
public void unbind(String name)
    throws RemoteException, NotBoundException, AccessException
{
    if (name.equals(NAME)) {
        throw new AccessException(
            "unbinding ActivationSystem is disallowed");
    } else {
        super.unbind(name);
    }
}
 
Example 31
Project: jdk8u-jdk   File: RmidViaInheritedChannel.java   Source Code and License 5 votes vote down vote up
public synchronized Channel inheritedChannel() throws IOException {
    System.err.println("RmidSelectorProvider.inheritedChannel");
    if (channel == null) {
        /*
         * Create server socket channel and bind server socket.
         */
        channel = ServerSocketChannel.open();
        ServerSocket serverSocket = channel.socket();
        serverSocket.bind(
             new InetSocketAddress(InetAddress.getLocalHost(),
             TestLibrary.RMIDVIAINHERITEDCHANNEL_ACTIVATION_PORT));
        System.err.println("serverSocket = " + serverSocket);

        /*
         * Notify test that inherited channel was created.
         */
        try {
            System.err.println("notify test...");
            Registry registry =
                LocateRegistry.getRegistry(TestLibrary.RMIDVIAINHERITEDCHANNEL_REGISTRY_PORT);
            Callback obj = (Callback) registry.lookup("Callback");
            obj.notifyTest();
        } catch (NotBoundException nbe) {
            throw (IOException)
                new IOException("callback object not bound").
                    initCause(nbe);
        }
    }
    return channel;
}
 
Example 32
Project: openNaEF   File: PortHandler.java   Source Code and License 5 votes vote down vote up
public static List<PhysicalEthernetPort> get(String inventoryId) throws NotBoundException, AuthenticationException,
        IOException, InventoryException, ExternalServiceException {
    List<PhysicalEthernetPort> portList = new ArrayList<PhysicalEthernetPort>();
    for (PortDto port : getActivePorts()) {
        if (InventoryIdUtil.getInventoryId(port).equals(inventoryId)) {
            portList.add(PortModelCreator.createModel(port, InventoryIdUtil.getInventoryId(port)));
            break;
        }
    }
    return portList;
}
 
Example 33
Project: jdk8u-jdk   File: RegistryFilterTest.java   Source Code and License 5 votes vote down vote up
@Test
public void simpleRejectableClass() throws RemoteException, AlreadyBoundException, NotBoundException {
    RejectableClass r1 = null;
    try {
        String name = "reject1";
        r1 = new RejectableClass();
        registry.bind(name, r1);
        registry.unbind(name);
        Assert.assertNull(registryFilter, "Registry filter should not have rejected");
    } catch (Exception rex) {
        Assert.assertNotNull(registryFilter, "Registry filter should have rejected");
    }
}
 
Example 34
Project: openjdk-jdk10   File: Activation.java   Source Code and License 5 votes vote down vote up
/**
 * Returns the activation system stub if the specified name
 * matches the activation system's class name, otherwise
 * returns the result of invoking super.lookup with the specified
 * name.
 */
public Remote lookup(String name)
    throws RemoteException, NotBoundException
{
    if (name.equals(NAME)) {
        return getSystemStub();
    } else {
        return super.lookup(name);
    }
}
 
Example 35
Project: openjdk-jdk10   File: Activation.java   Source Code and License 5 votes vote down vote up
public void unbind(String name)
    throws RemoteException, NotBoundException, AccessException
{
    if (name.equals(NAME)) {
        throw new AccessException(
            "unbinding ActivationSystem is disallowed");
    } else {
        RegistryImpl.checkAccess("ActivationSystem.unbind");
        super.unbind(name);
    }
}
 
Example 36
Project: openNaEF   File: PortHandler.java   Source Code and License 5 votes vote down vote up
public static List<PhysicalEthernetPort> getListOwnedByNode(String nodeInventoryId) throws NotBoundException,
        AuthenticationException, IOException, InventoryException, ExternalServiceException {
    List<PhysicalEthernetPort> portList = new ArrayList<PhysicalEthernetPort>();
    try {
        String nodeID = InventoryIdDecoder.getNode(nodeInventoryId);
        appendPortList(portList, getTargetPorts(MplsNmsInventoryConnector.getInstance().getNodeDto(nodeID)));
        return portList;
    } catch (ParseException e) {
        throw new InventoryException("illegal inventory-id.", e);
    }
}
 
Example 37
Project: openjdk-jdk10   File: RegistryFilterTest.java   Source Code and License 5 votes vote down vote up
@Test(dataProvider="bindData")
public void simpleBind(String name, Remote obj, boolean blacklisted) throws RemoteException, AlreadyBoundException, NotBoundException {
    try {
        registry.bind(name, obj);
        Assert.assertFalse(blacklisted, "Registry filter did not reject (but should have) ");
        registry.unbind(name);
    } catch (Exception rex) {
        Assert.assertTrue(blacklisted, "Registry filter should not have rejected");
    }
}
 
Example 38
Project: openjdk-jdk10   File: RegistryFilterTest.java   Source Code and License 5 votes vote down vote up
@Test
public void simpleRejectableClass() throws RemoteException, AlreadyBoundException, NotBoundException {
    RejectableClass r1 = null;
    try {
        String name = "reject1";
        r1 = new RejectableClass();
        registry.bind(name, r1);
        registry.unbind(name);
        Assert.assertNull(registryFilter, "Registry filter should have rejected");
    } catch (Exception rex) {
        Assert.assertNotNull(registryFilter, "Registry filter should not have rejected");
    }
}
 
Example 39
Project: openjdk-jdk10   File: RegistryFilterTest.java   Source Code and License 5 votes vote down vote up
@Test
public void simpleDepthRejectable() throws RemoteException, AlreadyBoundException, NotBoundException {
    int depthOverride = Integer.getInteger("test.maxdepth", REGISTRY_MAX_DEPTH);
    depthOverride = Math.min(depthOverride, REGISTRY_MAX_DEPTH);
    System.out.printf("overrideDepth: %d, filter: %s%n", depthOverride, registryFilter);
    try {
        String name = "reject3";
        DepthRejectableClass r1 = DepthRejectableClass.create(depthOverride + 1);
        registry.bind(name, r1);
        Assert.fail("Registry filter should have rejected depth: " + depthOverride + 1);
    } catch (Exception rex) {
        // Rejection expected
    }
}
 
Example 40
Project: openNaEF   File: VrfHandler.java   Source Code and License 5 votes vote down vote up
public static List<Vrf> getList(ObjectFilterQuery query) throws NotBoundException, AuthenticationException, IOException, ExternalServiceException {
    List<Vrf> vrfList = new ArrayList<Vrf>();

    for (VrfIfDto vrf : filterVrfs(query, VrfExtUtil.getVrfIfDtos())) {
        vrfList.add(VrfModelCreator.createModel(vrf, InventoryIdUtil.getInventoryId(vrf)));
    }

    return vrfList;
}
 
Example 41
Project: openNaEF   File: PseudoWireFacilityStatusUpdater.java   Source Code and License 5 votes vote down vote up
@Override
public List<? extends IModel> update() throws RemoteException, InventoryException, ExternalServiceException,
        IOException, AuthenticationException, NotBoundException, InstantiationException, IllegalAccessException {
    List<PseudoWire> result = new ArrayList<PseudoWire>();

    Map<String, FacilityStatus> newStatus = getNewStatus(getTargets());
    for (Entry<String, FacilityStatus> entry : newStatus.entrySet()) {
        String inventoryId = entry.getKey();
        FacilityStatus fs = entry.getValue();
        FakePseudoWire fpw = PseudoWireHandler.getPseudowireDto(inventoryId);

        if (!FacilityStatusUtil.isAllowableChangeByGUI(fpw, fs)) {
            throw new IllegalStateException("cannot change: PW=[" + fpw.getPseudoWireId()
                    + ":" + fpw.getPseudoWireName() + "] " + fs.getDisplayString());
        }

        PseudoWireHandler.executeSetFacilityStatus(fpw, fs, getUserName());

        fpw.renew();
        if (fpw.isPipe()) {
            PortDto ac1 = fpw.getAc1();
            PortDto ac2 = fpw.getAc2();
            PseudoWire pwModel1 = PseudoWireModelCreator.createModel(fpw, null, inventoryId, ac1, ac2);
            result.add((PseudoWire) new PseudoWireModelDisplayNameConverter().convertModel(pwModel1));
            PseudoWire pwModel2 = PseudoWireModelCreator.createModel(fpw, null, inventoryId, ac2, ac1);
            result.add((PseudoWire) new PseudoWireModelDisplayNameConverter().convertModel(pwModel2));
        } else {
            PseudowireDto pw = fpw.getPseudowireDto();
            for (RsvpLspDto lsp : pw.getRsvpLsps()) {
                log.debug("result.add(: id[" + inventoryId + "/" + RsvpLspRenderer.getLspName(lsp) + "]");
                PortDto acOnIngress = PseudoWireHandler.getAcOnIngress(pw, lsp);
                PortDto acOnEgress = PseudoWireHandler.getAcOnEgress(pw, lsp);
                PseudoWire pwModel = PseudoWireModelCreator.createModel(fpw, lsp, inventoryId, acOnIngress, acOnEgress);
                result.add((PseudoWire) new PseudoWireModelDisplayNameConverter().convertModel(pwModel));
            }
        }
    }

    return result;
}
 
Example 42
Project: openNaEF   File: VplsHandler.java   Source Code and License 5 votes vote down vote up
public static List<Vpls> getList(ObjectFilterQuery query) throws NotBoundException, AuthenticationException, IOException, ExternalServiceException {
    List<Vpls> vplsList = new ArrayList<Vpls>();

    for (VplsIfDto vpls : filterVplses(query, VplsExtUtil.getVplsIfDtos())) {
        vplsList.add(VplsModelCreator.createModel(vpls, InventoryIdUtil.getInventoryId(vpls)));
    }

    return vplsList;
}
 
Example 43
Project: openNaEF   File: RsvpLspRefresher.java   Source Code and License 5 votes vote down vote up
@Override
public List<? extends IModel> refresh() throws RemoteException, ExternalServiceException, IOException, AuthenticationException, NotBoundException, InstantiationException, IllegalAccessException {
    List<LabelSwitchedPath> result = new ArrayList<LabelSwitchedPath>();

    List<String> inventoryIds = new ArrayList<String>();
    for (IModel target : getTargets()) {
        inventoryIds.add(target.getId());
    }
    for (String inventoryId : inventoryIds) {
        LabelSwitchedPath lspModel = RsvpLspModelCreator.createModel(RsvpLspHandler.getRsvpLspDto(inventoryId), inventoryId);
        result.add((LabelSwitchedPath) new RsvpLspModelDisplayNameConverter().convertModel(lspModel));
    }

    return result;
}
 
Example 44
Project: openNaEF   File: LinkRefresher.java   Source Code and License 5 votes vote down vote up
@Override
public List<? extends IModel> refresh() throws RemoteException, InventoryException, ExternalServiceException, IOException, AuthenticationException, NotBoundException, InstantiationException, IllegalAccessException {
    List<PhysicalLink> result = new ArrayList<PhysicalLink>();

    List<String> inventoryIds = new ArrayList<String>();
    for (IModel target : getTargets()) {
        inventoryIds.add(target.getId());
    }
    for (String inventoryId : inventoryIds) {
        PhysicalLink linkModel = LinkModelCreator.createModel(L2LinkHandler.getLinkDto(inventoryId), inventoryId);
        result.add((PhysicalLink) new LinkModelDisplayNameConverter().convertModel(linkModel));
    }

    return result;
}
 
Example 45
Project: openNaEF   File: VrfFacilityStatusUpdater.java   Source Code and License 5 votes vote down vote up
@Override
public List<? extends IModel> update() throws AuthenticationException,
        RemoteException, IOException, InventoryException,
        ExternalServiceException, InstantiationException,
        IllegalAccessException, NotBoundException {
    List<Vrf> result = new ArrayList<Vrf>();

    Map<String, FacilityStatus> newStatus = getNewStatus(getTargets());

    List<String> updated = new ArrayList<String>();
    for (Entry<String, FacilityStatus> entry : newStatus.entrySet()) {
        FacilityStatus fs = entry.getValue();

        String inventoryId = entry.getKey();
        if (updated.contains(inventoryId)) {
            continue;
        }

        VrfIfDto vrf = VrfHandler.getVrfIfDto(inventoryId);

        if (vrf != null && !FacilityStatusUtil.isAllowableChangeByGUI(vrf, fs)) {
            throw new IllegalStateException("cannot change: VRF=[" + VrfRenderer.getVpnId(vrf)
                    + "] " + fs.getDisplayString());
        }

        VrfHandler.executeSetFacilityStatus(VrfHandler.getVrfIfDto(inventoryId), fs, getUserName());
        updated.add(inventoryId);

        Vrf vrfModel = VrfModelCreator.createModel(vrf, inventoryId);
        result.add((Vrf) new VrfModelDisplayNameConverter().convertModel(vrfModel));
    }

    return result;
}
 
Example 46
Project: openNaEF   File: PortRefresher.java   Source Code and License 5 votes vote down vote up
@Override
public List<? extends IModel> refresh() throws RemoteException, ExternalServiceException, IOException, AuthenticationException, NotBoundException, InstantiationException, IllegalAccessException {
    List<PhysicalEthernetPort> result = new ArrayList<PhysicalEthernetPort>();

    List<String> inventoryIds = new ArrayList<String>();
    for (IModel target : getTargets()) {
        inventoryIds.add(target.getId());
    }
    for (String inventoryId : inventoryIds) {
        PhysicalEthernetPort portModel = PortModelCreator.createModel(PortHandler.getPortDto(inventoryId), inventoryId);
        result.add((PhysicalEthernetPort) new PortModelDisplayNameConverter().convertModel(portModel));
    }

    return result;
}
 
Example 47
Project: openNaEF   File: PseudoWireRefresher.java   Source Code and License 5 votes vote down vote up
@Override
public List<? extends IModel> refresh() throws RemoteException, ExternalServiceException, IOException, AuthenticationException, NotBoundException, InstantiationException, IllegalAccessException {
    List<PseudoWire> result = new ArrayList<PseudoWire>();

    List<String> inventoryIds = new ArrayList<String>();
    for (IModel target : getTargets()) {
        inventoryIds.add(target.getId());
    }
    for (String inventoryId : inventoryIds) {
        FakePseudoWire fpw = PseudoWireHandler.getPseudowireDto(inventoryId);
        if (fpw.isPipe()) {
            PortDto ac1 = fpw.getAc1();
            PortDto ac2 = fpw.getAc2();
            PseudoWire pwModel1 = PseudoWireModelCreator.createModel(fpw, null, inventoryId, ac1, ac2);
            result.add((PseudoWire) new PseudoWireModelDisplayNameConverter().convertModel(pwModel1));
            PseudoWire pwModel2 = PseudoWireModelCreator.createModel(fpw, null, inventoryId, ac2, ac1);
            result.add((PseudoWire) new PseudoWireModelDisplayNameConverter().convertModel(pwModel2));
        } else {
            PseudowireDto pw = fpw.getPseudowireDto();
            for (RsvpLspDto lsp : RsvpLspUtil.getLspsUnder(pw)) {
                if (PseudoWireHandler.getInventoryIdOnLsp(pw, lsp).equals(inventoryId)) {
                    PortDto acOnIngress = PseudoWireHandler.getAcOnIngress(pw, lsp);
                    PortDto acOnEgress = PseudoWireHandler.getAcOnEgress(pw, lsp);
                    PseudoWire pwModel = PseudoWireModelCreator.createModel(fpw, lsp, inventoryId, acOnIngress, acOnEgress);
                    result.add((PseudoWire) new PseudoWireModelDisplayNameConverter().convertModel(pwModel));
                }
            }
        }
    }

    return result;
}
 
Example 48
Project: openNaEF   File: VplsFacilityStatusUpdater.java   Source Code and License 5 votes vote down vote up
@Override
public List<? extends IModel> update() throws AuthenticationException,
        RemoteException, IOException, InventoryException,
        ExternalServiceException, InstantiationException,
        IllegalAccessException, NotBoundException {
    List<Vpls> result = new ArrayList<Vpls>();

    Map<String, FacilityStatus> newStatus = getNewStatus(getTargets());

    List<String> updated = new ArrayList<String>();
    for (Entry<String, FacilityStatus> entry : newStatus.entrySet()) {
        FacilityStatus fs = entry.getValue();

        String inventoryId = entry.getKey();
        if (updated.contains(inventoryId)) {
            continue;
        }

        VplsIfDto vpls = VplsHandler.getVplsIfDto(inventoryId);

        if (vpls != null && !FacilityStatusUtil.isAllowableChangeByGUI(vpls, fs)) {
            throw new IllegalStateException("cannot change: VPLS=[" + VplsRenderer.getVplsId(vpls)
                    + "] " + fs.getDisplayString());
        }

        VplsHandler.executeSetFacilityStatus(VplsHandler.getVplsIfDto(inventoryId), fs, getUserName());
        updated.add(inventoryId);

        Vpls vplsModel = VplsModelCreator.createModel(vpls, inventoryId);
        result.add((Vpls) new VplsModelDisplayNameConverter().convertModel(vplsModel));
    }

    return result;
}
 
Example 49
Project: openNaEF   File: PseudoWireHandler.java   Source Code and License 5 votes vote down vote up
public static List<PseudoWire> getListOnPort(String portInventoryId) throws AuthenticationException,
        NotBoundException, IOException, ExternalServiceException {
    LinkedHashSet<FakePseudoWire> pws = new LinkedHashSet<FakePseudoWire>();
    for (RsvpLspDto lsp : RsvpLspHandler.getLspDtosOnPort(portInventoryId)) {
        pws.addAll(getPseudoWiresOn(lsp));
    }

    List<PseudoWire> pwList = new ArrayList<PseudoWire>();
    appendPwList(pwList, pws);
    return pwList;
}
 
Example 50
Project: openNaEF   File: VrfListViewMaker.java   Source Code and License 5 votes vote down vote up
@Override
public TableInput makeListView() throws RemoteException,
        AuthenticationException, InventoryException, ExternalServiceException, IOException,
        NotBoundException, InstantiationException, IllegalAccessException, ParseException {
    List<? extends IModel> vrfList = new ArrayList<IModel>();

    if (hasInventoryIdAsKeyInQuery()) {
        String inventoryId = getInventoryIdFromQuery();
        switch (CommonHandler.getObjectType(inventoryId)) {
            case node:
                vrfList = VrfHandler.getListOnNode(inventoryId);
                break;
            case port:
                vrfList = VrfHandler.getListOnPort(inventoryId);
                break;
            case vrf:
                vrfList = VrfHandler.get(inventoryId);
                break;
            default:
                break;
        }
    } else {
        vrfList = VrfHandler.getList(getQuery());
    }

    return getConverter().convertList(vrfList);
}
 
Example 51
Project: openNaEF   File: SubnetListViewMaker.java   Source Code and License 5 votes vote down vote up
@Override
public TableInput makeListView() throws RemoteException,
        AuthenticationException, InventoryException,
        ExternalServiceException, IOException, NotBoundException,
        InstantiationException, IllegalAccessException, ParseException {

    List<? extends IModel> subnetList = new ArrayList<IModel>();
    if (hasInventoryIdAsKeyInQuery()) {
        subnetList = SubnetHandler.getList(getMvoIdFromQuery());
    } else {
        subnetList = SubnetHandler.getList(getQuery());
    }

    return getConverter().convertList(subnetList);
}
 
Example 52
Project: openNaEF   File: PseudoWireListViewMaker.java   Source Code and License 5 votes vote down vote up
@Override
public TableInput makeListView() throws NotBoundException, InstantiationException, IllegalAccessException,
        AuthenticationException, IOException, InventoryException, ExternalServiceException {
    List<? extends IModel> pwList = new ArrayList<IModel>();

    if (hasInventoryIdAsKeyInQuery()) {
        String inventoryId = getInventoryIdFromQuery();
        switch (CommonHandler.getObjectType(inventoryId)) {
            case node:
                pwList = PseudoWireHandler.getListOnNode(inventoryId);
                break;
            case port:
                pwList = PseudoWireHandler.getListOnPort(inventoryId);
                break;
            case link:
                pwList = PseudoWireHandler.getListOnLink(inventoryId);
                break;
            case lsp:
                pwList = PseudoWireHandler.getListUpperLsp(inventoryId);
                break;
            case pseudoWire:
                pwList = PseudoWireHandler.get(inventoryId);
                break;
            default:
                break;
        }
    } else {
        pwList = PseudoWireHandler.getList(getQuery());
    }

    return getConverter().convertList(pwList);
}
 
Example 53
Project: openNaEF   File: NodeHandler.java   Source Code and License 5 votes vote down vote up
public static List<Device> getList(ObjectFilterQuery query) throws AuthenticationException, RemoteException, NotBoundException, IOException, ExternalServiceException {
    List<Device> nodeList = new ArrayList<Device>();
    for (NodeDto node : filterNodes(query, MplsNmsInventoryConnector.getInstance().getActiveNodes())) {
        nodeList.add(NodeModelCreator.createModel(node, InventoryIdUtil.getInventoryId(node)));
    }
    return nodeList;
}
 
Example 54
Project: openNaEF   File: CustomerInfoListViewMaker.java   Source Code and License 5 votes vote down vote up
@Override
public TableInput makeListView() throws RemoteException,
        AuthenticationException, InventoryException,
        ExternalServiceException, IOException, NotBoundException,
        InstantiationException, IllegalAccessException, ParseException {

    List<? extends IModel> result = new ArrayList<IModel>();

    if (hasMvoIdAsKeyInQuery()) {
        result = CustomerInfoHandler.getList(getMvoIdFromQuery());
    } else {
        result = CustomerInfoHandler.getList(getQuery());
    }
    return getConverter().convertList(result);
}
 
Example 55
Project: openNaEF   File: NodeListViewMaker.java   Source Code and License 5 votes vote down vote up
@Override
public TableInput makeListView() throws RemoteException, AuthenticationException, InventoryException, ExternalServiceException, IOException, NotBoundException, InstantiationException, IllegalAccessException {
    List<? extends IModel> nodeList = new ArrayList<IModel>();

    if (hasInventoryIdAsKeyInQuery()) {
        String inventoryId = getInventoryIdFromQuery();
        switch (CommonHandler.getObjectType(inventoryId)) {
            case node:
                nodeList = NodeHandler.get(inventoryId);
                break;
            case port:
                break;
            case link:
                break;
            case lsp:
                nodeList = NodeHandler.get(RsvpLspHandler.parseNodeId(inventoryId));
                break;
            case pseudoWire:
                nodeList = NodeHandler.get(PseudoWireHandler.parseNodeId(inventoryId));
                break;
            default:
                break;
        }
    } else {
        nodeList = NodeHandler.getList(getQuery());
    }

    return getConverter().convertList(nodeList);
}
 
Example 56
Project: openNaEF   File: LinkListViewMaker.java   Source Code and License 5 votes vote down vote up
@Override
public TableInput makeListView() throws AuthenticationException, RemoteException, MalformedURLException, NotBoundException, IOException, InventoryException, ExternalServiceException, InstantiationException, IllegalAccessException {
    List<? extends IModel> linkList = new ArrayList<IModel>();

    if (hasInventoryIdAsKeyInQuery()) {
        String inventoryId = getInventoryIdFromQuery();
        switch (CommonHandler.getObjectType(inventoryId)) {
            case node:
                break;
            case port:
                break;
            case link:
                linkList = LinkHandler.get(inventoryId);
                break;
            case lsp:
                break;
            case pseudoWire:
                break;
            default:
                break;
        }
    } else {
        linkList = LinkHandler.getList(getQuery());
    }

    return getConverter().convertList(linkList);
}
 
Example 57
Project: openNaEF   File: VlanListViewMaker.java   Source Code and License 5 votes vote down vote up
@Override
public TableInput makeListView() throws RemoteException,
        AuthenticationException, InventoryException,
        ExternalServiceException, IOException, NotBoundException,
        InstantiationException, IllegalAccessException, ParseException {
    List<? extends IModel> vlanList = new ArrayList<IModel>();
    if (hasMvoIdAsKeyInQuery()) {
        vlanList = VlanHandler.getList(getMvoIdFromQuery());
    } else {
        vlanList = VlanHandler.getList(getQuery());
    }

    return getConverter().convertList(vlanList);
}
 
Example 58
Project: openNaEF   File: L2LinkHandler.java   Source Code and License 5 votes vote down vote up
public static List<PhysicalLink> getList(ObjectFilterQuery query) throws NotBoundException, AuthenticationException, IOException, ExternalServiceException {
    List<PhysicalLink> linkList = new ArrayList<PhysicalLink>();
    List<LinkDto> links = L2LinkUtil.getAllL2Links();
    log.debug("l2links: " + links.size());
    for (LinkDto link : filterLinks(query, links)) {
        linkList.add(LinkModelCreator.createModel(link, InventoryIdCalculator.getId(link)));
    }
    return linkList;
}
 
Example 59
Project: openNaEF   File: NaefConnector.java   Source Code and License 5 votes vote down vote up
public NaefRmiServiceFacade getConnection() throws RemoteException {
    if(_ap != null) {
        return _ap.getServiceFacade();
    }
    try {
        String naefRmiPort = System.getProperty("naef-rmi-port", "38100");
        String naefServerAddr = "rmi://localhost:" + naefRmiPort + "/mplsnms";

        _ap = (NaefRmiServiceAccessPoint) Naming.lookup(naefServerAddr);
    } catch (NotBoundException | MalformedURLException e) {
        e.printStackTrace();
    }
    return _ap.getServiceFacade();
}
 
Example 60
Project: openNaEF   File: LinkTopologyViewMaker.java   Source Code and License 5 votes vote down vote up
@Override
public IDiagram makeTopologyView() throws RemoteException, AuthenticationException, ExternalServiceException, IOException, NotBoundException, InstantiationException, IllegalAccessException {
    IDiagram diagram = null;

    if (isQueryContainsInventoryIdAsKey()) {
        String inventoryId = getInventoryIdFromQuery();
        diagram = new LinkDiagramBuilder().build(inventoryId);
    }

    return convertDiagram(diagram);
}