Refine search
Context ctx = NamingManager.getURLContext(scheme, environment); if (ctx == null) { throw new NamingException("scheme " + scheme + " not recognized"); Object obj = bindings.get(first); if (obj == null) { throw new NameNotFoundException(name); } else if (obj instanceof Context && path.size() > 1) { Context subContext = (Context) obj; throw e; } catch (Exception e) { throw (NamingException) new NamingException("could not look up : " + name).initCause(e);
Context ctx = NamingManager.getURLContext(scheme, environment); if (ctx == null) { throw new NamingException("scheme " + scheme + " not recognized"); Object obj = bindings.get(first); if (obj == null) { throw new NameNotFoundException(name); } else if (obj instanceof Context && path.size() > 1) { Context subContext = (Context)obj; throw e; } catch (Exception e) { throw (NamingException)new NamingException("could not look up : " + name).initCause(e);
ne = new NameNotFoundException(); ne = new ContextNotEmptyException(); } else { ne = new NamingException();
Context ctx = NamingManager.getURLContext(scheme, environment); if (ctx == null) { throw new NamingException("scheme " + scheme + " not recognized"); Object obj = bindings.get(first); if (obj == null) { throw new NameNotFoundException(name); } else if (obj instanceof Context && path.size() > 1) { Context subContext = (Context) obj; throw e; } catch (Exception e) { throw (NamingException) new NamingException("could not look up : " + name).initCause(e);
@Override public Object getContent() throws NamingException { ServiceReference ref = null; try { ServiceReference[] refs = bundleContext.getServiceReferences(ResourceSource.class.getName(), query); if (refs == null || refs.length == 0) { throw new NameNotFoundException("could not locate osgi service matching " + query); } ref = refs[0]; @SuppressWarnings("unchecked") ResourceSource<E> source = (ResourceSource<E>) bundleContext.getService(ref); return source.$getResource(); } catch (Throwable e) { throw (NamingException) new NamingException("Could not create resource").initCause(e); } finally { if (ref != null) { bundleContext.ungetService(ref); } } }
/** * Binds a new name to the object bound to an old name, and unbinds the * old name. Both names are relative to this context. Any attributes * associated with the old name become associated with the new name. * Intermediate contexts of the old name are not changed. * * @param oldName the name of the existing binding; may not be empty * @param newName the name of the new binding; may not be empty * @exception NameAlreadyBoundException if newName is already bound * @exception NamingException if a naming exception is encountered */ @Override public void rename(String oldName, String newName) throws NamingException { File file = file(oldName); if (file == null) throw new NameNotFoundException (sm.getString("resources.notFound", oldName)); File newFile = new File(base, newName); if (!file.renameTo(newFile)) { throw new NamingException(sm.getString("resources.renameFail", oldName, newName)); } }
/** * Binds a new name to the object bound to an old name, and unbinds the * old name. Both names are relative to this context. Any attributes * associated with the old name become associated with the new name. * Intermediate contexts of the old name are not changed. * * @param oldName the name of the existing binding; may not be empty * @param newName the name of the new binding; may not be empty * @exception NameAlreadyBoundException if newName is already bound * @exception NamingException if a naming exception is encountered */ @Override public void rename(String oldName, String newName) throws NamingException { File file = file(oldName); if (file == null) throw new NameNotFoundException (sm.getString("resources.notFound", oldName)); File newFile = new File(base, newName); if (!file.renameTo(newFile)) { throw new NamingException(sm.getString("resources.renameFail", oldName, newName)); } }
/** * Unbinds the named object. Removes the terminal atomic name in name * from the target context--that named by all but the terminal atomic * part of name. * <p> * This method is idempotent. It succeeds even if the terminal atomic * name is not bound in the target context, but throws * NameNotFoundException if any of the intermediate contexts do not exist. * * @param name the name to bind; may not be empty * @exception NameNotFoundException if an intermediate context does not * exist * @exception NamingException if a naming exception is encountered */ @Override public void unbind(String name) throws NamingException { File file = file(name); if (file == null) throw new NameNotFoundException( sm.getString("resources.notFound", name)); if (!file.delete()) throw new NamingException (sm.getString("resources.unbindFailed", name)); }
/** * Unbinds the named object. Removes the terminal atomic name in name * from the target context--that named by all but the terminal atomic * part of name. * <p> * This method is idempotent. It succeeds even if the terminal atomic * name is not bound in the target context, but throws * NameNotFoundException if any of the intermediate contexts do not exist. * * @param name the name to bind; may not be empty * @exception NameNotFoundException if an intermediate context does not * exist * @exception NamingException if a naming exception is encountered */ @Override public void unbind(String name) throws NamingException { File file = file(name); if (file == null) throw new NameNotFoundException( sm.getString("resources.notFound", name)); if (!file.delete()) throw new NamingException (sm.getString("resources.unbindFailed", name)); }
/** * Unbinds the named object. Removes the terminal atomic name in name * from the target context--that named by all but the terminal atomic * part of name. * <p> * This method is idempotent. It succeeds even if the terminal atomic * name is not bound in the target context, but throws * NameNotFoundException if any of the intermediate contexts do not exist. * * @param name the name to bind; may not be empty * @exception NameNotFoundException if an intermediate context does not * exist * @exception NamingException if a naming exception is encountered */ @Override public void unbind(String name) throws NamingException { File file = file(name); if (file == null) throw new NameNotFoundException( sm.getString("resources.notFound", name)); if (!file.delete()) throw new NamingException (sm.getString("resources.unbindFailed", name)); }
/** * Unbinds the named object. Removes the terminal atomic name in name * from the target context--that named by all but the terminal atomic * part of name. * <p> * This method is idempotent. It succeeds even if the terminal atomic * name is not bound in the target context, but throws * NameNotFoundException if any of the intermediate contexts do not exist. * * @param name the name to bind; may not be empty * @exception NameNotFoundException if an intermediate context does not * exist * @exception NamingException if a naming exception is encountered */ @Override public void unbind(String name) throws NamingException { File file = file(name); if (file == null) throw new NameNotFoundException( sm.getString("resources.notFound", name)); if (!file.delete()) throw new NamingException (sm.getString("resources.unbindFailed", name)); }
/** * Unbinds the named object. Removes the terminal atomic name in name * from the target context--that named by all but the terminal atomic * part of name. * <p> * This method is idempotent. It succeeds even if the terminal atomic * name is not bound in the target context, but throws * NameNotFoundException if any of the intermediate contexts do not exist. * * @param name the name to bind; may not be empty * @exception NameNotFoundException if an intermediate context does not * exist * @exception NamingException if a naming exception is encountered */ @Override public void unbind(String name) throws NamingException { File file = file(name); if (file == null) throw new NameNotFoundException( sm.getString("resources.notFound", name)); if (!file.delete()) throw new NamingException (sm.getString("resources.unbindFailed", name)); }
public void unbind(String name) throws NamingException { checkName(name); Registry registry = getRegistry(); try { registry.unbind(toRMIName(name)); } catch (NotBoundException ex) { throw new NameNotFoundException(name + " not found in RMI registry " + registry); } catch (RemoteException ex) { throw new NamingException("Remote exception: " + ex.getMessage()); } }
public void unbind(String name) throws NamingException { checkName(name); Registry registry = getRegistry(); try { registry.unbind(toRMIName(name)); } catch (NotBoundException ex) { throw new NameNotFoundException(name + " not found in RMI registry " + registry); } catch (RemoteException ex) { throw new NamingException("Remote exception: " + ex.getMessage()); } }
private Object lookup(final String name, final ServiceName lookupName, boolean dereference) throws NamingException { final ServiceController<?> controller = serviceRegistry.getService(lookupName); final Object object; if (controller != null) { try { object = controller.getValue(); } catch (IllegalStateException e) { //occurs if the service is not actually up throw new NameNotFoundException("Error looking up " + name + ", service " + lookupName + " is not started"); } } else { return null; } if (dereference && object instanceof ManagedReferenceFactory) { try { return ManagedReferenceFactory.class.cast(object).getReference().getInstance(); } catch (Exception e) { NamingException n = new NamingException(e.getMessage()); n.initCause(e); throw n; } } return object; }
public void unbind(String name) throws NamingException { if (TraceCarol.isDebugJndiCarol()) TraceCarol.debugJndiCarol("unbind(" + name + ")"); if (name.equals("")) { throw new InvalidNameException("Cannot unbind empty name"); } try { reg.unbind(name); } catch (java.rmi.RemoteException e) { throw new NamingException(e.toString()); } catch (java.rmi.NotBoundException e) { throw new NameNotFoundException(e.toString()); } }
public Object lookup(String name) throws NamingException { checkName(name); name = toRMIName(name); if (name.length() == 0) { return new RMIContext(environment); } Registry registry = getRegistry(); try { return registry.lookup(name); } catch (NotBoundException ex) { throw new NameNotFoundException(name + " not found in RMI registry " + registry); } catch (RemoteException ex) { throw new NamingException("Remote exception: " + ex.getMessage()); } }
public Object lookup(String name) throws NamingException { checkName(name); name = toRMIName(name); if (name.length() == 0) { return new RMIContext(environment); } Registry registry = getRegistry(); try { return registry.lookup(name); } catch (NotBoundException ex) { throw new NameNotFoundException(name + " not found in RMI registry " + registry); } catch (RemoteException ex) { throw new NamingException("Remote exception: " + ex.getMessage()); } }
public void unbind(Name name) throws NamingException { String attrName = getRelativeName(name); FileObject fo = dobj.getPrimaryFile(); if (fo.getAttribute(attrName) == null) { NamingException ne = new NameNotFoundException(); ne.setResolvedName(name); throw ne; } try { fo.setAttribute(attrName, null); } catch (IOException ex) { NamingException ne = new NamingException(); // NOI18N ne.setResolvedName(name); ne.setRootCause(ex); } }
throw new NameNotFoundException (sm.getString("namingContext.nameNotBound", name, name.get(0))); throw new NamingException (sm.getString("namingContext.contextExpected"));