<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -13,5 +13,6 @@ Import-Package: org.osgi.framework;version=&quot;1.3.0&quot;,
  uk.co.arum.osgi.amf3;version=&quot;1.0.0&quot;,
  uk.co.arum.osgi.amf3.flex.remoting;version=&quot;1.0.0&quot;,
  uk.co.arum.osgi.amf3.flex.remoting.events;version=&quot;1.0.0&quot;
-Export-Package: uk.co.arum.osgi.amf3.flex.remoting;version=&quot;1.0.0&quot;,
+Export-Package: flex.messaging.messages,
+ uk.co.arum.osgi.amf3.flex.remoting;version=&quot;1.0.0&quot;,
  uk.co.arum.osgi.amf3.flex.remoting.events;version=&quot;1.0.0&quot;;uses:=&quot;org.osgi.service.event&quot;</diff>
      <filename>uk.co.arum.osgi.amf3.flex.remoting/META-INF/MANIFEST.MF</filename>
    </modified>
    <modified>
      <diff>@@ -32,6 +32,7 @@ import java.util.UUID;
 import org.osgi.service.log.LogService;
 
 import uk.co.arum.osgi.amf3.AMFFactory;
+import uk.co.arum.osgi.amf3.flex.remoting.RemotingContext;
 import uk.co.arum.osgi.amf3.flex.remoting.events.PublishedObjectEvent;
 import flex.messaging.messages.AcknowledgeMessage;
 import flex.messaging.messages.AsyncMessage;
@@ -263,7 +264,10 @@ public class FlexRemotingAMFFactory implements AMFFactory {
 		if (null != opargs) {
 			int i = 0;
 			for (Object arg : opargs) {
-				opargsClasses[i++] = arg.getClass();
+				if (null != arg) {
+					opargsClasses[i] = arg.getClass();
+				}
+				i++;
 			}
 		}
 
@@ -277,12 +281,8 @@ public class FlexRemotingAMFFactory implements AMFFactory {
 				// is there an operation on this class that matches requested
 				// operation?
 				if (null != serviceClass) {
-					try {
-						method = serviceClass.getMethod(
-								remoting.getOperation(), opargsClasses);
-					} catch (NoSuchMethodException e) {
-						// could happen
-					}
+					method = findMethod(serviceClass, remoting.getOperation(),
+							opargsClasses, opargs);
 				}
 
 			} catch (ClassNotFoundException e) {
@@ -297,25 +297,80 @@ public class FlexRemotingAMFFactory implements AMFFactory {
 					.getOperation()));
 		}
 
-		// TODO add security hooks in case a bundle wants to prevent access to
-		// this service for some reason
-
 		// if the same operation exists on the actual service class, invoke it
-		try {
-			method = serviceConfig.getService().getClass().getMethod(
-					remoting.getOperation(), opargsClasses);
-		} catch (NoSuchMethodException e) {
-			return e;
+		if (null == (method = findMethod(serviceConfig.getService().getClass(),
+				remoting.getOperation(), opargsClasses, opargs))) {
+			throw new RuntimeException(new NoSuchMethodException(remoting
+					.getOperation()));
 		}
 
 		try {
-			return method.invoke(serviceConfig.getService(),
+			new RemotingContext(remoting);
+			Object returnValue = method.invoke(serviceConfig.getService(),
 					(Object[]) remoting.getBody());
+			return config.translate(returnValue);
 		} catch (Exception e) {
 			throw new RuntimeException(e);
 		}
 	}
 
+	@SuppressWarnings(&quot;unchecked&quot;)
+	private boolean compareArgList(Class[] methodArgs, Class[] requiredArgs,
+			Object[] args) {
+
+		if (methodArgs.length != requiredArgs.length) {
+			return false;
+		}
+
+		for (int i = 0; i &lt; methodArgs.length; i++) {
+
+			if (null == requiredArgs[i]
+					|| methodArgs[i].isAssignableFrom(requiredArgs[i])
+					|| isAssignable(methodArgs[i], requiredArgs[i], args[i])) {
+				continue;
+			}
+
+			return false;
+		}
+
+		return true;
+	}
+
+	@SuppressWarnings(&quot;unchecked&quot;)
+	private boolean isAssignable(Class methodArgType, Class requiredArgType,
+			Object arg) {
+
+		try {
+			requiredArgType.cast(arg);
+		} catch (ClassCastException e) {
+			return false;
+		}
+
+		return true;
+	}
+
+	@SuppressWarnings(&quot;unchecked&quot;)
+	private Method findMethod(Class c, String name, Class[] argTypes,
+			Object[] args) {
+		Method method = null;
+		try {
+			method = c.getDeclaredMethod(name, argTypes);
+		} catch (NoSuchMethodException e) {
+			// could happen
+			for (Method xMethod : c.getDeclaredMethods()) {
+				if (xMethod.getName().equals(name)) {
+					if (compareArgList(xMethod.getParameterTypes(), argTypes,
+							args)) {
+						method = xMethod;
+					}
+				}
+			}
+
+		}
+
+		return method;
+	}
+
 	private Object processPublishMessage(Object incoming) {
 
 		if (incoming instanceof Message) {</diff>
      <filename>uk.co.arum.osgi.amf3.flex.remoting/src/uk/co/arum/osgi/amf3/flex/remoting/bundle/FlexRemotingAMFFactory.java</filename>
    </modified>
    <modified>
      <diff>@@ -29,9 +29,11 @@ import java.util.Set;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.Constants;
+import org.osgi.framework.InvalidSyntaxException;
 import org.osgi.framework.ServiceReference;
 
 import uk.co.arum.osgi.amf3.flex.remoting.OSGiAMFConstants;
+import uk.co.arum.osgi.amf3.flex.remoting.Translator;
 
 public class OSGiAMFConfig {
 
@@ -47,7 +49,8 @@ public class OSGiAMFConfig {
 
 	/**
 	 * Load the class with the given name from the bundles that have registered
-	 * a service.&lt;p/&gt;
+	 * a service.
+	 * &lt;p/&gt;
 	 * 
 	 * TODO cache the class, but uncache if associated service disappears
 	 * 
@@ -133,4 +136,33 @@ public class OSGiAMFConfig {
 		configs.clear();
 	}
 
+	public Object translate(Object from) {
+
+		if (null == from || from instanceof Void) {
+			return from;
+		}
+
+		ServiceReference[] refs = null;
+
+		try {
+			refs = context.getServiceReferences(Translator.class.getName(),
+					null);
+		} catch (InvalidSyntaxException e) {
+			throw new RuntimeException(e);
+		}
+
+		for (ServiceReference ref : refs) {
+			Translator t = (Translator) context.getService(ref);
+			try {
+				if (t.canTranslate(from)) {
+					return t.translate(from);
+				}
+			} finally {
+				context.ungetService(ref);
+			}
+		}
+
+		return from;
+	}
+
 }</diff>
      <filename>uk.co.arum.osgi.amf3.flex.remoting/src/uk/co/arum/osgi/amf3/flex/remoting/bundle/OSGiAMFConfig.java</filename>
    </modified>
    <modified>
      <diff>@@ -26,6 +26,7 @@ import java.util.Map;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
 
 public class HttpRequestContext {
 
@@ -58,6 +59,15 @@ public class HttpRequestContext {
 	}
 
 	/**
+	 * Get the current http session, creating a new one if necessary.
+	 * 
+	 * @return the http session
+	 */
+	public HttpSession getSession() {
+		return request.getSession(true);
+	}
+
+	/**
 	 * Can be used by other bundles to set properties for this request.
 	 * 
 	 * @return properties specific to this context</diff>
      <filename>uk.co.arum.osgi.amf3.http/src/uk/co/arum/osgi/amf3/http/HttpRequestContext.java</filename>
    </modified>
    <modified>
      <diff>@@ -6,11 +6,13 @@ Bundle-Version: 1.0.0
 Bundle-Activator: uk.co.arum.osgi.amf3.sample.bundle.Activator
 Bundle-Vendor: Arum Systems Ltd
 Bundle-RequiredExecutionEnvironment: J2SE-1.5
-Import-Package: javax.servlet;version=&quot;2.4.0&quot;,
+Import-Package: flex.messaging.messages,
+ javax.servlet;version=&quot;2.4.0&quot;,
  javax.servlet.http;version=&quot;2.4.0&quot;,
  org.osgi.framework;version=&quot;1.3.0&quot;,
  org.osgi.service.event;version=&quot;1.1.0&quot;;resolution:=optional,
  org.osgi.service.http;version=&quot;1.2.0&quot;,
  uk.co.arum.osgi.amf3;version=&quot;1.0.0&quot;,
+ uk.co.arum.osgi.amf3.flex.remoting;version=&quot;1.0.0&quot;,
  uk.co.arum.osgi.amf3.flex.remoting.events;version=&quot;1.0.0&quot;,
  uk.co.arum.osgi.amf3.http;version=&quot;1.0.0&quot;</diff>
      <filename>uk.co.arum.osgi.amf3.sample/META-INF/MANIFEST.MF</filename>
    </modified>
    <modified>
      <diff>@@ -1,32 +1,33 @@
 &lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
 &lt;!--
 
-/*
-  uk.co.arum.osgi.amf3.sample 
-  
-  Copyright (C) 2008 - 2009 Arum Systems Ltd
+	 /*
+	 uk.co.arum.osgi.amf3.sample
 
-  This file is part of the uk.co.arum.osgi.amf3.sample bundle.
+	 Copyright (C) 2008 - 2009 Arum Systems Ltd
 
-  uk.co.arum.osgi.amf3.sample is free software; you can redistribute it and/or modify
-  it under the terms of the GNU Lesser General Public License as published by
-  the Free Software Foundation; either version 3 of the License, or (at your
-  option) any later version.
+	 This file is part of the uk.co.arum.osgi.amf3.sample bundle.
 
-  uk.co.arum.osgi.amf3.sample is distributed in the hope that it will be useful, but
-  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
-  for more details.
+	 uk.co.arum.osgi.amf3.sample is free software; you can redistribute it and/or modify
+	 it under the terms of the GNU Lesser General Public License as published by
+	 the Free Software Foundation; either version 3 of the License, or (at your
+	 option) any later version.
 
-  You should have received a copy of the GNU Lesser General Public License
-  along with this library; if not, see &lt;http://www.gnu.org/licenses/&gt;.
- */
+	 uk.co.arum.osgi.amf3.sample is distributed in the hope that it will be useful, but
+	 WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+	 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+	 for more details.
+
+	 You should have received a copy of the GNU Lesser General Public License
+	 along with this library; if not, see &lt;http://www.gnu.org/licenses/&gt;.
+	 */
 
 
 --&gt;
-&lt;mx:Application xmlns:mx=&quot;http://www.adobe.com/2006/mxml&quot; layout=&quot;vertical&quot;
-		implements=&quot;mx.rpc.IResponder&quot;
-		creationComplete=&quot;onCreationComplete(event)&quot;&gt;
+&lt;mx:Application xmlns:mx=&quot;http://www.adobe.com/2006/mxml&quot;
+				layout=&quot;vertical&quot;
+				implements=&quot;mx.rpc.IResponder&quot;
+				creationComplete=&quot;onCreationComplete(event)&quot;&gt;
 
 	&lt;mx:Script&gt;
 		&lt;![CDATA[
@@ -42,130 +43,210 @@
 			import mx.messaging.ChannelSet;
 			import uk.co.arum.osgi.amf3.sample.VerySimpleObject;
 			import uk.co.arum.osgi.amf3.sample.SampleObject;
-			
+
 			private var sample:SampleObject;
-			
+
 			private var simple:VerySimpleObject;
-			
-			private function onCreationComplete(event:Event) : void {
-				simple = createVerySimpleObject(&quot;very simple&quot;);
-				
-				sample = createSampleObject(&quot;sample object&quot;, null, 1024);
-				var child1:SampleObject = createSampleObject(&quot;child 1&quot;, sample, 22);
-				var child2:SampleObject = createSampleObject(&quot;child 2&quot;, sample, 65);
-				var child3:SampleObject = createSampleObject(&quot;child 3&quot;, sample, 65);
-				var child2_1:SampleObject = createSampleObject(&quot;child 2.1&quot;, child2, 2011);
+
+			private function onCreationComplete(event:Event):void
+			{
+				simpleService.setRemoteCredentials(&quot;remotecredentials&quot;, &quot;12345&quot;);
 				
-				var cs:ChannelSet = new ChannelSet();
-				var channel:Channel = new AMFChannel(&quot;events&quot;, &quot;/amf3osgi&quot;);
+				simple=createVerySimpleObject(&quot;very simple&quot;);
+
+				sample=createSampleObject(&quot;sample object&quot;, null, 1024);
+				var child1:SampleObject=createSampleObject(&quot;child 1&quot;, sample, 22);
+				var child2:SampleObject=createSampleObject(&quot;child 2&quot;, sample, 65);
+				var child3:SampleObject=createSampleObject(&quot;child 3&quot;, sample, 65);
+				var child2_1:SampleObject=createSampleObject(&quot;child 2.1&quot;, child2, 2011);
+
+				var cs:ChannelSet=new ChannelSet();
+				var channel:Channel=new AMFChannel(&quot;events&quot;, &quot;/amf3osgi&quot;);
 				cs.addChannel(channel);
-				consumer.channelSet = cs;
+				consumer.channelSet=cs;
 				consumer.subscribe();
-				
-				producer.channelSet = cs;
+
+				producer.channelSet=cs;
 				producer.send(createAsyncMessage());
 			}
-			
-			private function createVerySimpleObject(name:String) : VerySimpleObject {
-				var vso:VerySimpleObject = new VerySimpleObject();
-				vso.name = name;
+
+			private function createVerySimpleObject(name:String):VerySimpleObject
+			{
+				var vso:VerySimpleObject=new VerySimpleObject();
+				vso.name=name;
 				return vso;
 			}
-			
-			private function createSampleObject(name:String, parent:SampleObject, value:Number) : SampleObject {
-				var sample:SampleObject = new SampleObject();
-				
-				sample.parent = parent;
-				if (sample.parent) {
-					if (!sample.parent.children) {
-						sample.parent.children = new ArrayCollection();
+
+			private function createSampleObject(name:String, parent:SampleObject, value:Number):SampleObject
+			{
+				var sample:SampleObject=new SampleObject();
+
+				sample.parent=parent;
+				if (sample.parent)
+				{
+					if (!sample.parent.children)
+					{
+						sample.parent.children=new ArrayCollection();
 					}
 					sample.parent.children.addItem(sample);
 				}
-				
-				sample.name = name;
-				sample.value = value;
+
+				sample.name=name;
+				sample.value=value;
 				return sample;
 			}
-			
-			private function createAsyncMessage(text:String = &quot;Hello&quot;) : AsyncMessage {
-				var async:AsyncMessage = new AsyncMessage();
-				async.destination = &quot;events&quot;;
-				async.body = {&quot;Say&quot;:text};
+
+			private function createAsyncMessage(text:String=&quot;Hello&quot;):AsyncMessage
+			{
+				var async:AsyncMessage=new AsyncMessage();
+				async.destination=&quot;events&quot;;
+				async.body={&quot;Say&quot;:text};
 				return async;
 			}
-			
-			private function onFault(event:Event) : void {
+
+			private function onFault(event:Event):void
+			{
 				Alert.show(event.toString());
 			}
-			
-			private function onResult(event:ResultEvent) : void {
-				textArea.text = event.toString() + &quot;\n&quot; + textArea.text;
-				textArea.text = event.result.toString() + &quot;\n&quot; + textArea.text;
+
+			private function onResult(event:ResultEvent):void
+			{
+				textArea.text=event.toString() + &quot;\n&quot; + textArea.text;
+				textArea.text=event.result.toString() + &quot;\n&quot; + textArea.text;
 			}
-		
-			public function fault(o:Object) : void {
+
+			public function fault(o:Object):void
+			{
 				onFault(FaultEvent(o));
 			}
-			
-			public function result(o:Object) : void {
+
+			public function result(o:Object):void
+			{
 				onResult(ResultEvent(o));
 			}
-			
-			private function onClickSendButton(event:Event) : void {
+
+			private function onClickSendButton(event:Event):void
+			{
 				producer.send(createAsyncMessage(textInput.text));
 			}
-			
-			private function onConsumerMessage(event:MessageEvent) : void {
-				messagesArea.text = event.toString() + &quot;\n&quot; + messagesArea.text;
-				messagesArea.text = event.message.body.Say + &quot;\n&quot; + messagesArea.text;
+
+			private function onConsumerMessage(event:MessageEvent):void
+			{
+				messagesArea.text=event.toString() + &quot;\n&quot; + messagesArea.text;
+				messagesArea.text=event.message.body.Say + &quot;\n&quot; + messagesArea.text;
 			}
-			
 		]]&gt;
 	&lt;/mx:Script&gt;
-	
-	&lt;mx:Consumer id=&quot;consumer&quot; message=&quot;onConsumerMessage(event)&quot; destination=&quot;events&quot; fault=&quot;onFault(event)&quot;/&gt;
-	
-	&lt;mx:Producer id=&quot;producer&quot; destination=&quot;events&quot; fault=&quot;onFault(event)&quot; /&gt;
-
-	&lt;mx:RemoteObject id=&quot;simpleService&quot; endpoint=&quot;/amf3osgi&quot; destination=&quot;uk.co.arum.osgi.amf3.sample.SimpleService&quot;&gt;	
-		&lt;mx:method id=&quot;echoMethod&quot; name=&quot;echo&quot; result=&quot;onResult(event)&quot; fault=&quot;onFault(event)&quot; /&gt;
-		&lt;mx:method id=&quot;reverseMethod&quot; name=&quot;reverse&quot; result=&quot;onResult(event)&quot; fault=&quot;onFault(event)&quot; /&gt;
-		&lt;mx:method id=&quot;randomMethod&quot; name=&quot;random&quot; result=&quot;onResult(event)&quot; fault=&quot;onFault(event)&quot; /&gt;
-		&lt;mx:method id=&quot;getSampleObjectMethod&quot; name=&quot;getSampleObject&quot; result=&quot;onResult(event)&quot; fault=&quot;onFault(event)&quot; /&gt;
-		&lt;mx:method id=&quot;sendVerySimpleObjectMethod&quot; name=&quot;sendVerySimpleObject&quot; result=&quot;onResult(event)&quot; fault=&quot;onFault(event)&quot; /&gt;
-		&lt;mx:method id=&quot;sendSampleObjectMethod&quot; name=&quot;sendSampleObject&quot; result=&quot;onResult(event)&quot; fault=&quot;onFault(event)&quot; /&gt;
-		&lt;mx:method id=&quot;throwExceptionMethod&quot; name=&quot;throwException&quot; result=&quot;onResult(event)&quot; fault=&quot;onFault(event)&quot; /&gt;
+
+	&lt;mx:Consumer id=&quot;consumer&quot;
+				 message=&quot;onConsumerMessage(event)&quot;
+				 destination=&quot;events&quot;
+				 fault=&quot;onFault(event)&quot;/&gt;
+
+	&lt;mx:Producer id=&quot;producer&quot;
+				 destination=&quot;events&quot;
+				 fault=&quot;onFault(event)&quot;/&gt;
+
+	&lt;mx:RemoteObject id=&quot;simpleService&quot;
+					 endpoint=&quot;/amf3osgi&quot;
+					 destination=&quot;uk.co.arum.osgi.amf3.sample.SimpleService&quot;
+					 &gt;
+		&lt;mx:method id=&quot;echoMethod&quot;
+				   name=&quot;echo&quot;
+				   result=&quot;onResult(event)&quot;
+				   fault=&quot;onFault(event)&quot;/&gt;
+		&lt;mx:method id=&quot;reverseMethod&quot;
+				   name=&quot;reverse&quot;
+				   result=&quot;onResult(event)&quot;
+				   fault=&quot;onFault(event)&quot;/&gt;
+		&lt;mx:method id=&quot;randomMethod&quot;
+				   name=&quot;random&quot;
+				   result=&quot;onResult(event)&quot;
+				   fault=&quot;onFault(event)&quot;/&gt;
+		&lt;mx:method id=&quot;getSampleObjectMethod&quot;
+				   name=&quot;getSampleObject&quot;
+				   result=&quot;onResult(event)&quot;
+				   fault=&quot;onFault(event)&quot;/&gt;
+		&lt;mx:method id=&quot;sendVerySimpleObjectMethod&quot;
+				   name=&quot;sendVerySimpleObject&quot;
+				   result=&quot;onResult(event)&quot;
+				   fault=&quot;onFault(event)&quot;/&gt;
+		&lt;mx:method id=&quot;sendSampleObjectMethod&quot;
+				   name=&quot;sendSampleObject&quot;
+				   result=&quot;onResult(event)&quot;
+				   fault=&quot;onFault(event)&quot;/&gt;
+		&lt;mx:method id=&quot;throwExceptionMethod&quot;
+				   name=&quot;throwException&quot;
+				   result=&quot;onResult(event)&quot;
+				   fault=&quot;onFault(event)&quot;/&gt;
 	&lt;/mx:RemoteObject&gt;
-	
-	&lt;mx:HBox width=&quot;100%&quot; defaultButton=&quot;{echoButton}&quot;&gt;
-		&lt;mx:Label text=&quot;Enter Your Text:&quot; /&gt;
-		&lt;mx:TextInput id=&quot;textInput&quot; width=&quot;100%&quot; /&gt;
-		&lt;mx:Button id=&quot;echoButton&quot; label=&quot;Echo&quot; click=&quot;simpleService.echo(textInput.text)&quot; enabled=&quot;{StringUtil.trim(textInput.text).length &gt; 0}&quot; /&gt;
-		&lt;mx:Button id=&quot;reverseButton&quot; label=&quot;Reverse&quot; click=&quot;simpleService.reverse(textInput.text)&quot; enabled=&quot;{StringUtil.trim(textInput.text).length &gt; 0}&quot; /&gt;
-		&lt;mx:Button id=&quot;sendButton&quot; label=&quot;Send&quot; click=&quot;onClickSendButton(event)&quot; toolTip=&quot;Send text as a message&quot; enabled=&quot;{StringUtil.trim(textInput.text).length &gt; 0}&quot; /&gt;
-		&lt;mx:Button id=&quot;exceptionButton&quot; label=&quot;Exception&quot; click=&quot;simpleService.throwException(textInput.text)&quot; toolTip=&quot;Have the server thrown an exception with the given message&quot; enabled=&quot;{StringUtil.trim(textInput.text).length &gt; 0}&quot; /&gt;
+
+	&lt;mx:HBox width=&quot;100%&quot;
+			 defaultButton=&quot;{echoButton}&quot;&gt;
+		&lt;mx:Label text=&quot;Enter Your Text:&quot;/&gt;
+		&lt;mx:TextInput id=&quot;textInput&quot;
+					  width=&quot;100%&quot;/&gt;
+		&lt;mx:Button id=&quot;echoButton&quot;
+				   label=&quot;Echo&quot;
+				   click=&quot;simpleService.echo(textInput.text)&quot;
+				   enabled=&quot;{StringUtil.trim(textInput.text).length &gt; 0}&quot;/&gt;
+		&lt;mx:Button id=&quot;reverseButton&quot;
+				   label=&quot;Reverse&quot;
+				   click=&quot;simpleService.reverse(textInput.text)&quot;
+				   enabled=&quot;{StringUtil.trim(textInput.text).length &gt; 0}&quot;/&gt;
+		&lt;mx:Button id=&quot;sendButton&quot;
+				   label=&quot;Send&quot;
+				   click=&quot;onClickSendButton(event)&quot;
+				   toolTip=&quot;Send text as a message&quot;
+				   enabled=&quot;{StringUtil.trim(textInput.text).length &gt; 0}&quot;/&gt;
+		&lt;mx:Button id=&quot;exceptionButton&quot;
+				   label=&quot;Exception&quot;
+				   click=&quot;simpleService.throwException(textInput.text)&quot;
+				   toolTip=&quot;Have the server thrown an exception with the given message&quot;
+				   enabled=&quot;{StringUtil.trim(textInput.text).length &gt; 0}&quot;/&gt;
 	&lt;/mx:HBox&gt;
 
 	&lt;mx:HBox width=&quot;100%&quot;&gt;
-		&lt;mx:Button id=&quot;randomButton&quot; label=&quot;Get Random Number&quot; click=&quot;simpleService.random()&quot; toolTip=&quot;Have the server generate a random number&quot;/&gt;
-		&lt;mx:Button id=&quot;getSampleObjectButton&quot; label=&quot;Get Sample Object&quot; click=&quot;simpleService.getSampleObject()&quot; toolTip=&quot;Have the server retrieve a sample object instance&quot;/&gt;
-		&lt;mx:Button id=&quot;sendVerySimpleObjectButton&quot; label=&quot;Send Very Simple Object&quot; click=&quot;simpleService.sendVerySimpleObject(simple)&quot; toolTip=&quot;Send a simple object&quot;/&gt;
-		&lt;mx:Button id=&quot;sendSampleObjectButton&quot; label=&quot;Send Sample Object&quot; click=&quot;simpleService.sendSampleObject(sample)&quot; toolTip=&quot;Send and retrieve a more complicated sample object&quot;/&gt;
+		&lt;mx:Button id=&quot;randomButton&quot;
+				   label=&quot;Get Random Number&quot;
+				   click=&quot;simpleService.random()&quot;
+				   toolTip=&quot;Have the server generate a random number&quot;/&gt;
+		&lt;mx:Button id=&quot;getSampleObjectButton&quot;
+				   label=&quot;Get Sample Object&quot;
+				   click=&quot;simpleService.getSampleObject()&quot;
+				   toolTip=&quot;Have the server retrieve a sample object instance&quot;/&gt;
+		&lt;mx:Button id=&quot;sendVerySimpleObjectButton&quot;
+				   label=&quot;Send Very Simple Object&quot;
+				   click=&quot;simpleService.sendVerySimpleObject(simple)&quot;
+				   toolTip=&quot;Send a simple object&quot;/&gt;
+		&lt;mx:Button id=&quot;sendSampleObjectButton&quot;
+				   label=&quot;Send Sample Object&quot;
+				   click=&quot;simpleService.sendSampleObject(sample)&quot;
+				   toolTip=&quot;Send and retrieve a more complicated sample object&quot;/&gt;
 	&lt;/mx:HBox&gt;
-	
-	&lt;mx:HBox width=&quot;100%&quot; height=&quot;100%&quot;&gt;
-		&lt;mx:Panel title=&quot;Output from remote methods&quot; width=&quot;100%&quot; height=&quot;100%&quot; &gt;
-			&lt;mx:TextArea id=&quot;textArea&quot; width=&quot;100%&quot; height=&quot;100%&quot; /&gt;
+
+	&lt;mx:HBox width=&quot;100%&quot;
+			 height=&quot;100%&quot;&gt;
+		&lt;mx:Panel title=&quot;Output from remote methods&quot;
+				  width=&quot;100%&quot;
+				  height=&quot;100%&quot;&gt;
+			&lt;mx:TextArea id=&quot;textArea&quot;
+						 width=&quot;100%&quot;
+						 height=&quot;100%&quot;/&gt;
 		&lt;/mx:Panel&gt;
-		&lt;mx:Panel title=&quot;Messages&quot; width=&quot;100%&quot; height=&quot;100%&quot; &gt;
-			&lt;mx:TextArea id=&quot;messagesArea&quot; width=&quot;100%&quot; height=&quot;100%&quot; /&gt;
+		&lt;mx:Panel title=&quot;Messages&quot;
+				  width=&quot;100%&quot;
+				  height=&quot;100%&quot;&gt;
+			&lt;mx:TextArea id=&quot;messagesArea&quot;
+						 width=&quot;100%&quot;
+						 height=&quot;100%&quot;/&gt;
 		&lt;/mx:Panel&gt;
 	&lt;/mx:HBox&gt;
-	
+
 	&lt;mx:HBox width=&quot;100%&quot;&gt;
-		&lt;mx:Spacer width=&quot;100%&quot; /&gt;
-		&lt;mx:Button label=&quot;Clear&quot; click=&quot;textArea.text = ''&quot; /&gt;
+		&lt;mx:Spacer width=&quot;100%&quot;/&gt;
+		&lt;mx:Button label=&quot;Clear&quot;
+				   click=&quot;textArea.text = ''&quot;/&gt;
 	&lt;/mx:HBox&gt;
 
 &lt;/mx:Application&gt;</diff>
      <filename>uk.co.arum.osgi.amf3.sample/flexsrc/main.mxml</filename>
    </modified>
    <modified>
      <diff>@@ -25,6 +25,7 @@ import java.util.Enumeration;
 
 import javax.servlet.http.HttpServletRequest;
 
+import uk.co.arum.osgi.amf3.flex.remoting.RemotingContext;
 import uk.co.arum.osgi.amf3.http.HttpRequestContext;
 import uk.co.arum.osgi.amf3.sample.SampleObject;
 import uk.co.arum.osgi.amf3.sample.SimpleService;
@@ -99,6 +100,10 @@ public class SimpleServiceImpl implements SimpleService {
 
 		System.out.println(&quot;Method: &quot; + request.getMethod());
 
+		System.out.println(&quot;Credentials: &quot;
+				+ RemotingContext.getCurrent().getMessage().getHeader(
+						&quot;DSRemoteCredentials&quot;));
+
 		boolean headers = false;
 		System.out.println(&quot;Headers: &quot;);
 		Enumeration&lt;?&gt; headersEnum = request.getHeaderNames();</diff>
      <filename>uk.co.arum.osgi.amf3.sample/src/uk/co/arum/osgi/amf3/sample/bundle/SimpleServiceImpl.java</filename>
    </modified>
    <modified>
      <diff>@@ -1,90 +1,95 @@
-/*
-  GRANITE DATA SERVICES
-  Copyright (C) 2007-2008 ADEQUATE SYSTEMS SARL
-
-  This file is part of Granite Data Services.
-
-  Granite Data Services is free software; you can redistribute it and/or modify
-  it under the terms of the GNU Lesser General Public License as published by
-  the Free Software Foundation; either version 3 of the License, or (at your
-  option) any later version.
-
-  Granite Data Services is distributed in the hope that it will be useful, but
-  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
-  for more details.
-
-  You should have received a copy of the GNU Lesser General Public License
-  along with this library; if not, see &lt;http://www.gnu.org/licenses/&gt;.
-*/
-
-package org.granite.messaging.amf.io.util;
-
-import java.beans.BeanInfo;
-import java.beans.Introspector;
-import java.beans.PropertyDescriptor;
-import java.lang.reflect.Field;
-import java.lang.reflect.Modifier;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Hashtable;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * @author Franck WOLFF
- */
-public class DefaultJavaClassDescriptor extends JavaClassDescriptor {
-
-	public DefaultJavaClassDescriptor(Class&lt;?&gt; type) {
-		super(type);
-	}
-
-	@Override
-	protected List&lt;Property&gt; introspectProperties() {
-		List&lt;Property&gt; properties = null;
-		Class&lt;?&gt; type = getType();
-
-		if (!isExternalizable() &amp;&amp; !Map.class.isAssignableFrom(type)
-				&amp;&amp; !Hashtable.class.isAssignableFrom(type)) {
-			properties = new ArrayList&lt;Property&gt;();
-
-			try {
-				Set&lt;String&gt; propertyNames = new HashSet&lt;String&gt;();
-
-				// Add read/write properties (ie: public getter/setter).
-				BeanInfo info = Introspector.getBeanInfo(type);
-				for (PropertyDescriptor property : info
-						.getPropertyDescriptors()) {
-					String propertyName = property.getName();
-					if (property.getWriteMethod() != null
-							&amp;&amp; property.getReadMethod() != null) {
-						properties.add(new MethodProperty(propertyName,
-								property.getWriteMethod(), property
-										.getReadMethod()));
-						propertyNames.add(propertyName);
-					}
-				}
-
-				// Add other public fields.
-				Field[] fields = type.getFields();
-				for (Field field : fields) {
-					String propertyName = field.getName();
-					if (!propertyNames.contains(propertyName)
-							&amp;&amp; !Modifier.isStatic(field.getModifiers())
-							&amp;&amp; !Modifier.isTransient(field.getModifiers())) {
-						properties.add(new FieldProperty(field));
-						propertyNames.add(propertyName);
-					}
-				}
-			} catch (RuntimeException e) {
-				throw e;
-			} catch (Exception e) {
-				throw new RuntimeException(e);
-			}
-		}
-
-		return properties;
-	}
-}
+/*
+  GRANITE DATA SERVICES
+  Copyright (C) 2007-2008 ADEQUATE SYSTEMS SARL
+
+  This file is part of Granite Data Services.
+
+  Granite Data Services is free software; you can redistribute it and/or modify
+  it under the terms of the GNU Lesser General Public License as published by
+  the Free Software Foundation; either version 3 of the License, or (at your
+  option) any later version.
+
+  Granite Data Services is distributed in the hope that it will be useful, but
+  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
+  for more details.
+
+  You should have received a copy of the GNU Lesser General Public License
+  along with this library; if not, see &lt;http://www.gnu.org/licenses/&gt;.
+*/
+
+package org.granite.messaging.amf.io.util;
+
+import java.beans.BeanInfo;
+import java.beans.Introspector;
+import java.beans.PropertyDescriptor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * @author Franck WOLFF
+ */
+public class DefaultJavaClassDescriptor extends JavaClassDescriptor {
+
+	public DefaultJavaClassDescriptor(Class&lt;?&gt; type) {
+		super(type);
+	}
+
+	@Override
+	protected List&lt;Property&gt; introspectProperties() {
+		List&lt;Property&gt; properties = null;
+		Class&lt;?&gt; type = getType();
+
+		if (!isExternalizable() &amp;&amp; !Map.class.isAssignableFrom(type)
+				&amp;&amp; !Hashtable.class.isAssignableFrom(type)) {
+			properties = new ArrayList&lt;Property&gt;();
+
+			try {
+				Set&lt;String&gt; propertyNames = new HashSet&lt;String&gt;();
+
+				// Add read/write properties (ie: public getter/setter).
+				BeanInfo info = Introspector.getBeanInfo(type);
+				for (PropertyDescriptor property : info
+						.getPropertyDescriptors()) {
+					String propertyName = property.getName();
+					if (/*property.getWriteMethod() != null*
+							&amp;&amp;*/ property.getReadMethod() != null &amp;&amp; !property.getPropertyType().equals(Class.class)) {
+						properties.add(new MethodProperty(propertyName,
+								property.getWriteMethod(), property
+										.getReadMethod()));
+						propertyNames.add(propertyName);
+					}
+				}
+
+				// Add other public fields.
+				Field[] fields = type.getFields();
+				for (Field field : fields) {
+					String propertyName = field.getName();
+					if (!propertyNames.contains(propertyName)
+							&amp;&amp; !Modifier.isStatic(field.getModifiers())
+							&amp;&amp; !Modifier.isTransient(field.getModifiers())) {
+						properties.add(new FieldProperty(field));
+						propertyNames.add(propertyName);
+					}
+				}
+				
+				if (Enum.class.isAssignableFrom(type)) {
+					properties.add(new MethodProperty(&quot;name&quot;, null, type.getMethod(&quot;name&quot;)));
+					propertyNames.add(&quot;name&quot;);
+				}
+			} catch (RuntimeException e) {
+				throw e;
+			} catch (Exception e) {
+				throw new RuntimeException(e);
+			}
+		}
+
+		return properties;
+	}
+}</diff>
      <filename>uk.co.arum.osgi.amf3/src/org/granite/messaging/amf/io/util/DefaultJavaClassDescriptor.java</filename>
    </modified>
    <modified>
      <diff>@@ -49,8 +49,6 @@ public class MethodProperty extends Property {
 	public void setProperty(Object instance, Object value, boolean convert) {
 
 		/*
-		 * FIXME review
-		 * 
 		 * Basically, what is happening here is that if a property that is
 		 * supposedly an AMF Object is being set to null, it is coming through
 		 * as a type 0x9 element (array) with a single null value, rather than a</diff>
      <filename>uk.co.arum.osgi.amf3/src/org/granite/messaging/amf/io/util/MethodProperty.java</filename>
    </modified>
    <modified>
      <diff>@@ -84,18 +84,19 @@ public class GlueManager {
 
 		// might be that this class doesn't require any bindings,
 		// so check to be sure
-		if (!active) {
+		if (!active &amp;&amp; allBindings.size() == 0) {
 			check();
 		}
 
 	}
 
-	private void extractBindings(Glueable glueable, String bindMethodName,
-			String unbindMethodName, Map&lt;String, Bindings&gt; bindingMethods) {
+	private void extractBindings(Glueable glueable, String bindMethodPrefix,
+			String unbindMethodPrefix, Map&lt;String, Bindings&gt; bindingMethods) {
 
 		Method[] methods = glueable.getClass().getMethods();
 		for (Method bindMethod : methods) {
-			if (bindMethod.getName().startsWith(bindMethodName)
+			if (bindMethod.getName().startsWith(bindMethodPrefix)
+					&amp;&amp; !bindMethod.getName().equals(&quot;bindContext&quot;)
 					&amp;&amp; bindMethod.getParameterTypes().length == 1) {
 
 				Bindings bindings;
@@ -111,12 +112,12 @@ public class GlueManager {
 
 				// look for the extra part to the binding name
 				String extra = &quot;&quot;;
-				if (!bindMethod.getName().equals(bindMethodName)) {
+				if (!bindMethod.getName().equals(bindMethodPrefix)) {
 					extra = bindMethod.getName().substring(
-							bindMethodName.length());
+							bindMethodPrefix.length());
 				}
 
-				String actualUnbindMethodName = unbindMethodName + extra;
+				String actualUnbindMethodName = unbindMethodPrefix + extra;
 				try {
 					bindings.unbindMethod = glueable.getClass().getMethod(
 							actualUnbindMethodName, paramType);
@@ -128,7 +129,7 @@ public class GlueManager {
 				// developer to decide
 				if (null == bindings.unbindMethod) {
 					logService.log(LogService.LOG_INFO, &quot;No matching &quot;
-							+ unbindMethodName + &quot; method found #&quot;
+							+ unbindMethodPrefix + &quot; method found #&quot;
 							+ actualUnbindMethodName + &quot;(&quot;
 							+ paramType.getName() + &quot;)&quot;);
 				}</diff>
      <filename>uk.co.arum.osgi.glue/src/uk/co/arum/osgi/glue/bundle/GlueManager.java</filename>
    </modified>
  </modified>
  <removed type="array">
    <removed>
      <filename>uk.co.arum.osgi.amf3.flex.remoting/build.xml</filename>
    </removed>
    <removed>
      <filename>uk.co.arum.osgi.amf3.http/build.xml</filename>
    </removed>
    <removed>
      <filename>uk.co.arum.osgi.amf3.sample/build.xml</filename>
    </removed>
    <removed>
      <filename>uk.co.arum.osgi.amf3/build.xml</filename>
    </removed>
    <removed>
      <filename>uk.co.arum.osgi.glue.sample/build.xml</filename>
    </removed>
    <removed>
      <filename>uk.co.arum.osgi.glue/build.xml</filename>
    </removed>
    <removed>
      <filename>uk.co.arum.osgi.log.sysout/build.xml</filename>
    </removed>
  </removed>
  <parents type="array">
    <parent>
      <id>5cd84e14e06eedef9b90870f38355ac9758092cf</id>
    </parent>
  </parents>
  <author>
    <name>brindy</name>
    <email>brindy@brindy.org.uk</email>
  </author>
  <url>http://github.com/arum/bundles/commit/3340bed36e835fa4aff20d26c0875a79b73ed131</url>
  <id>3340bed36e835fa4aff20d26c0875a79b73ed131</id>
  <committed-date>2009-09-30T10:16:15-07:00</committed-date>
  <authored-date>2009-09-30T10:16:15-07:00</authored-date>
  <message>various fixes and improvements (will start using jira from now on)</message>
  <tree>1111e8cf93c8fa2b05f8d73122501e6aaf668be9</tree>
  <committer>
    <name>brindy</name>
    <email>brindy@brindy.org.uk</email>
  </committer>
</commit>
