Refine search
public static <T extends ConfigBeanProxy> T getParent(ConfigBeanProxy self, Class<T> c) { Dom dom = Dom.unwrap(self); if (dom.parent()!=null) { return dom.parent().createProxy(c); } else { return null; } }
/** * Creates a strongly-typed proxy to access values in this {@link Dom} object, */ public <T extends ConfigBeanProxy> T createProxy() { return createProxy(this.<T>getProxyType()); }
public void element_setIndexItems(Dom dom, org.glassfish.admingui.connector.IndexItem target) { List<Dom> v1 = dom.nodeElements("indexitem"); if (v1 == null) { return ; } List v2 = new ArrayList<org.glassfish.admingui.connector.IndexItem>(v1 .size()); for (Dom v3 : v1) { v2 .add(((org.glassfish.admingui.connector.IndexItem) v3 .get())); } target.setIndexItems(v2); }
public void testHabitatFromDom() { SimpleConnector sc = habitat.getService(SimpleConnector.class); EjbContainerAvailability ejb = sc.getEjbContainerAvailability(); Dom ejbDom = Dom.unwrap(ejb); assert(ejbDom.getHabitat() != null); }
@Override public Object get(Dom dom, Type returnType) { String id = dom.leafElement(xmlName); Class<?> type = Types.erasure(returnType); // let's look first the fast way. Object candidate = dom.getHabitat().getService(type, id); if (candidate!=null) { return type.cast(candidate); } dom = dom.getSymbolSpaceRoot(id); return type.cast(dom.resolveReference(id,type.getName()).get()); }
/* package */ @SuppressWarnings({ "unchecked" }) void register() { ServiceLocator locator = getServiceLocator(); ActiveDescriptor<?> myselfReified = locator.reifyDescriptor(this); DynamicConfigurationService dcs = locator.getService(DynamicConfigurationService.class); DynamicConfiguration dc = dcs.createDynamicConfiguration(); getImplementation(), new HashSet<Annotation>()); domDesc.setLoader(loader); domDescriptor = dc.addActiveDescriptor(domDesc, false); String key = getKey(); for (String contract : model.contracts) { ActiveDescriptor<Dom> alias = new AliasDescriptor<Dom>(locator, domDescriptor, contract, key); serviceHandle = getHabitat().getServiceHandle(domDescriptor);
public void testDom() { SimpleConnector sc = habitat.getService(SimpleConnector.class); EjbContainerAvailability ejb = sc.getEjbContainerAvailability(); assert(Dom.class.isAssignableFrom(Dom.unwrap(ejb).getClass()) && ConfigBeanProxy.class.isAssignableFrom(ejb.getClass())); }
return invokeDuckMethod(method,proxy,args); ? getServiceLocator().getService(ConfigExtensionHandler.class, cem.value()) : getServiceLocator().getService(ConfigExtensionHandler.class)); return invokeConfigExtensionMethod(handler, this, model.getProxyType(), args); return getter(p, method.getGenericReturnType()); } else { throw new PropertyVetoException("Instance of " + getImplementation() + " named '" + getKey() + "' is not locked for writing when invoking method " + method.getName() + " you must use transaction semantics to access it.", null);
Dom dom = Dom.unwrap(child); writeableParent.setter(element, dom.<ConfigBeanProxy>createProxy(), childType); applyProperties(writeableChild, attributes); dom.addDefaultChildren(); dom.register();
public static ThreadPool findThreadPool(NetworkListener listener) { final NetworkListeners listeners = listener.getParent(); List<ThreadPool> list = listeners.getThreadPool(); if (list == null || list.isEmpty()) { final ConfigBeanProxy parent = listener.getParent().getParent().getParent(); final Dom proxy = Dom.unwrap(parent).element("thread-pools"); final List<Dom> domList = proxy.nodeElements("thread-pool"); list = new ArrayList<ThreadPool>(domList.size()); for (Dom dom : domList) { list.add(dom.<ThreadPool>createProxy()); } } for (ThreadPool pool : list) { if (listener.getThreadPool().equals(pool.getName())) { return pool; } } return null; }
public void transactionCommited(List<PropertyChangeEvent> changes) { if (!isGlassFishDocumentChanged(changes)) { return; } for (ConfigurationPersistence pers : habitat.<ConfigurationPersistence>getAllServices(ConfigurationPersistence.class)) { try { if (doc.getRoot().getProxyType().equals(Domain.class)) { Dom domainRoot = doc.getRoot(); domainRoot.attribute("version", Version.getBuildVersion()); } pers.save(doc); } catch (IOException e) { logger.log(Level.SEVERE, ConfigApiLoggerInfo.glassFishDocumentIOException,e); } catch (XMLStreamException e) { logger.log(Level.SEVERE, ConfigApiLoggerInfo.glassFishDocumentXmlException,e); } } }
public Object run(ConfigBeanProxy param) { PropertyBag bag = (PropertyBag) param; final List<Property> propertyList = new ArrayList<Property>(bag.getProperty()); setProperty(target, attribute, getValue(propertyList, property)); final String message = MessageFormat.format("Moved {0}.property.{1} to {0}.{2}", Dom.convertName(Dom.unwrap(target).getProxyType().getSimpleName()), property, Dom.convertName(attribute)); report(context, message); bag.getProperty().clear(); bag.getProperty().addAll(propertyList); return param; } }, target);
Dom thisview = Dom.unwrap(defaultView); Dom parent = thisview.parent(); ? parent.domNodeByTypeElements(thisview.getProxyType()) : new ArrayList<Dom>(); String siblingKey = sibling.getKey(); if (newValue.equals(siblingKey)) { bean.getLock().unlock();
Dom cbo = Dom.unwrap((ConfigBeanProxy) o); String cboKey = cbo.model.key; if(cboKey != null && key.equals(cboKey.substring(1))){ value = cbo.attribute(key); Dom parent = Dom.unwrap(readView); throw new IllegalArgumentException("A " + master.getProxyType().getSimpleName() + " with the same key \"" + keyValue + "\" already exists in " + parent.getProxyType().getSimpleName() + " " + parent.getKey()) ;
/** * Replaces an existing {@link NodeChild} with another one. * * @see #insertAfter(Dom, String, Dom) */ public synchronized void replaceChild(Dom reference, String name, Dom newNode) { ListIterator<Child> itr = children.listIterator(); while(itr.hasNext()) { Child child = itr.next(); if (child instanceof NodeChild) { NodeChild nc = (NodeChild) child; if(nc.dom==reference) { reference.release(); newNode.domDescriptor = addWithAlias(getHabitat(), newNode,newNode.getProxyType(), newNode.getKey()); itr.set(new NodeChild(name,newNode)); return; } } } throw new IllegalArgumentException(reference+" is not a valid child of "+this+". Children="+children); }
@Override public Object run(ConfigBeanProxy parent) throws PropertyVetoException, TransactionFailure { U child = parent.createChild(childElement); Dom unwrappedChild = Dom.unwrap(child); unwrappedChild.addDefaultChildren(); configModularityUtils.getExtensions(parent).add(child); return child; } }, extensionOwner);
public static Class<? extends ConfigBeanProxy> getElementTypeByName(ConfigBeanProxy parent, String elementName) throws ClassNotFoundException { final Dom parentDom = Dom.unwrap(parent); DomDocument document = parentDom.document; ConfigModel.Property a = parentDom.model.elements.get(elementName); if (a!=null) { if (a.isLeaf()) { // dochez : I am not too sure, but that should be a String @Element return null; } else { ConfigModel childModel = ((ConfigModel.Node) a).model; return (Class<? extends ConfigBeanProxy>) childModel.classLoaderHolder.loadClass(childModel.targetTypeName); } } // global lookup ConfigModel model = document.getModelByElementName(elementName); if (model!=null) { return (Class<? extends ConfigBeanProxy>) model.classLoaderHolder.loadClass(model.targetTypeName); } return null; }
for (PropertyChangeEvent event : job.mEvents) { final Dom dom = (Dom) ((ConfigView) Proxy.getInvocationHandler(event.getSource())).getMasterView(); configListeners.addAll(dom.getListeners()); if (dom.parent()!=null) { configListeners.addAll(dom.parent().getListeners()); Set<ConfigListener> listeners = typeListeners.get(dom.getProxyType()); if (listeners!=null) { configListeners.addAll(listeners); Object oldValue = event.getOldValue(); if (oldValue instanceof ConfigBeanProxy) { Dom domOldValue = Dom.unwrap((ConfigBeanProxy) oldValue); Set<ConfigListener> typedListeners = typeListeners.get(domOldValue.<ConfigBeanProxy>getProxyType()); if (typedListeners!=null) { configListeners.addAll(typedListeners);