incubator-aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From z..@apache.org
Subject svn commit: r1029102 [3/5] - in /incubator/aries/trunk/samples-sandbox/dgoat: ./ dgoat-api/ dgoat-api/src/ dgoat-api/src/main/ dgoat-api/src/main/java/ dgoat-api/src/main/java/org/ dgoat-api/src/main/java/org/apache/ dgoat-api/src/main/java/org/apache/...
Date Sat, 30 Oct 2010 15:42:41 GMT
Added: incubator/aries/trunk/samples-sandbox/dgoat/dgoat-info-enhancer/src/main/java/org/apache/aries/samples/goat/enhancer/ModelInfoEnhancerService.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/samples-sandbox/dgoat/dgoat-info-enhancer/src/main/java/org/apache/aries/samples/goat/enhancer/ModelInfoEnhancerService.java?rev=1029102&view=auto
==============================================================================
--- incubator/aries/trunk/samples-sandbox/dgoat/dgoat-info-enhancer/src/main/java/org/apache/aries/samples/goat/enhancer/ModelInfoEnhancerService.java (added)
+++ incubator/aries/trunk/samples-sandbox/dgoat/dgoat-info-enhancer/src/main/java/org/apache/aries/samples/goat/enhancer/ModelInfoEnhancerService.java Sat Oct 30 15:42:36 2010
@@ -0,0 +1,339 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.aries.samples.goat.enhancer;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.aries.samples.goat.api.ComponentInfo;
+import org.apache.aries.samples.goat.api.ComponentInfoProvider;
+import org.apache.aries.samples.goat.api.ModelInfoService;
+import org.apache.aries.samples.goat.api.RelationshipInfo;
+import org.apache.aries.samples.goat.api.RelationshipInfoProvider;
+
+import org.apache.aries.samples.goat.info.ComponentInfoImpl;
+import org.apache.aries.samples.goat.info.RelationshipInfoImpl;
+
+public class ModelInfoEnhancerService implements ModelInfoService,
+		ComponentInfoProvider, RelationshipInfoProvider,
+		ComponentInfoProvider.ComponentInfoListener,
+		RelationshipInfoProvider.RelationshipInfoListener {
+
+	private static final String SERVICE_REGISTRATION = "Service registration";
+
+	private static final String SERVICE_USAGE = "Service usage";
+
+	// TODO where should we expose these shared strings?
+	private static final String SERVICE = "Service";
+
+	private ModelInfoService originalService;
+
+	private final Map<String, ComponentInfo> components = new HashMap<String, ComponentInfo>();
+	private final Map<String, RelationshipInfo> relationships = new HashMap<String, RelationshipInfo>();
+
+	private final List<ComponentInfoListener> clisteners;
+	private final List<RelationshipInfoListener> rlisteners;
+
+	public ModelInfoEnhancerService(ModelInfoService infoService) {
+
+		clisteners = Collections
+				.synchronizedList(new ArrayList<ComponentInfoListener>());
+		rlisteners = Collections
+				.synchronizedList(new ArrayList<RelationshipInfoListener>());
+
+		this.originalService = infoService;
+		Collection<ComponentInfo> originalComponents = originalService
+				.getComponentInfoProvider().getComponents();
+		// We keep all the original components
+		for (ComponentInfo info : originalComponents) {
+			components.put(info.getId(), info);
+		}
+		// We add a new component for each service
+		Collection<RelationshipInfo> originalRelationships = originalService
+				.getRelationshipInfoProvider().getRelationships();
+		// We keep all the original components
+		for (RelationshipInfo rel : originalRelationships) {
+
+			if (SERVICE.equals(rel.getType())) {
+				ComponentInfoImpl serviceComponent = new ComponentInfoImpl();
+				String id = constructServiceComponentId(rel);
+				serviceComponent.setId(id);
+				Map<String, String> componentProperties = new HashMap<String, String>();
+				componentProperties.put("Name", rel.getName());
+				serviceComponent.setComponentProperties(componentProperties);
+
+				components.put(id, serviceComponent);
+
+				// Make new relationships;
+
+				RelationshipInfoImpl registration = new RelationshipInfoImpl();
+				registration.setType(SERVICE_REGISTRATION);
+				registration.setName(rel.getName());
+				registration.setProvidedBy(rel.getProvidedBy());
+				registration.setRelationshipAspects(rel
+						.getRelationshipAspects());
+
+				ArrayList<ComponentInfo> arrayList = new ArrayList<ComponentInfo>();
+				arrayList.add(serviceComponent);
+				registration.setConsumedBy(arrayList);
+
+				relationships.put(constructId(registration), registration);
+
+				RelationshipInfoImpl consumption = new RelationshipInfoImpl();
+				consumption.setType(SERVICE_USAGE);
+				consumption.setName(rel.getName());
+				consumption.setProvidedBy(serviceComponent);
+				consumption.setConsumedBy(rel.getConsumedBy());
+				consumption
+						.setRelationshipAspects(rel.getRelationshipAspects());
+
+				relationships.put(constructId(consumption), consumption);
+
+			} else {
+				// Pass non-service relationships through
+				relationships.put(constructId(rel), rel);
+
+			}
+
+			originalService.getComponentInfoProvider()
+					.registerComponentInfoListener(this);
+			originalService.getRelationshipInfoProvider()
+					.registerRelationshipInfoListener(this);
+		}
+
+	}
+
+	@Override
+	public String getName() {
+		return "Model Enhancer Service";
+	}
+
+	@Override
+	public ComponentInfoProvider getComponentInfoProvider() {
+		return this;
+	}
+
+	@Override
+	public RelationshipInfoProvider getRelationshipInfoProvider() {
+		return this;
+	}
+
+	@Override
+	public Collection<RelationshipInfo> getRelationships() {
+		return relationships.values();
+	}
+
+	@Override
+	public Collection<ComponentInfo> getComponents() {
+		return components.values();
+	}
+
+	@Override
+	public ComponentInfo getComponentForId(String id) {
+		return components.get(id);
+	}
+
+	@Override
+	public void registerRelationshipInfoListener(
+			RelationshipInfoListener listener) {
+		rlisteners.add(listener);
+	}
+
+	@Override
+	public void registerComponentInfoListener(ComponentInfoListener listener) {
+		clisteners.add(listener);
+	}
+
+	@Override
+	public void updateRelationship(RelationshipInfo r) {
+		if (SERVICE.equals(r.getType())) {
+			updateSyntheticServiceArtefactsAndNotifyListeners(r);
+		} else {
+			// Update our copy
+			relationships.put(constructId(r), r);
+			// This shouldn't affect us, but pass it on to our listeners
+			for (RelationshipInfoListener listener : rlisteners) {
+				listener.updateRelationship(r);
+			}
+		}
+
+	}
+
+	@Override
+	public void removeRelationship(RelationshipInfo r) {
+
+		if (SERVICE.equals(r.getType())) {
+			removeSyntheticServiceArtefactsAndNotifyListeners(r);
+		} else {
+			// We don't want to track this relationship anymore
+			String id = constructId(r);
+			RelationshipInfo relationship = relationships.get(id);
+			relationships.remove(id);
+			if (relationship != null) {
+				// This shouldn't affect us, but pass it on to our listeners
+				for (RelationshipInfoListener listener : rlisteners) {
+					listener.removeRelationship(relationship);
+				}
+			}
+		}
+
+	}
+
+	@Override
+	public void updateComponent(ComponentInfo b) {
+		// Update our copy
+		components.put(b.getId(), b);
+		// This shouldn't affect us, but pass it on to our listeners
+		for (ComponentInfoListener listener : clisteners) {
+			listener.updateComponent(b);
+		}
+
+	}
+
+	@Override
+	public void removeComponent(ComponentInfo b) {
+		// This shouldn't affect us unless it has relationships pointing to it
+		// Cheerfully assume that gets handled upstream
+
+		// We don't want to know about this component anymore
+		ComponentInfo component = components.remove(b);
+		if (component != null) {// This shouldn't affect us, but pass it on to
+								// our listeners
+			for (ComponentInfoListener listener : clisteners) {
+				listener.removeComponent(component);
+			}
+		}
+
+	}
+
+	private String constructServiceComponentId(RelationshipInfo rel) {
+		return "/syntheticenhancedservices/" + rel.getName() + "/"
+				+ rel.getProvidedBy().getId();
+	}
+
+	private String constructId(RelationshipInfo b) {
+		return b.getType() + "/" + b.getName() + "/"
+				+ b.getProvidedBy().getId();
+	}
+
+	private void removeSyntheticServiceArtefactsAndNotifyListeners(
+			RelationshipInfo r) {
+		// We need to remove our two relationships and the synthetic
+		// component
+
+		String componentId = constructServiceComponentId(r);
+
+		// Do the relationships first
+		// The registration has type "service registration", and the
+		// original provider and name
+		String registrationRelationshipId = SERVICE_REGISTRATION + "/"
+				+ r.getName() + "/" + r.getProvidedBy().getId();
+		RelationshipInfo registrationRelationship = relationships
+				.get(registrationRelationshipId);
+
+		// The consumers have type "service usage", and the
+		// original name, and the new provided by
+
+		String usageRelationshipId = SERVICE_USAGE + "/" + r.getName() + "/"
+				+ componentId;
+		RelationshipInfo usageRelationship = relationships
+				.get(usageRelationshipId);
+
+		relationships.remove(usageRelationshipId);
+		relationships.remove(registrationRelationshipId);
+
+		// Tell our listeners about the relationships first
+
+		for (RelationshipInfoListener listener : rlisteners) {
+			if (usageRelationship != null) {
+				listener.removeRelationship(usageRelationship);
+			}
+			if (registrationRelationship != null) {
+				listener.removeRelationship(registrationRelationship);
+			}
+
+		}
+
+		ComponentInfo component = components.remove(componentId);
+		if (component != null) {
+			// Tell our listeners their service component went away
+			for (ComponentInfoListener listener : clisteners) {
+				listener.removeComponent(component);
+			}
+		}
+	}
+
+	private void updateSyntheticServiceArtefactsAndNotifyListeners(
+			RelationshipInfo r) {
+		// We need to update our two relationships and the synthetic
+		// component
+		// Hopefully the thing which changed won't prevent us
+		// from finding our relationship
+
+		String componentId = constructServiceComponentId(r);
+
+		// Do the relationships first
+		// The registration has type "service registration", and the
+		// original provider and name
+		String registrationRelationshipId = SERVICE_REGISTRATION + "/"
+				+ r.getName() + "/" + r.getProvidedBy().getId();
+		RelationshipInfoImpl registrationRelationship = (RelationshipInfoImpl) relationships
+				.get(registrationRelationshipId);
+		registrationRelationship.setName(r.getName());
+		registrationRelationship.setRelationshipAspects(r
+				.getRelationshipAspects());
+
+		// The consumers have type "service usage", and the
+		// original name, and the new provided by
+
+		String usageRelationshipId = SERVICE_USAGE + "/" + r.getName() + "/"
+				+ componentId;
+		RelationshipInfoImpl usageRelationship = (RelationshipInfoImpl) relationships
+				.get(usageRelationshipId);
+
+		// The consumers may have changed, so we update the usage relationship
+		usageRelationship.setConsumedBy(r.getConsumedBy());
+		usageRelationship.setName(r.getName());
+		usageRelationship.setRelationshipAspects(r.getRelationshipAspects());
+
+		// Tell our listeners about the relationships first
+
+		for (RelationshipInfoListener listener : rlisteners) {
+			if (usageRelationship != null) {
+				listener.updateRelationship(usageRelationship);
+			}
+			if (registrationRelationship != null) {
+				listener.updateRelationship(registrationRelationship);
+			}
+
+		}
+
+		ComponentInfo component = components.get(componentId);
+		if (component != null) {
+			// Tell our listeners their service component was updated
+			for (ComponentInfoListener listener : clisteners) {
+				listener.updateComponent(component);
+			}
+		}
+	}
+}

Added: incubator/aries/trunk/samples-sandbox/dgoat/dgoat-info-enhancer/src/main/java/org/apache/aries/samples/goat/enhancer/ServiceInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/samples-sandbox/dgoat/dgoat-info-enhancer/src/main/java/org/apache/aries/samples/goat/enhancer/ServiceInterceptor.java?rev=1029102&view=auto
==============================================================================
--- incubator/aries/trunk/samples-sandbox/dgoat/dgoat-info-enhancer/src/main/java/org/apache/aries/samples/goat/enhancer/ServiceInterceptor.java (added)
+++ incubator/aries/trunk/samples-sandbox/dgoat/dgoat-info-enhancer/src/main/java/org/apache/aries/samples/goat/enhancer/ServiceInterceptor.java Sat Oct 30 15:42:36 2010
@@ -0,0 +1,131 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.aries.samples.goat.enhancer;
+
+import java.util.Dictionary;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.Map;
+
+import org.apache.aries.samples.goat.api.ModelInfoService;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceEvent;
+import org.osgi.framework.ServiceListener;
+import org.osgi.framework.ServiceReference;
+import org.osgi.framework.ServiceRegistration;
+
+public class ServiceInterceptor implements ServiceListener {
+
+	private static final String DISPLAY_NAME = "displayName";
+	/**
+   * 
+   */
+	public static final String SERVICE_ID = "service.id";
+	private final BundleContext ctx;
+	private final Map<String, ServiceRegistration> registrations = new HashMap<String, ServiceRegistration>();
+
+	public ServiceInterceptor(BundleContext ctx) {
+		this.ctx = ctx;
+		// Check all the existing services
+		try {
+			// Handle any existing services
+			ServiceReference[] references = ctx.getAllServiceReferences(
+					ModelInfoService.class.getName(), null);
+
+
+			ctx.addServiceListener(this, "(objectclass='"
+						+ ModelInfoService.class.getName() + "')");
+
+			//If we found any service references...
+			if(references != null && references.length != 0) {
+				for (ServiceReference reference : references) {
+					registerServiceEnhancer(reference);
+				}
+			}
+
+
+		} catch (InvalidSyntaxException e) {
+			e.printStackTrace();
+		}
+		// We could listen for find events and mask the original services if we
+		// wanted to
+		// ServiceRegistration findRegistration =
+		// ctx.registerService(FindHook.class.getName(),
+		// new InterceptorFindHook(), null);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.osgi.framework.ServiceListener#serviceChanged(org.osgi.framework.
+	 * ServiceEvent)
+	 */
+	@Override
+	public void serviceChanged(ServiceEvent event) {
+		ServiceReference reference = event.getServiceReference();
+		if (event != null && event.getType() == ServiceEvent.REGISTERED) {
+			registerServiceEnhancer(reference);
+
+		} else if (event != null
+				&& event.getType() == ServiceEvent.UNREGISTERING) {
+			// Better unregister our enhancer
+			Object id = reference.getProperty(SERVICE_ID);
+			ServiceRegistration registration = registrations.get(id);
+			if (registration != null) {
+				registration.unregister();
+				registrations.remove(id);
+			}
+		}
+
+	}
+
+	@SuppressWarnings({ "rawtypes", "unchecked" })
+	private void registerServiceEnhancer(ServiceReference reference) {
+		Object actualService = ctx.getService(reference);
+
+		if (actualService instanceof ModelInfoService) {
+			ModelInfoService infoService = (ModelInfoService) actualService;
+			Object serviceId = reference.getProperty(SERVICE_ID);
+			Object enhancer = new ModelInfoEnhancerService(infoService);
+			Dictionary properties = new Hashtable();
+			Object originalDisplayName = reference.getProperty(DISPLAY_NAME);
+			properties.put(DISPLAY_NAME, originalDisplayName + " [enhanced]");
+			ServiceRegistration registration = ctx.registerService(
+					ModelInfoService.class.getName(), enhancer, properties);
+			registrations.put(serviceId + "", registration);
+		} else {
+			System.out.println("Oh dear - unexpected service "
+					+ actualService.getClass());
+		}
+	}
+
+	/**
+   * 
+   */
+	public void stop() {
+		for (ServiceRegistration registration : registrations.values()) {
+			registration.unregister();
+		}
+
+	}
+
+}

Added: incubator/aries/trunk/samples-sandbox/dgoat/dgoat-info-enhancer/src/main/resources/OSGI-INF/cxf/intents/intent-map.xml
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/samples-sandbox/dgoat/dgoat-info-enhancer/src/main/resources/OSGI-INF/cxf/intents/intent-map.xml?rev=1029102&view=auto
==============================================================================
--- incubator/aries/trunk/samples-sandbox/dgoat/dgoat-info-enhancer/src/main/resources/OSGI-INF/cxf/intents/intent-map.xml (added)
+++ incubator/aries/trunk/samples-sandbox/dgoat/dgoat-info-enhancer/src/main/resources/OSGI-INF/cxf/intents/intent-map.xml Sat Oct 30 15:42:36 2010
@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements. See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership. The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License. You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied. See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:p="http://cxf.apache.org/policy"
+       xmlns:wsp="http://www.w3.org/ns/ws-policy"
+       xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
+       xmlns:http="http://cxf.apache.org/transports/http/configuration"
+       xmlns:wsrm-policy="http://schemas.xmlsoap.org/ws/2005/02/rm/policy"
+       xsi:schemaLocation="
+       http://cxf.apache.org/policy http://cxf.apache.org/schemas/policy.xsd
+       http://www.w3.org/ns/ws-policy http://www.w3.org/2007/02/ws-policy.xsd
+       http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schemas/configuration/http-conf.xsd
+       http://schemas.xmlsoap.org/ws/2005/02/rm/policy http://schemas.xmlsoap.org/ws/2005/02/rm/wsrm-policy.xsd
+       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
+
+    <bean id="intentMap" class="org.apache.cxf.dosgi.dsw.qos.IntentMap">
+       <property name="intents">
+         <map>
+           <entry key="reliability" value-ref="reliableMessaging"/>
+           <entry key="decoupled" value-ref="decoupledAddressing"/>
+         </map>
+       </property>
+    </bean>
+
+    <p:policies id="reliableMessaging">
+        <wsp:PolicyReference URI="#ReliabilityPolicy"/>
+        <wsp:PolicyReference URI="#DecoupledPolicy"/>
+        <wsp:PolicyReference URI="#AddressingPolicy"/>
+    </p:policies>
+
+    <p:policies id="decoupledAddressing">
+        <wsp:PolicyReference URI="#DecoupledPolicy"/>
+        <wsp:PolicyReference URI="#AddressingPolicy"/>
+    </p:policies>
+
+    <wsp:Policy wsu:Id="ReliabilityPolicy">
+        <wsrm-policy:RMAssertion>
+            <wsrm-policy:BaseRetransmissionInterval Milliseconds="4000"/>
+            <wsrm-policy:AcknowledgementInterval Milliseconds="2000" />
+        </wsrm-policy:RMAssertion>
+    </wsp:Policy>
+
+    <wsp:Policy wsu:Id="DecoupledPolicy">
+        <wsp:ExactlyOne>
+            <http:client DecoupledEndpoint="http://localhost:9970/decoupled_endpoint"/>
+        </wsp:ExactlyOne>
+    </wsp:Policy>
+
+    <wsp:Policy wsu:Id="AddressingPolicy"
+        xmlns:wsam="http://www.w3.org/2007/02/addressing/metadata">
+        <wsam:Addressing>
+            <wsp:Policy />
+        </wsam:Addressing>
+    </wsp:Policy>
+
+</beans>

Added: incubator/aries/trunk/samples-sandbox/dgoat/dgoat-info-enhancer/src/main/resources/OSGI-INF/remote-services.xml
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/samples-sandbox/dgoat/dgoat-info-enhancer/src/main/resources/OSGI-INF/remote-services.xml?rev=1029102&view=auto
==============================================================================
--- incubator/aries/trunk/samples-sandbox/dgoat/dgoat-info-enhancer/src/main/resources/OSGI-INF/remote-services.xml (added)
+++ incubator/aries/trunk/samples-sandbox/dgoat/dgoat-info-enhancer/src/main/resources/OSGI-INF/remote-services.xml Sat Oct 30 15:42:36 2010
@@ -0,0 +1,14 @@
+<endpoint-descriptions xmlns="http://www.osgi.org/xmlns/rsa/v1.0.0">
+  <endpoint-description>
+    <property name="objectClass">
+      <array>
+        <value>org.apache.aries.samples.goat.api.ModelInfoService</value>
+        <!--<value>org.apache.aries.samples.goat.bundleContextModel.BundleContextInfoProvider</value>-->
+      </array>
+    </property>
+    <property name="endpoint.id">http://localhost:9090/bundlectx</property>
+    <property name="service.imported.configs">org.apache.cxf.ws</property>
+  </endpoint-description>
+</endpoint-descriptions>
+
+

Added: incubator/aries/trunk/samples-sandbox/dgoat/dgoat-server-bindings/pom.xml
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/samples-sandbox/dgoat/dgoat-server-bindings/pom.xml?rev=1029102&view=auto
==============================================================================
--- incubator/aries/trunk/samples-sandbox/dgoat/dgoat-server-bindings/pom.xml (added)
+++ incubator/aries/trunk/samples-sandbox/dgoat/dgoat-server-bindings/pom.xml Sat Oct 30 15:42:36 2010
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+    
+       http://www.apache.org/licenses/LICENSE-2.0
+    
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.aries.samples.dgoat</groupId>
+        <artifactId>dgoat</artifactId>
+        <version>0.3-incubating-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>org.apache.aries.samples.dgoat.serverBindings</artifactId>
+    <name>Apache Aries GOAT SCA server bindings</name>
+    <packaging>bundle</packaging>
+
+	<build>
+		<plugins>
+			<plugin>
+				<groupId>org.apache.felix</groupId>
+				<artifactId>maven-bundle-plugin</artifactId>
+				<configuration>
+					<instructions>
+						<Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
+						<SCA-Configuration>OSGI-INF/sca-config/scaconfig.xml</SCA-Configuration>
+					</instructions>
+				</configuration>
+			</plugin>
+		</plugins>
+	</build>
+
+</project>
+

Added: incubator/aries/trunk/samples-sandbox/dgoat/dgoat-server-bindings/src/main/resources/OSGI-INF/sca-config/scaconfig.xml
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/samples-sandbox/dgoat/dgoat-server-bindings/src/main/resources/OSGI-INF/sca-config/scaconfig.xml?rev=1029102&view=auto
==============================================================================
--- incubator/aries/trunk/samples-sandbox/dgoat/dgoat-server-bindings/src/main/resources/OSGI-INF/sca-config/scaconfig.xml (added)
+++ incubator/aries/trunk/samples-sandbox/dgoat/dgoat-server-bindings/src/main/resources/OSGI-INF/sca-config/scaconfig.xml Sat Oct 30 15:42:36 2010
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<scact:sca-config targetNamespace="http://api.goat.samples.aries.apache.org/"
+	xmlns:sca="http://docs.oasis-open.org/ns/opencsa/sca/200912"
+	xmlns:scact="http://www.osgi.org/xmlns/scact/v1.0.0" xmlns:xml="http://www.w3.org/XML/1998/namespace"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://www.osgi.org/xmlns/scact/v1.0.0 http://www.osgi.org/xmlns/scact/v1.0.0 ">
+	<sca:binding.ws name="bundleCtxProvider" uri="http://localhost:8081/bundlecontext" />
+</scact:sca-config>

Added: incubator/aries/trunk/samples-sandbox/dgoat/dgoat-web/pom.xml
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/samples-sandbox/dgoat/dgoat-web/pom.xml?rev=1029102&view=auto
==============================================================================
--- incubator/aries/trunk/samples-sandbox/dgoat/dgoat-web/pom.xml (added)
+++ incubator/aries/trunk/samples-sandbox/dgoat/dgoat-web/pom.xml Sat Oct 30 15:42:36 2010
@@ -0,0 +1,149 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+    
+       http://www.apache.org/licenses/LICENSE-2.0
+    
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.aries.samples.dgoat</groupId>
+        <artifactId>dgoat</artifactId>
+        <version>0.3-incubating-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>org.apache.aries.samples.dgoat.web</artifactId>
+    <name>Apache Aries GOAT web bundle </name>
+    <packaging>bundle</packaging>
+
+
+	<dependencies>
+		<dependency>
+			<groupId>org.eclipse</groupId>
+			<artifactId>osgi</artifactId>
+		</dependency>
+        <dependency>
+			<groupId>org.apache.felix</groupId>
+			<artifactId>javax.servlet</artifactId>
+			<version>1.0.0</version>
+		</dependency>
+		<dependency>
+			<groupId>org.directwebremoting</groupId>
+			<artifactId>dwr</artifactId>
+			<version>3.0.0.109.dev-SNAPSHOT</version>
+			<scope>provided</scope>
+			<optional>true</optional>
+		</dependency>
+        <dependency>
+			<groupId>org.apache.aries.application</groupId>
+			<artifactId>org.apache.aries.application.utils</artifactId>
+		</dependency>
+        <dependency>
+			<groupId>org.apache.aries.samples.dgoat</groupId>
+			<artifactId>org.apache.aries.samples.dgoat.api</artifactId>
+		</dependency>
+	</dependencies>
+
+    
+	<build>
+		<plugins>
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-dependency-plugin</artifactId>
+				<executions>
+					<execution>
+						<id>unpack dojo</id>
+						<phase>generate-sources</phase>
+						<goals>
+							<goal>unpack</goal>
+						</goals>
+						<configuration>
+							<artifactItems>
+								<artifactItem>
+									<groupId>org.dojotoolkit</groupId>
+									<artifactId>dojo</artifactId>
+									<version>1.4.2</version>
+									<type>zip</type>
+								</artifactItem>
+							</artifactItems>
+							<outputDirectory>${project.build.directory}/dojo</outputDirectory>
+						</configuration>
+					</execution>
+				</executions>
+			</plugin>
+			<plugin>
+				<groupId>org.apache.felix</groupId>
+				<artifactId>maven-bundle-plugin</artifactId>
+				<configuration>
+					<instructions>
+						<Bundle-ClassPath>.,WEB-INF/lib</Bundle-ClassPath>
+						<Include-Resource>{maven-resources},target/dojo/dojo-1.4.2</Include-Resource>
+						<Web-ContextPath>/</Web-ContextPath>
+						<Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
+						<Private-Package>org.apache.aries.samples.goat.web.*</Private-Package>
+						<Import-Package>
+							org.apache.aries.samples.goat.info,
+							javax.imageio,
+							javax.jms;resolution:=optional, 
+							javax.servlet,
+							javax.servlet.http,
+							javax.sql,
+							javax.swing.event,
+							javax.xml.parsers,
+							javax.xml.transform,
+							javax.xml.transform.dom,
+							javax.xml.transform.stream,
+							org.w3c.dom,
+							org.xml.sax,
+							net.sf.hibernate;resolution:=optional,
+							nu.xom;resolution:=optional,
+							org.aopalliance.intercept;resolution:=optional,
+							org.apache.bsf;resolution:=optional,
+							org.apache.catalina;resolution:=optional,
+							org.apache.commons.fileupload;resolution:=optional,
+							org.apache.commons.fileupload.disk;resolution:=optional,
+							org.apache.commons.fileupload.servlet;resolution:=optional,
+							org.apache.commons.logging;resolution:=optional,
+							org.apache.struts.action;resolution:=optional,
+							org.apache.struts.config;resolution:=optional,
+							org.apache.struts.util;resolution:=optional,
+							org.apache.xmlbeans;resolution:=optional,
+							org.dom4j*;resolution:=optional,
+							org.hibernate*;resolution:=optional,
+							org.jdom*;resolution:=optional,
+							org.mortbay*;resolution:=optional,
+							org.mozilla*;resolution:=optional,
+							org.springframework*;resolution:=optional,
+							com.google.inject*;resolution:=optional,
+							com.yahoo.platform.yui.compressor;resolution:=optional,
+							dojox.cometd;resolution:=optional,
+							*
+						</Import-Package>
+						<Embed-Dependency>dwr</Embed-Dependency>
+						<Embed-Directory>WEB-INF/lib</Embed-Directory>
+					</instructions>
+				</configuration>
+			</plugin>
+		</plugins>
+	</build>
+
+	<repositories>
+		<repository>
+			<id>dwr-snapshots</id>
+			<name>DWR SNAPSHOT Repository</name>
+			<url>http://download.directwebremoting.org/maven2-snapshot/</url>
+		</repository>
+	</repositories>
+</project>

Added: incubator/aries/trunk/samples-sandbox/dgoat/dgoat-web/src/main/java/org/apache/aries/samples/goat/web/ServerSideClass.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/samples-sandbox/dgoat/dgoat-web/src/main/java/org/apache/aries/samples/goat/web/ServerSideClass.java?rev=1029102&view=auto
==============================================================================
--- incubator/aries/trunk/samples-sandbox/dgoat/dgoat-web/src/main/java/org/apache/aries/samples/goat/web/ServerSideClass.java (added)
+++ incubator/aries/trunk/samples-sandbox/dgoat/dgoat-web/src/main/java/org/apache/aries/samples/goat/web/ServerSideClass.java Sat Oct 30 15:42:36 2010
@@ -0,0 +1,284 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.aries.samples.goat.web;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.servlet.ServletContext;
+
+import org.apache.aries.samples.goat.info.ComponentInfoImpl;
+import org.apache.aries.samples.goat.info.RelationshipInfoImpl;
+
+import org.apache.aries.samples.goat.api.ComponentInfo;
+import org.apache.aries.samples.goat.api.ComponentInfoProvider;
+import org.apache.aries.samples.goat.api.ModelInfoService;
+import org.apache.aries.samples.goat.api.RelationshipInfo;
+import org.apache.aries.samples.goat.api.RelationshipInfoProvider;
+
+import org.directwebremoting.Browser;
+import org.directwebremoting.ScriptBuffer;
+import org.directwebremoting.ScriptSession;
+import org.directwebremoting.ServerContextFactory;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceReference;
+
+public class ServerSideClass {
+
+	private String modelInfoServiceHint = "";
+
+	private ModelInfoService ModelInfoService = null;
+
+	private Map<ModelInfoService, ComponentInfoProvider.ComponentInfoListener> clisteners = new HashMap<ModelInfoService, ComponentInfoProvider.ComponentInfoListener>();
+	private Map<ModelInfoService, RelationshipInfoProvider.RelationshipInfoListener> rlisteners = new HashMap<ModelInfoService, RelationshipInfoProvider.RelationshipInfoListener>();
+
+	private class ComponentInfoListenerImpl implements
+			ComponentInfoProvider.ComponentInfoListener {
+		String server;
+
+		public ComponentInfoListenerImpl(String server) {
+			this.server = server;
+		}
+
+		public void updateComponent(ComponentInfo b) {
+			if (this.server.equals(modelInfoServiceHint)) {
+				// todo: only issue the add for the new bundle, and affected
+				// other bundles.
+				//getInitialComponents(modelInfoServiceHint);
+				//System.out.println("State is: " + b.getComponentProperties().get("State"));
+				addFunctionCall("addComponent", b);
+			}
+		}
+
+		public void removeComponent(ComponentInfo b) {
+			// todo
+		}
+	}
+	private class RelationshipInfoListenerImpl implements
+			RelationshipInfoProvider.RelationshipInfoListener {
+		String server;
+
+		public RelationshipInfoListenerImpl(String server) {
+			this.server = server;
+		}
+
+		public void updateRelationship(RelationshipInfo r) {
+			if (this.server.equals(modelInfoServiceHint)) {
+				addFunctionCall("addRelationship", r);
+			}
+		}
+
+		public void removeRelationship(RelationshipInfo r) {
+			// todo
+		}
+	}
+
+	public ServerSideClass() {
+		System.err.println("SSC Built!");
+
+	}
+
+	@SuppressWarnings("unused")
+	private String bundleStateToString(int bundleState) {
+		switch (bundleState) {
+		case Bundle.UNINSTALLED:
+			return "UNINSTALLED";
+		case Bundle.INSTALLED:
+			return "INSTALLED";
+		case Bundle.RESOLVED:
+			return "RESOLVED";
+		case Bundle.STARTING:
+			return "STARTING";
+		case Bundle.STOPPING:
+			return "STOPPING";
+		case Bundle.ACTIVE:
+			return "ACTIVE";
+		default:
+			return "UNKNOWN[" + bundleState + "]";
+		}
+	}
+
+	/**
+	 * this is invoked by a page onload.. so until it's invoked.. we dont care
+	 * about components
+	 */
+	public void getInitialComponents(String dataProvider) {
+
+		System.err.println("GET INITIAL BUNDLES ASKED TO USE DATAPROVIDER "
+				+ dataProvider);
+
+		if (dataProvider == null)
+			throw new IllegalArgumentException(
+					"Unable to accept 'null' as a dataProvider");
+
+		// do we need to update?
+		if (!this.modelInfoServiceHint.equals(dataProvider)) {
+
+			this.modelInfoServiceHint = dataProvider;
+
+			if (!(this.ModelInfoService == null)) {
+				// we already had a provider.. we need to shut down the existing
+				// components & relationships in the browsers..
+				addFunctionCall("forgetAboutEverything");
+			}
+
+			ServletContext context = org.directwebremoting.ServerContextFactory
+					.get().getServletContext();
+			Object o = context.getAttribute("osgi-bundlecontext");
+			if (o != null) {
+				if (o instanceof BundleContext) {
+					BundleContext b_ctx = (BundleContext) o;
+
+					System.err.println("Looking up bcip");
+					try {
+						ServiceReference sr[] = b_ctx.getServiceReferences(
+								ModelInfoService.class.getName(),
+								"(displayName=" + this.modelInfoServiceHint
+										+ ")");
+						if (sr != null) {
+							System.err.println("Getting bcip");
+							this.ModelInfoService = (ModelInfoService) b_ctx
+									.getService(sr[0]);
+							System.err.println("Got bcip "
+									+ this.ModelInfoService);
+						} else {
+							System.err.println("UNABLE TO FIND BCIP!!");
+							System.err.println("UNABLE TO FIND BCIP!!");
+							System.err.println("UNABLE TO FIND BCIP!!");
+						}
+					} catch (InvalidSyntaxException ise) {
+
+					}
+
+					if (this.ModelInfoService != null) {
+						if (!rlisteners.containsKey(this.ModelInfoService)) {
+							RelationshipInfoProvider.RelationshipInfoListener rl = new RelationshipInfoListenerImpl(
+									this.modelInfoServiceHint);
+							rlisteners.put(this.ModelInfoService, rl);
+							this.ModelInfoService.getRelationshipInfoProvider()
+									.registerRelationshipInfoListener(rl);
+						}
+
+						if (!clisteners.containsKey(this.ModelInfoService)) {
+							ComponentInfoProvider.ComponentInfoListener cl = new ComponentInfoListenerImpl(
+									this.modelInfoServiceHint);
+							clisteners.put(this.ModelInfoService, cl);
+							this.ModelInfoService.getComponentInfoProvider()
+									.registerComponentInfoListener(cl);
+						}
+					}
+				}
+			}
+
+		}
+
+		Collection<ComponentInfo> bis = this.ModelInfoService
+				.getComponentInfoProvider().getComponents();
+		System.err.println("Got " + (bis == null ? "null" : bis.size())
+				+ " components back from the provider ");
+		if (bis != null) {
+			for (ComponentInfo b : bis) {
+
+				System.err.println("Adding Component .. " + b.getId());
+
+				addFunctionCall("addComponent", b);
+			}
+		}
+
+		Collection<RelationshipInfo> ris = this.ModelInfoService
+				.getRelationshipInfoProvider().getRelationships();
+		System.err.println("Got " + (ris == null ? "null" : ris.size())
+				+ " relationships back from the provider ");
+		if (ris != null) {
+			for (RelationshipInfo r : ris) {
+				System.err.println("Adding relationship type " + r.getType()
+						+ " called " + r.getName() + " from "
+						+ r.getProvidedBy().getId());
+
+				addFunctionCall("addRelationship", r);
+			}
+		}
+
+	}
+
+	private void addFunctionCall(String name, Object... params) {
+		final ScriptBuffer script = new ScriptBuffer();
+		script.appendScript(name).appendScript("(");
+		for (int i = 0; i < params.length; i++) {
+			if (i != 0)
+				script.appendScript(",");
+			script.appendData(params[i]);
+		}
+		script.appendScript(");");
+		Browser.withAllSessions(new Runnable() {
+			public void run() {
+				for (ScriptSession s : Browser.getTargetSessions()) {
+					s.addScript(script);
+				}
+			}
+		});
+	}
+
+	public String[] getProviders() {
+		System.err.println("Getting providers...");
+		ArrayList<String> result = new ArrayList<String>();
+		ServletContext context = ServerContextFactory.get().getServletContext();
+		Object o = context.getAttribute("osgi-bundlecontext");
+		if (o != null) {
+			if (o instanceof BundleContext) {
+				BundleContext b_ctx = (BundleContext) o;
+				try {
+					System.err.println("Getting providers [2]...");
+					ServiceReference[] srs = b_ctx.getServiceReferences(
+							ModelInfoService.class.getName(), null);
+					System.err.println("Got.. " + srs);
+					if (srs == null || srs.length == 0) {
+						System.err.println("NO DATA PROVIDERS");
+						throw new RuntimeException(
+								"Unable to find any data providers");
+					}
+					System.err.println("Processing srs as loop.");
+					for (ServiceReference sr : srs) {
+						System.err.println("Processing srs entry...");
+
+						String name = (String.valueOf(sr
+								.getProperty("displayName")));
+
+						result.add(name);
+					}
+					System.err.println("Processed srs as loop.");
+				} catch (InvalidSyntaxException e) {
+					// wont happen, the exception relates to the filter, (2nd
+					// arg above), which is constant null.
+				}
+			}
+		}
+		System.err.println("Returning " + result.size());
+		String[] arr = new String[result.size()];
+		arr = result.toArray(arr);
+		for (String x : arr) {
+			System.err.println(" - " + x);
+		}
+		return arr;
+	}
+}

Added: incubator/aries/trunk/samples-sandbox/dgoat/dgoat-web/src/main/resources/WEB-INF/dwr.xml
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/samples-sandbox/dgoat/dgoat-web/src/main/resources/WEB-INF/dwr.xml?rev=1029102&view=auto
==============================================================================
--- incubator/aries/trunk/samples-sandbox/dgoat/dgoat-web/src/main/resources/WEB-INF/dwr.xml (added)
+++ incubator/aries/trunk/samples-sandbox/dgoat/dgoat-web/src/main/resources/WEB-INF/dwr.xml Sat Oct 30 15:42:36 2010
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+<!DOCTYPE dwr PUBLIC "-//GetAhead Limited//DTD Direct Web Remoting 3.0//EN" "http://getahead.org/dwr/dwr30.dtd">
+
+<dwr>
+  <allow>
+    <create creator="new" scope="application">
+      <param name="class" value="org.apache.aries.samples.goat.web.ServerSideClass"/>
+    </create>
+	<convert converter="bean" match="org.apache.aries.samples.goat.info.ComponentInfoImpl" javascript="ComponentInfo"/>          
+	<convert converter="bean" match="org.apache.aries.samples.goat.info.RelationshipInfoImpl" javascript="RelationshipInfo"/> 
+  </allow>
+</dwr>

Added: incubator/aries/trunk/samples-sandbox/dgoat/dgoat-web/src/main/resources/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/samples-sandbox/dgoat/dgoat-web/src/main/resources/WEB-INF/web.xml?rev=1029102&view=auto
==============================================================================
--- incubator/aries/trunk/samples-sandbox/dgoat/dgoat-web/src/main/resources/WEB-INF/web.xml (added)
+++ incubator/aries/trunk/samples-sandbox/dgoat/dgoat-web/src/main/resources/WEB-INF/web.xml Sat Oct 30 15:42:36 2010
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
+  <display-name>GOAT</display-name>
+  <welcome-file-list>
+    <welcome-file>index.html</welcome-file>
+    <welcome-file>index.htm</welcome-file>
+    <welcome-file>index.jsp</welcome-file>
+    <welcome-file>default.html</welcome-file>
+    <welcome-file>default.htm</welcome-file>
+    <welcome-file>default.jsp</welcome-file>
+  </welcome-file-list>
+  
+<servlet>
+  <servlet-name>dwr-invoker</servlet-name>
+  <servlet-class>org.directwebremoting.servlet.DwrServlet</servlet-class>
+   
+    <init-param>
+     <param-name>debug</param-name>
+     <param-value>true</param-value>
+  </init-param>
+  
+  <init-param>
+    <param-name>activeReverseAjaxEnabled</param-name>
+    <param-value>true</param-value>
+  </init-param>
+
+</servlet>
+
+<servlet-mapping>
+  <servlet-name>dwr-invoker</servlet-name>
+  <url-pattern>/dwr/*</url-pattern>
+</servlet-mapping>
+
+</web-app>

Added: incubator/aries/trunk/samples-sandbox/dgoat/dgoat-web/src/main/resources/images/Thumbs.db
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/samples-sandbox/dgoat/dgoat-web/src/main/resources/images/Thumbs.db?rev=1029102&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/aries/trunk/samples-sandbox/dgoat/dgoat-web/src/main/resources/images/Thumbs.db
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/aries/trunk/samples-sandbox/dgoat/dgoat-web/src/main/resources/images/dndCopy.png
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/samples-sandbox/dgoat/dgoat-web/src/main/resources/images/dndCopy.png?rev=1029102&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/aries/trunk/samples-sandbox/dgoat/dgoat-web/src/main/resources/images/dndCopy.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/aries/trunk/samples-sandbox/dgoat/dgoat-web/src/main/resources/images/dndMove.png
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/samples-sandbox/dgoat/dgoat-web/src/main/resources/images/dndMove.png?rev=1029102&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/aries/trunk/samples-sandbox/dgoat/dgoat-web/src/main/resources/images/dndMove.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/aries/trunk/samples-sandbox/dgoat/dgoat-web/src/main/resources/images/dndNoCopy.png
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/samples-sandbox/dgoat/dgoat-web/src/main/resources/images/dndNoCopy.png?rev=1029102&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/aries/trunk/samples-sandbox/dgoat/dgoat-web/src/main/resources/images/dndNoCopy.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/aries/trunk/samples-sandbox/dgoat/dgoat-web/src/main/resources/images/dndNoMove.png
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/samples-sandbox/dgoat/dgoat-web/src/main/resources/images/dndNoMove.png?rev=1029102&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/aries/trunk/samples-sandbox/dgoat/dgoat-web/src/main/resources/images/dndNoMove.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/aries/trunk/samples-sandbox/dgoat/dgoat-web/src/main/resources/images/grid_dx_gradient.gif
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/samples-sandbox/dgoat/dgoat-web/src/main/resources/images/grid_dx_gradient.gif?rev=1029102&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/aries/trunk/samples-sandbox/dgoat/dgoat-web/src/main/resources/images/grid_dx_gradient.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/aries/trunk/samples-sandbox/dgoat/dgoat-web/src/main/resources/images/grid_sort_down.gif
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/samples-sandbox/dgoat/dgoat-web/src/main/resources/images/grid_sort_down.gif?rev=1029102&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/aries/trunk/samples-sandbox/dgoat/dgoat-web/src/main/resources/images/grid_sort_down.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/aries/trunk/samples-sandbox/dgoat/dgoat-web/src/main/resources/images/grid_sort_up.gif
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/samples-sandbox/dgoat/dgoat-web/src/main/resources/images/grid_sort_up.gif?rev=1029102&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/aries/trunk/samples-sandbox/dgoat/dgoat-web/src/main/resources/images/grid_sort_up.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/aries/trunk/samples-sandbox/dgoat/dgoat-web/src/main/resources/images/header.png
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/samples-sandbox/dgoat/dgoat-web/src/main/resources/images/header.png?rev=1029102&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/aries/trunk/samples-sandbox/dgoat/dgoat-web/src/main/resources/images/header.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/aries/trunk/samples-sandbox/dgoat/dgoat-web/src/main/resources/images/header_shadow.png
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/samples-sandbox/dgoat/dgoat-web/src/main/resources/images/header_shadow.png?rev=1029102&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/aries/trunk/samples-sandbox/dgoat/dgoat-web/src/main/resources/images/header_shadow.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/aries/trunk/samples-sandbox/dgoat/dgoat-web/src/main/resources/images/resolved.png
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/samples-sandbox/dgoat/dgoat-web/src/main/resources/images/resolved.png?rev=1029102&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/aries/trunk/samples-sandbox/dgoat/dgoat-web/src/main/resources/images/resolved.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/aries/trunk/samples-sandbox/dgoat/dgoat-web/src/main/resources/images/row_back.png
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/samples-sandbox/dgoat/dgoat-web/src/main/resources/images/row_back.png?rev=1029102&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/aries/trunk/samples-sandbox/dgoat/dgoat-web/src/main/resources/images/row_back.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/aries/trunk/samples-sandbox/dgoat/dgoat-web/src/main/resources/images/running.png
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/samples-sandbox/dgoat/dgoat-web/src/main/resources/images/running.png?rev=1029102&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/aries/trunk/samples-sandbox/dgoat/dgoat-web/src/main/resources/images/running.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/aries/trunk/samples-sandbox/dgoat/dgoat-web/src/main/resources/images/tabEnabled_rotated.png
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/samples-sandbox/dgoat/dgoat-web/src/main/resources/images/tabEnabled_rotated.png?rev=1029102&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/aries/trunk/samples-sandbox/dgoat/dgoat-web/src/main/resources/images/tabEnabled_rotated.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/aries/trunk/samples-sandbox/dgoat/dgoat-web/src/main/resources/images/tabHover_rotated.png
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/samples-sandbox/dgoat/dgoat-web/src/main/resources/images/tabHover_rotated.png?rev=1029102&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/aries/trunk/samples-sandbox/dgoat/dgoat-web/src/main/resources/images/tabHover_rotated.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/aries/trunk/samples-sandbox/dgoat/dgoat-web/src/main/resources/images/td_button_down.png
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/samples-sandbox/dgoat/dgoat-web/src/main/resources/images/td_button_down.png?rev=1029102&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/aries/trunk/samples-sandbox/dgoat/dgoat-web/src/main/resources/images/td_button_down.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/aries/trunk/samples-sandbox/dgoat/dgoat-web/src/main/resources/web/goat/Component.js
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/samples-sandbox/dgoat/dgoat-web/src/main/resources/web/goat/Component.js?rev=1029102&view=auto
==============================================================================
--- incubator/aries/trunk/samples-sandbox/dgoat/dgoat-web/src/main/resources/web/goat/Component.js (added)
+++ incubator/aries/trunk/samples-sandbox/dgoat/dgoat-web/src/main/resources/web/goat/Component.js Sat Oct 30 15:42:36 2010
@@ -0,0 +1,390 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+dojo.provide("goat.Component");
+dojo.require("dojox.gfx");
+dojo.require("dojox.gfx.fx");
+dojo.require("dojox.gfx.Moveable");
+
+dojo.require("goat.elements.ElementBase");
+dojo.require("goat.elements.ElementRegistry");
+dojo.require("goat.elements.ComponentContainer");
+dojo.require("goat.elements.TextComponentProperty");
+dojo.require("goat.RelationshipManager");
+dojo.require("goat.ElementLayoutManager");
+
+dojo.require("goat.configuration.Theme");
+dojo.require("goat.configuration.ComponentAppearance");
+
+// Component,
+// looks after a component shape on the surface.
+//
+dojo.declare("goat.Component", [], {
+
+	// fixed properties.
+
+	/* String */id : null, // must be unique within enclosing component, if
+							// any, or globally if none.
+	/* goat.Component[] */children : null,
+	/* goat.elements.ElementBase[] */elements : null, // gui display elements
+													// within this component,
+													// all must extend
+													// 'goat.elements.ElementBase'
+
+	// manager objects..
+	/* goat.RelationshipManager */relationshipManager : null, // manager for
+															// handling all
+															// relationships
+															// to/from this
+															// component.
+	/* goat.ElementLayoutManager */elementLayoutManager : null, // manager for
+																// arranging
+																// elements
+																// within a
+																// component.
+	/* goat.elements.ElementRegistry */elementRegistry : null, // manager for
+																// returning
+																// appropriate
+																// renderers for
+																// component
+																// elements
+
+	// state.
+	/* boolean */hidden : false, // is component visible on the surface.
+	/* boolean */selected : false, // is mouse currently within our boundary ?
+	/* boolean */refreshing : false, // is a refresh in progress ?
+
+	// gfx objects
+	/* dojox.gfx.Group */group : null,
+	/* dojox.gfx.Surface */surface : null,
+	/* dojox.gfx.Rect */outline : null,
+
+	/* goat.configuration.ComponentAppearance */componentAppearance : null,
+	// dimensions/coords - onsurface positioning.
+	/* int */x : 0,
+	/* int */y : 0,
+	/* int */width : null,
+	/* int */height : null,
+
+	/* int */minWidth : 150,
+	/* int */minHeight : 80,
+
+	constructor : function(/* dojox.gfx.Surface */surface,
+	/* String */id,
+	/* String[] */props,
+	/* goat.Component[] */children, /* goat.configuration */theme) {
+
+		this.surface = surface;
+		this.x = 0;
+		this.y = 0;
+		this.height = 115;
+		this.width = this.minWidth;
+
+	// TODO if we have a parent we should pass through their component
+	// appearance */
+	this.componentAppearance = new goat.configuration.ComponentAppearance(
+			theme, null);
+	// console.log("Adding Box");
+	this.initGfx();
+
+	this.id = id;
+	this.elements = new Array();
+
+	this.children = children;
+	if (this.children != null) {
+		var type = "component.container";
+		var element = this.elementRegistry.getProperty(this.group,
+				this.componentAppearance, type, children);
+		this.elements[type] = element;
+	}
+
+	this.elementRegistry = new goat.elements.ElementRegistry(this, props);
+	this.elementRegistry = this.elementRegistry.getRegistry();
+
+	this.updateProperties(props);
+
+	// console.log("Creating RM");
+	this.relationshipManager = new goat.RelationshipManager(this);
+	// console.log("Creating ELM");
+	this.elementLayoutManager = new goat.ElementLayoutManager(this);
+
+	// console.log("Invoking refresh");
+	this.refresh();
+
+	var mover = new dojox.gfx.Moveable(this.group);
+	dojo.connect(mover, "onMoved", this, "onMoved");
+
+	this.group.connect("onclick", dojo.hitch(this, "onClick"));
+	this.group.connect("onmouseenter", dojo.hitch(this, "onMouseEnter"));
+	this.group.connect("onmouseleave", dojo.hitch(this, "onMouseLeave"));
+
+	dojo.publish("goat.component.create", [ this ]);
+
+	dojo.subscribe("goat.component.refresh", this, this.onRefresh);
+},
+updateProperties : function(props) {
+	// console.log("Processing properties");
+	// console.log(props);
+
+	this.componentProperties = new Array();
+	for ( var key in props) {
+		var value = props[key];
+		// console.log("The fieldname or key is: "+key+" and the value at that
+		// field is: "+value);
+		var type = "component.property." + key;
+		if (this.elements[type] == null) {
+			var element = this.elementRegistry.getProperty(this,
+					this.componentAppearance, type, value);
+			this.elements[type] = element;
+		} else {
+			this.elements[type].update(value);
+		}
+	}
+	// TODO: what about elements in this.elements that were not present in
+	// props,
+	// should they be removed from the this.elements array.. currently elements
+	// dont
+	// support a 'remove' method.
+	// for now, as components dont need removing, wont worry about this.
+
+	// console.log("Properties processed.");
+},
+removeSelf : function() {
+
+	//Remove this component and all the relationship elements attached to it.
+	this.surface.remove(this.group);
+	//Now we remove all other the elements
+	for (var type in this.elements) {
+		console.log("Removing element of type : " + type);
+		this.elements[type].removeSelf();
+		delete this.elements[type];
+	}
+	this.relationshipManager.removeSelf();
+	delete this.RelationshipManager;
+
+	//This one is subscribed to by Relationship
+	dojo.publish("goat.component.delete." + this.id, [ this ]);
+
+	//This one is subscribed to by ComponentStatusGrid
+	dojo.publish("goat.component.delete", [ this ]);
+},
+initGfx : function() {
+	this.group = this.surface.createGroup();
+
+	this.outline = this.group.createRect( {
+		x : 0,
+		y : 0,
+		width : this.width,
+		height : this.height,
+		r : 5
+	}).setStroke( {
+		width : 2,
+		color : this.componentAppearance.getOutlineColor0()
+	})
+
+	if (this.componentAppearance.useLinearShading()) {
+		this.outline.setFill( {
+			type : "linear",
+			x1 : 0,
+			y1 : 0,
+			x2 : 150,
+			y2 : 80,
+			colors : [ {
+				offset : 0,
+				color : this.componentAppearance.getBackgroundColor()
+			}, {
+				offset : 1,
+				color : this.componentAppearance.getBackgroundContrastColor()
+			} ]
+		});
+	} else {
+		this.outline.setFill(this.componentAppearance.getBackgroundColor());
+
+	}
+
+},
+refresh : function() {
+	// console.log(">Component.refresh");
+	this.elementLayoutManager.doLayout();
+
+	// console.log("Sizing box");
+	// not compatible with component shape property!
+	this.outline.setShape( {
+		x : 0,
+		y : 0,
+		width : this.width,
+		height : this.height,
+		r : 5
+	});
+
+	if (this.componentAppearance.useLinearShading()) {
+		this.outline.setFill( {
+			type : "linear",
+			x1 : 0,
+			y1 : 0,
+			x2 : 150,
+			y2 : 80,
+			colors : [ {
+				offset : 0,
+				color : this.componentAppearance.getBackgroundColor()
+			}, {
+				offset : 1,
+				color : this.componentAppearance.getBackgroundContrastColor() 
+			} ]
+		});
+	} else {
+		this.outline.setFill(this.componentAppearance.getBackgroundColor());
+
+	}
+	// console.log("Movng to front");
+	// make sure we can be seen.
+	this.group.moveToFront();
+	// console.log("<Component.refresh");
+},
+update : function(id, props, children) {
+
+	// console.log("Updating "+id+", processing properties array.. ");
+
+	// rebuilds the prop array internally
+	this.updateProperties(props);
+
+	// console.log("Updating "+id+", rebuilding onscreen with new props ");
+	// rebuild the onscreen object with the layout mgr
+	this.refresh();
+
+	// TODO: update children.
+
+	// tells everyone who cares that we just did that.
+	dojo.publish("goat.component.update." + this.id, [ this ]);
+	dojo.publish("goat.component.update", [ this ]);
+},
+moveToNewPlace : function(x, y) {
+	if (!this.hidden) {
+		this.group.setTransform( {
+			dx : x,
+			dy : y
+		});
+	}
+	this.x = x;
+	this.y = y;
+	this.updateAfterMove();
+},
+toggleHidden : function() {
+	var hideMe = !this.hidden;
+	if (hideMe) {
+		// cheat.. move it off canvas..
+	this.group.setTransform( {
+		dx : -1000,
+		dy : -1000
+	});
+} else {
+	// bring it back =) good job we remembered where it was supposed to go !
+	this.group.setTransform( {
+		dx : this.x,
+		dy : this.y
+	});
+}
+
+this.hidden = hideMe;
+dojo.publish("goat.component.hidden", [ this.id, hideMe ]);
+dojo.publish("goat.component.hidden." + this.id, [ this ]);
+},
+onMoved : function(mover, shift) {
+// this may stop working once this.group isnt directly within the surface
+	// (ie once child components are renderable)
+	this.x = this.group.matrix.dx;
+	this.y = this.group.matrix.dy;
+
+	this.updateAfterMove();
+},
+updateAfterMove : function() {
+	dojo.publish("goat.component.move", [ this.id, this.x, this.y ]);
+	dojo.publish("goat.component.move." + this.id, [ this ]);
+},
+pulse : function() {
+	if(this.selected) {
+		var endColor = this.componentAppearance.getOutlineColor1();
+	} else { 
+		var endColor =  this.componentAppearance.getOutlineColor0();
+	}
+	dojox.gfx.fx.animateStroke( {
+		shape : this.outline,
+		duration : 500,
+		color : {
+			start :  this.componentAppearance.getOutlineColor2(),
+			end : endColor
+		},
+		width : {
+			start : 7,
+			end : 2
+		},
+		join : {
+			values : [ "miter", "bevel", "round" ]
+		}
+	}).play();
+},
+glow : function() {
+	if(this.selected) {
+		var endColor =  this.componentAppearance.getOutlineColor1();
+	} else {
+		var endColor =  this.componentAppearance.getOutlineColor0(); 
+	}
+	dojox.gfx.fx.animateStroke( {
+		shape : this.outline,
+		duration : 500,
+		color : {
+			start :  this.componentAppearance.getOutlineColor2(),
+			end : endColor
+		},
+		width : {
+			start : 3,
+			end : 2
+		},
+		join : {
+			values : [ "miter", "bevel", "round" ]
+		}
+	}).play();
+},
+onClick : function() {
+	this.group.moveToFront();
+	this.pulse();
+	dojo.publish("goat.component.onclick." + this.id, [ this ]);
+},
+onMouseEnter : function() {
+	this.outline.setStroke( {
+		width : 3,
+		color :  this.componentAppearance.getOutlineColor1() 
+	});
+	this.selected = true;
+	dojo.publish("goat.component.onenter." + this.id, [ this ]);
+},
+onMouseLeave : function() {
+	this.selected = false;
+	this.glow();
+	dojo.publish("goat.component.onexit." + this.id, [ this ]);
+},
+onRefresh : function() {
+	if (!this.refreshing) {
+		this.refreshing = true;
+		this.refresh();
+		this.refreshing = false;
+	}
+},
+getComponentAppearance : function() {
+	return this.componentAppearance;
+}
+
+});

Added: incubator/aries/trunk/samples-sandbox/dgoat/dgoat-web/src/main/resources/web/goat/ComponentStatusGrid.js
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/samples-sandbox/dgoat/dgoat-web/src/main/resources/web/goat/ComponentStatusGrid.js?rev=1029102&view=auto
==============================================================================
--- incubator/aries/trunk/samples-sandbox/dgoat/dgoat-web/src/main/resources/web/goat/ComponentStatusGrid.js (added)
+++ incubator/aries/trunk/samples-sandbox/dgoat/dgoat-web/src/main/resources/web/goat/ComponentStatusGrid.js Sat Oct 30 15:42:36 2010
@@ -0,0 +1,292 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+//dojo.provide allows pages use all types declared in this resource
+dojo.provide("goat.ComponentStatusGrid");
+dojo.require("dojox.grid.DataGrid");
+dojo.require("dojo.data.ItemFileWriteStore");
+dojo.require("dijit.form.Button");
+
+//TODO:
+
+//this has been partly converted to components.. 
+//it knows too much about component properties at present.
+
+dojo.declare("goat.ComponentStatusGrid", [], {
+	hideshowButton: null,
+	hidecoords: true,
+	grid:null,
+	jsonStore:null,
+	dataItems:{ identifier : 'id',	label : 'name',	items : [] },
+	lastMouseOverIndex:-1,
+
+	constructor : function(wheregrid) {
+
+	var _this=this;
+
+	var hideshowButton = new dijit.form.ToggleButton({
+            showLabel: true,
+            checked: true,
+            onChange: function(val) {
+			if(val) {
+				console.log("true");
+				_this.showAll();
+                this.attr('label', "Hide all");
+			} else {
+				console.log("false");
+				_this.hideAll();
+				label: "Hide all";
+                this.attr('label', "Show all");
+			}
+            },
+            label: "Hide all"
+        });
+
+
+	var layout = [ 
+	{
+		name : "Unique ID",
+		field : "id",
+		width : "auto",
+		hidden : true
+	}, {
+		name : "ID",
+		field : "bundleid",
+		width : "20px"
+	}, {
+		name : "SymbolicName",
+		field : "name",
+		width : "auto" //"155px"
+	}, {
+		name : "State",
+		field : "state",
+		width : "30px",
+		formatter : this.makeStateImage
+	}, {
+		name : "x",
+		field : "x",
+		width : "15px",
+	    hidden : this.hidecoords
+	}, {
+		name : "y",
+		field : "y",
+		width : "15px",
+		hidden : this.hidecoords
+	}, {
+		name: 'Show', 
+		field: 'id', 
+		width: '30px', 
+		formatter: this.makeHideButton
+	}		
+	];
+
+	this.jsonStore = new dojo.data.ItemFileWriteStore( {
+		data : this.dataItems
+	});
+
+	var grid = new dojox.grid.DataGrid( {
+		structure : layout,
+		store : this.jsonStore
+	});
+
+	dojo.place(grid.domNode,wheregrid, "replace");
+	dojo.place(hideshowButton.domNode, grid.domNode, "before");
+	grid.startup();
+
+
+	dojo.connect(window, "onresize", grid, "resize");
+	dojo.connect(grid, "onRowClick", function(evt){
+		var items = evt.grid.selection.getSelected();
+		if(items!=null){
+			dojo.forEach( items, function(component){
+				console.log(component);
+				console.log(component.id);
+				components[component.id].onClick();
+			});
+		} 
+	});
+	dojo.connect(grid, "onRowMouseOver", function(evt){
+		if(_this.lastMouseOverIndex!=evt.rowIndex){
+			components[evt.grid.getItem(evt.rowIndex).id].glow();			
+			_this.lastMouseOverIndex=evt.rowIndex;
+		}
+	});
+	dojo.connect(grid, "onRowMouseOut", function(evt){
+		if(_this.lastMouseOverIndex!=-1){
+			_this.lastMouseOverIndex=-1;
+		}
+	});	
+
+	dojo.subscribe("goat.component.create", this, this.onComponentCreate);
+	dojo.subscribe("goat.component.delete", this, this.onComponentDelete);
+	dojo.subscribe("goat.component.update", this, this.onComponentUpdate);
+	dojo.subscribe("goat.component.hidden", this, this.onComponentHidden);
+	
+	if(!this.hidecoords){
+	  dojo.subscribe("goat.component.move", this, this.onComponentMove);
+	}
+},
+onComponentCreate: function(/*goat.Component*/ component){
+	//console.log(">onComponentCreate");
+	//console.log(component);
+	//add the component to the backing store
+	if (this.jsonStore != null) {
+			
+		//read through the property elements to their values.. 
+		undefinedString = "undefined";
+		var id = component.elements["component.property.BundleID"] != null? component.elements["component.property.BundleID"].value: undefinedString;
+		var name = component.elements["component.property.SymbolicName"] != null? component.elements["component.property.SymbolicName"].value: undefinedString;
+		var state = component.elements["component.property.State"] != null? component.elements["component.property.State"].value: undefinedString;
+		var version = component.elements["component.property.Version"] != null? component.elements["component.property.Version"].value: undefinedString;
+		
+		this.jsonStore.newItem({id: component.id, bundleid: id, name: name, state: state, version: version, x: component.x, y: component.y});
+	}
+	this.jsonStore.save();
+	//console.log("<onComponentCreate");
+},
+onComponentDelete: function(component){
+	//console.log("onComponentDelete");
+	//console.log(component);
+	//console.log("invoking fetch for "+component.id);
+	var _this=this;
+	this.jsonStore.fetch({query: { id: component.id }, onComplete: function(item){
+		//console.log("Deleting "+item[0].id);
+		//console.log(item[0]);
+		_this.jsonStore.deleteItem(item[0]);
+	}});
+	this.jsonStore.save();
+	//console.log("<onComponentDelete");
+},
+onComponentUpdate: function(component){
+	//console.log(">onComponentUpdate");
+	
+	var bid = component.elements["component.property.BundleID"].value;
+	var name = component.elements["component.property.SymbolicName"].value;
+	var state = component.elements["component.property.State"].value;
+	var version = component.elements["component.property.Version"].value;
+
+	var _this=this;
+	this.jsonStore.fetch({query: { id: component.id }, onComplete: function(item){
+		_this.jsonStore.setValue(item[0], "bundleid", bid);
+		_this.jsonStore.setValue(item[0], "name", name);
+		_this.jsonStore.setValue(item[0], "state", state);
+		_this.jsonStore.setValue(item[0], "version", version);
+	}});
+	this.jsonStore.save();
+	//console.log("<onComponentUpdate");
+},
+onComponentHidden: function(id,hidden){
+	//console.log(">onComponentHidden");
+	var _this=this;
+	this.jsonStore.fetch({query: { id: id }, onComplete: function(item){
+		_this.jsonStore.setValue(item[0], "hidden", hidden);
+	}});
+	this.jsonStore.save();
+	//console.log("<onComponentHidden");
+},
+onComponentMove: function(id,x,y){
+	//optimisation, only process the move if we are displaying the coords...
+	if(!this.hidecoords){
+		//console.log("onComponentMove");
+		var _this=this;
+		this.jsonStore.fetch({query: { id: id }, onComplete: function(item){
+			_this.jsonStore.setValue(item[0], "x", x);
+			_this.jsonStore.setValue(item[0], "y", y);
+		}});
+		this.jsonStore.save();
+    }
+},
+makeHideButton: function(pk){
+	var checked="";
+	var text="Show "+components[pk].id;
+	if(!components[pk].hidden){
+		checked="checked";
+		text="Hide "+components[pk].id;
+	}
+	var showBox = "<div dojoType=\"dijit.form.Button\">";
+	showBox = showBox + "<input type=\"checkbox\" ";
+	showBox = showBox + "title=\""+text+"\" ";
+	showBox = showBox + "onClick=\"hideComponent('"+pk+"')\" "+checked+">";
+	showBox = showBox + "</div>";
+
+	//return hideButton;
+	return showBox;
+},
+makeHideStatus: function(hidden){
+	var img;
+	if(hidden){
+		img="\"../dojo/dojo/resources/images/dndCopy.png\"";
+	}else{
+		img="\"../dojo/dojo/resources/images/dndNoCopy.png\"";
+	}
+	var hideButton = "<img src="+img;
+	hideButton = hideButton + " width=\"18\" height=\"18\"";
+	hideButton = hideButton + "\">";
+	return hideButton;		
+},
+makeStateImage: function(state){
+	var img=null;
+
+	if(state=="UNINSTALLED"){
+		img = "../images/dndNoMove.png";
+	}else if(state=="INSTALLED"){
+		img = "../images/dndCopy.png";
+	}else if(state=="RESOLVED"){
+		img = "../images/dndNoCopy.png";
+	}else if(state=="STARTING"){
+		//todo: starting img
+		img = "../images/resolved.png";
+	}else if(state=="STOPPING"){
+		//todo: stopping img
+		img = "../images/resolved.png";
+	}else if(state=="ACTIVE"){
+		img = "../images/running.png";
+	}	
+	var hideButton = "";
+	if(img!=null){
+		hideButton = hideButton + "<img src=\""+img;
+		hideButton = hideButton + "\" width=\"12\" height=\"12\" alt=\"";
+		hideButton = hideButton + state + "\" title=\""+state+"\">";
+	}
+	return hideButton;		    		
+},
+hideAll: function() {
+   console.log("Hiding all bundles");
+   for (var componentNumber in components) {
+       var component = components[componentNumber];
+       if(component!=null){
+           if(!component.hidden) {
+               component.toggleHidden();
+           }
+       }
+   }
+},
+
+showAll: function() {
+    console.log("Showing all bundles");
+    for (var componentNumber in components) {
+       var component = components[componentNumber];
+        if(component!=null){
+            if(component.hidden) {
+                component.toggleHidden();
+            }
+        }
+    }
+}
+});

Added: incubator/aries/trunk/samples-sandbox/dgoat/dgoat-web/src/main/resources/web/goat/Config.js
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/samples-sandbox/dgoat/dgoat-web/src/main/resources/web/goat/Config.js?rev=1029102&view=auto
==============================================================================
--- incubator/aries/trunk/samples-sandbox/dgoat/dgoat-web/src/main/resources/web/goat/Config.js (added)
+++ incubator/aries/trunk/samples-sandbox/dgoat/dgoat-web/src/main/resources/web/goat/Config.js Sat Oct 30 15:42:36 2010
@@ -0,0 +1,8 @@
+//this isnt a dojo class.. and is just a global object with named fields.. 
+//eventually this will be where the other objects come to find their settings.. probably..
+
+config = {
+   option : null,
+   layoutManager : null,
+   elementRegistry : null
+};

Added: incubator/aries/trunk/samples-sandbox/dgoat/dgoat-web/src/main/resources/web/goat/ConfigManager.js
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/samples-sandbox/dgoat/dgoat-web/src/main/resources/web/goat/ConfigManager.js?rev=1029102&view=auto
==============================================================================
--- incubator/aries/trunk/samples-sandbox/dgoat/dgoat-web/src/main/resources/web/goat/ConfigManager.js (added)
+++ incubator/aries/trunk/samples-sandbox/dgoat/dgoat-web/src/main/resources/web/goat/ConfigManager.js Sat Oct 30 15:42:36 2010
@@ -0,0 +1,20 @@
+//dojo.provide allows pages use all types declared in this resource
+dojo.provide("goat.ConfigManager");
+
+//not even started this yet.. the idea is to have a config panel for the global config, allowing 
+//all sorts of magic stuff to be done ;-) .. yeah.. right..
+
+dojo.declare("goat.ConfigManager", [], {
+	
+    dialog:null,
+
+	constructor : function() {
+		this.dialog = new dijit.Dialog({title:"Configuration", id:"configDialog"});
+
+		dojo.body().appendChild(this.dialog.domNode);
+		this.dialog.hide();
+}
+
+
+
+});

Added: incubator/aries/trunk/samples-sandbox/dgoat/dgoat-web/src/main/resources/web/goat/DwrLoadingDialog.js
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/samples-sandbox/dgoat/dgoat-web/src/main/resources/web/goat/DwrLoadingDialog.js?rev=1029102&view=auto
==============================================================================
--- incubator/aries/trunk/samples-sandbox/dgoat/dgoat-web/src/main/resources/web/goat/DwrLoadingDialog.js (added)
+++ incubator/aries/trunk/samples-sandbox/dgoat/dgoat-web/src/main/resources/web/goat/DwrLoadingDialog.js Sat Oct 30 15:42:36 2010
@@ -0,0 +1,55 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+// dojo.provide allows pages use all types declared in this resource
+dojo.provide("goat.DwrLoadingDialog");
+dojo.require("dijit.Dialog");
+
+//not sure this is working anymore..
+//it worked best when js was making requests TO the server.. 
+//but we've got it flipped so that the js makes a quick request, which causes the server to make calls back to us
+//might revisit this at some point to try to have the long requests all be client initiated, so we can display the dialog.
+
+dojo.declare("goat.DwrLoadingDialog", [], {
+	loadingMessage:"Loading data from server..<br>waiting for <span id='count'>0</span> items",
+    dialog:null,
+    count:0,
+	constructor : function() {
+		this.dialog = new dijit.Dialog({title:"Loading...", id:"loadDialog"});
+		this.dialog.attr('content', this.loadingMessage);
+		dojo.body().appendChild(this.dialog.domNode);
+		this.dialog.hide();
+		
+		dwr.engine.setPreHook(this.dwrPreHook);
+		dwr.engine.setPostHook(this.dwrPostHook);
+	},
+	dwrPreHook: function(){
+		console.log("***************** PRE HOOK");
+		if(this.count==0){
+			this.dialog.show();
+			this.count++;
+			dojo.byId('count').innerHtml = ""+this.count;
+		}
+	},
+	dwrPostHook: function(){
+		console.log("***************** POST HOOK");
+		this.count--;
+		if(this.count==0) this.dialog.hide();
+		dojo.byId('count').innerHtml = ""+this.count;
+	}	
+});

Added: incubator/aries/trunk/samples-sandbox/dgoat/dgoat-web/src/main/resources/web/goat/ElementLayoutManager.js
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/samples-sandbox/dgoat/dgoat-web/src/main/resources/web/goat/ElementLayoutManager.js?rev=1029102&view=auto
==============================================================================
--- incubator/aries/trunk/samples-sandbox/dgoat/dgoat-web/src/main/resources/web/goat/ElementLayoutManager.js (added)
+++ incubator/aries/trunk/samples-sandbox/dgoat/dgoat-web/src/main/resources/web/goat/ElementLayoutManager.js Sat Oct 30 15:42:36 2010
@@ -0,0 +1,122 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+//dojo.provide allows pages use all types declared in this resource
+dojo.provide("goat.ElementLayoutManager");
+
+//Positions elements within a Component. 
+dojo.declare("goat.ElementLayoutManager", [], {
+
+	owningComponent: null,
+	layoutElements: null,
+
+constructor : function(owningComponent) {
+	//console.log("Building elementLayoutMananger");
+	console.log(owningComponent);
+	this.owningComponent = owningComponent;
+},
+doLayout: function(){	
+    //console.log(">doLayout");
+    //console.log(this.owningComponent.elements);
+    
+	if(this.layoutElements!=null){
+		this.owningComponent.group.remove(this.layoutElements);
+		//console.log("removing old group");
+	}
+	//console.log("adding layout element group");
+	this.layoutElements = this.owningComponent.group.createGroup();
+	
+	var yOffset=0; //needed to compensate for how strings get rendered.
+
+	var yMargin=5;
+	var xMargin=5;
+	var rowPad=2;
+	
+	var currentYPos=yMargin + yOffset;
+	
+	var maxWidth = 0;
+    var sepYPos = new Array();
+	
+    // Go through the rendering in two passes, initialisation and then rendering
+	for ( var elementName in this.owningComponent.elements) {
+		var element = this.owningComponent.elements[elementName];
+		element.apply();
+	}
+
+	
+	//console.log("processing array.. ");
+	//walk through each element in the component, and position it relative to 0,0 inside the component.
+	for(var elementName in this.owningComponent.elements){
+		var element = this.owningComponent.elements[elementName];
+		//console.log("Processing element .."+element.type);
+		//console.log(element);
+		//console.log(this);
+	
+		var hint = element.hint;
+		
+		var width=element.getWidth();
+		var height=element.getHeight();
+        //console.log(" - element size was "+width+" x "+height);				
+      
+		//or something.. 
+		if(hint=="row"){
+			element.x=0;
+			element.y=currentYPos;
+			
+			//console.log("Invoking element.render" + this.owningComponent.id + " " + elementName);
+			
+			element.render();
+			
+			if(width>maxWidth){
+				maxWidth=width;
+			}
+
+			currentYPos+=rowPad;			
+			currentYPos+=height;
+						
+			//cant draw the sep line here, as the width of component isnt final yet.
+			sepYPos.push(currentYPos);
+
+		}else if(hint=="none"){
+			element.render();
+		}		
+	}
+	
+	//update comp width with maxWidth seen during element processing.
+	//console.log("Adjusting overall component dimensions");	
+	this.owningComponent.width=maxWidth;
+	this.owningComponent.height = currentYPos+yMargin;
+
+	//Publish the fact that component has resized so that relationship elements can re-draw
+    dojo.publish("goat.component.resize."+this.owningComponent.id, [this.owningComponent]);
+
+	
+	//now we know the width.. we can add our markup..
+	dojo.forEach(sepYPos, function(ypos){
+		//console.log("Adding sep line at "+ypos+" width "+this.owningComponent.width);
+		
+		//add separator line
+		this.layoutElements.createLine({x1:0, y1:ypos, x2: this.owningComponent.width, y2: ypos})
+		.setStroke({width:1, color: '#808080'});
+	},this);
+	
+	//console.log("<doLayout");
+	
+}
+
+});



Mime
View raw message