/** Update single parent to child relationship. * @param parent The parent of the child. * @param oldChild The previous value of the child. If this is non null and differs from <code>child</code>, then a remove event is generated. * @param child The current child. If this is non null and differs from <code>oldChild</code>, then an add event is generated. * @param relationship The name of the relationship * @param addRemoveBean If true add/remove is called for the new/old children as well as the relationships */ public synchronized void update(Object parent, Object oldChild, final Object child, String relationship,boolean addRemove) { if (oldChild!=null && !oldChild.equals(child)) { remove(parent,oldChild,relationship); if (addRemove) removeBean(oldChild); } if (child!=null && !child.equals(oldChild)) { if (addRemove) addBean(child); add(parent,child,relationship); } }
/** Update multiple parent to child relationship. * @param parent The parent of the child. * @param oldChildren The previous array of children. A remove event is generated for any child in this array but not in the <code>children</code> array. * This array is modified and children that remain in the new children array are nulled out of the old children array. * @param children The current array of children. An add event is generated for any child in this array but not in the <code>oldChildren</code> array. * @param relationship The name of the relationship */ public synchronized void update(Object parent, Object[] oldChildren, final Object[] children, String relationship) { update(parent,oldChildren,children,relationship,false); }
/** Update single parent to child relationship. * @param parent The parent of the child. * @param oldChild The previous value of the child. If this is non null and differs from <code>child</code>, then a remove event is generated. * @param child The current child. If this is non null and differs from <code>oldChild</code>, then an add event is generated. * @param relationship The name of the relationship */ public synchronized void update(Object parent, Object oldChild, final Object child, String relationship) { if (oldChild!=null && !oldChild.equals(child)) remove(parent,oldChild,relationship); if (child!=null && !child.equals(oldChild)) add(parent,child,relationship); }
public void setServer(Server server) { Server old_server=_server; if (old_server!=null && old_server!=server) old_server.getContainer().removeBean(this); _server=server; if (_server!=null && _server!=old_server) _server.getContainer().addBean(this); }
/** * Remove a LifeCycle object to be started/stopped * along with the Server * @param c */ public void removeLifeCycle (LifeCycle c) { if (c == null) return; _dependentLifeCycles.remove(c); _container.removeBean(c); }
/** * Add a LifeCycle object to be started/stopped * along with the Server. * @param c */ public void addLifeCycle (LifeCycle c) { if (c == null) return; if (!_dependentLifeCycles.contains(c)) { _dependentLifeCycles.add(c); _container.addBean(c); } try { if (isStarted()) ((LifeCycle)c).start(); } catch (Exception e) { throw new RuntimeException (e); } }
server.getContainer().addEventListener(mBeanContainer); mBeanContainer.start();
public void destroy() { if (!isStopped()) throw new IllegalStateException("!STOPPED"); if (_server!=null) _server.getContainer().removeBean(this); }
_scanner.scan(); _scanner.start(); _contexts.getServer().getContainer().addBean(_scanner);
/** * @param threadPool The threadPool to set. */ public void setThreadPool(ThreadPool threadPool) { _container.update(this,_threadPool,threadPool, "threadpool",true); _threadPool = threadPool; }
remove(parent,oldChildren[i],relationship); if (addRemove) removeBean(oldChildren[i]); addBean(newChildren[i]); add(parent,newChildren[i],relationship);
/** * @param sessionIdManager The sessionIdManager to set. */ public void setSessionIdManager(SessionIdManager sessionIdManager) { _container.update(this,_sessionIdManager,sessionIdManager, "sessionIdManager",true); _sessionIdManager = sessionIdManager; }
/** * @param realms Map of realm name to UserRealm instances. */ public void setUserRealms(UserRealm[] realms) { _container.update(this,_realms,realms, "realm",true); _realms=realms; }
/** Set the connectors for this server. * Each connector has this server set as it's ThreadPool and its Handler. * @param connectors The connectors to set. */ public void setConnectors(Connector[] connectors) { if (connectors!=null) { for (int i=0;i<connectors.length;i++) connectors[i].setServer(this); } _container.update(this, _connectors, connectors, "connector"); _connectors = connectors; }
public void setServer(Server server) { Server old_server=getServer(); if (old_server!=null && old_server!=server) old_server.getContainer().update(this, _sessionManager, null, "sessionManager",true); super.setServer(server); if (server!=null && server!=old_server) server.getContainer().update(this, null,_sessionManager, "sessionManager",true); }
public void setServer(Server server) { if (getServer()!=null && getServer()!=server) { getServer().getContainer().update(this, _filters, null, "filter",true); getServer().getContainer().update(this, _filterMappings, null, "filterMapping",true); getServer().getContainer().update(this, _servlets, null, "servlet",true); getServer().getContainer().update(this, _servletMappings, null, "servletMapping",true); } if (server!=null && getServer()!=server) { server.getContainer().update(this, null, _filters, "filter",true); server.getContainer().update(this, null, _filterMappings, "filterMapping",true); server.getContainer().update(this, null, _servlets, "servlet",true); server.getContainer().update(this, null, _servletMappings, "servletMapping",true); } super.setServer(server); }
public void setServer(Server server) { if (_errorHandler!=null) { Server old_server=getServer(); if (old_server!=null && old_server!=server) old_server.getContainer().update(this, _errorHandler, null, "error",true); super.setServer(server); if (server!=null && server!=old_server) server.getContainer().update(this, null, _errorHandler, "error",true); _errorHandler.setServer(server); } else super.setServer(server); }
/** Set Servlets. * @param holders Array of servletsto define */ public synchronized void setServlets(ServletHolder[] holders) { if (getServer()!=null) getServer().getContainer().update(this,_servlets,holders,"servlet",true); _servlets=holders; updateNameMappings(); }
/** * @param filterMappings The filterMappings to set. */ public void setFilterMappings(FilterMapping[] filterMappings) { if (getServer()!=null) getServer().getContainer().update(this,_filterMappings,filterMappings,"filterMapping",true); _filterMappings = filterMappings; updateMappings(); }
public synchronized void setFilters(FilterHolder[] holders) { if (getServer()!=null) getServer().getContainer().update(this,_filters,holders,"filter",true); _filters=holders; updateNameMappings(); }