Added: 
sling/whiteboard/dklco/sling-proxy/src/main/java/org/apache/sling/commons/proxy/impl/reflection/Classes.java
URL: 
http://svn.apache.org/viewvc/sling/whiteboard/dklco/sling-proxy/src/main/java/org/apache/sling/commons/proxy/impl/reflection/Classes.java?rev=1476301&view=auto
==============================================================================
--- 
sling/whiteboard/dklco/sling-proxy/src/main/java/org/apache/sling/commons/proxy/impl/reflection/Classes.java
 (added)
+++ 
sling/whiteboard/dklco/sling-proxy/src/main/java/org/apache/sling/commons/proxy/impl/reflection/Classes.java
 Fri Apr 26 17:13:19 2013
@@ -0,0 +1,110 @@
+/*
+ * 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.sling.commons.proxy.impl.reflection;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Proxy;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * Methods for simplifying reflection class calls.
+ */
+public final class Classes {
+
+       /**
+        * Get all of the member fields for Object 'obj' - including private,
+        * protected, default, and Public. This does not include inherited 
fields.
+        * This will not include Synthetic fields either.
+        * 
+        * @param obj
+        *            Object
+        * @return List<Field> the list of Fields from an Object
+        */
+       public static List<Field> getFields(Object obj) {
+               java.util.ArrayList<Field> list = new 
java.util.ArrayList<Field>();
+
+               Class<?> c = obj.getClass();
+               for (; c != null && c != Object.class;) {
+                       for (Field f : c.getDeclaredFields()) {
+                               if (!f.isSynthetic()) {
+                                       list.add(f);
+                               }
+                       }
+                       c = c.getSuperclass();
+               }
+
+               list.trimToSize();
+               return list;
+       }
+
+       /**
+        * To have the same set of interfaces the two Objects must be one of the
+        * following: > be equal in identity to one another, or both NULL > 
have 0
+        * interfaces and either be Proxy Classes or be the same Type > must 
have
+        * the same number of interfaces, and the same interfaces
+        * 
+        * @param o1
+        * @param o2
+        * @return TRUE if the objects have the same interfaces, FALSE otherwise
+        */
+       public static boolean haveSameInterfaces(Object o1, Object o2) {
+               if (o1 == o2) {
+                       return true;
+               }
+
+               Class<?>[] ca1 = o1.getClass().getInterfaces();
+               Class<?>[] ca2 = o2.getClass().getInterfaces();
+               int size1 = size(ca1);
+               if (size1 != size(ca2)) {
+                       return false;
+               }
+               if (size1 < 1) {
+                       if (Proxy.isProxyClass(o1.getClass())
+                                       && Proxy.isProxyClass(o2.getClass())) {
+                               return true;
+                       } else if (o1.getClass() == o2.getClass()) {
+                               return true;
+                       }
+                       return false;
+               }
+
+               Set<Class<?>> set = new java.util.HashSet<Class<?>>(size1);
+               for (Class<?> c : ca1) {
+                       set.add(c);
+               }
+               for (Class<?> c : ca2) {
+                       set.remove(c);
+               }
+               return set.size() < 1;
+       }
+
+
+       /**
+        * Checks the size of the class arraym return the size or -1 if the 
array is
+        * null.
+        * 
+        * @param ca
+        *            the array to check
+        * @return the size of the array
+        */
+       private static final int size(Class<?>[] ca) {
+               return (ca != null ? ca.length : -1);
+       }
+}

Added: 
sling/whiteboard/dklco/sling-proxy/src/main/java/org/apache/sling/commons/proxy/impl/reflection/Methods.java
URL: 
http://svn.apache.org/viewvc/sling/whiteboard/dklco/sling-proxy/src/main/java/org/apache/sling/commons/proxy/impl/reflection/Methods.java?rev=1476301&view=auto
==============================================================================
--- 
sling/whiteboard/dklco/sling-proxy/src/main/java/org/apache/sling/commons/proxy/impl/reflection/Methods.java
 (added)
+++ 
sling/whiteboard/dklco/sling-proxy/src/main/java/org/apache/sling/commons/proxy/impl/reflection/Methods.java
 Fri Apr 26 17:13:19 2013
@@ -0,0 +1,89 @@
+/*
+ * 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.sling.commons.proxy.impl.reflection;
+
+import java.lang.reflect.Method;
+import java.util.List;
+
+/**
+ * Methods for simplifying reflection method calls.
+ */
+public final class Methods {
+
+       /**
+        * Returns a list of all of the Getter methods for a specified object.
+        * 
+        * @param o
+        *            the object to check
+        * @return the list of getter methods
+        */
+       public static List<Method> getterMethods(Object o) {
+               List<Method> list = getMethods(o, "^(get|is)\\w*$", true, 0);
+               return list;
+       }
+
+       /**
+        * 
+        * @param o
+        *            Object - the target Object
+        * @param nameRegex
+        *            String - the regex to use for matching method names. If 
left
+        *            NULL, this will use: ^.*$
+        * @param hasReturn
+        *            boolean - switch to check wether or not the method has a
+        *            return value. TRUE it will be checked, false return type 
is
+        *            ignored.
+        * @param numberOfParameters
+        *            int - The number of arguments the method must have. A 
negative
+        *            value will ignore arguments, otherwise the number of 
arguments
+        *            is checked.
+        * @return List<Method>
+        */
+       public static List<Method> getMethods(Object o, String nameRegex,
+                       boolean hasReturn, int numberOfParameters) {
+               nameRegex = (nameRegex == null || nameRegex.trim().length() < 1 
? "^.*$"
+                               : nameRegex);
+
+               List<Method> list = new java.util.ArrayList<Method>();
+               Method[] ma = o.getClass().getMethods();
+
+               if (ma != null && ma.length > 0) {
+                       for (Method m : ma) {
+                               boolean checkReturnOK = true;
+                               if (hasReturn) {
+                                       Class<?> c = m.getReturnType();
+                                       checkReturnOK = (c != null && c != 
Void.class);
+                               }
+                               if (checkReturnOK) {
+                                       Class<?>[] ca = m.getParameterTypes();
+                                       int size = (ca == null ? 0 : ca.length);
+
+                                       if (numberOfParameters < 0 || size == 
numberOfParameters) {
+                                               String name = m.getName();
+                                               if (name.matches(nameRegex)) {
+                                                       list.add(m);
+                                               }
+                                       }
+                               }
+                       }
+               }
+
+               return list;
+       }
+}

Added: 
sling/whiteboard/dklco/sling-proxy/src/main/java/org/apache/sling/commons/proxy/impl/reflection/package.html
URL: 
http://svn.apache.org/viewvc/sling/whiteboard/dklco/sling-proxy/src/main/java/org/apache/sling/commons/proxy/impl/reflection/package.html?rev=1476301&view=auto
==============================================================================
--- 
sling/whiteboard/dklco/sling-proxy/src/main/java/org/apache/sling/commons/proxy/impl/reflection/package.html
 (added)
+++ 
sling/whiteboard/dklco/sling-proxy/src/main/java/org/apache/sling/commons/proxy/impl/reflection/package.html
 Fri Apr 26 17:13:19 2013
@@ -0,0 +1,7 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head></head>
+<body>
+  Provides helper classes for interacting with Classes, Annotations and 
Methods.
+</body>
+</html>
\ No newline at end of file

Added: 
sling/whiteboard/dklco/sling-proxy/src/main/java/org/apache/sling/commons/proxy/impl/to/BaseInvokedTO.java
URL: 
http://svn.apache.org/viewvc/sling/whiteboard/dklco/sling-proxy/src/main/java/org/apache/sling/commons/proxy/impl/to/BaseInvokedTO.java?rev=1476301&view=auto
==============================================================================
--- 
sling/whiteboard/dklco/sling-proxy/src/main/java/org/apache/sling/commons/proxy/impl/to/BaseInvokedTO.java
 (added)
+++ 
sling/whiteboard/dklco/sling-proxy/src/main/java/org/apache/sling/commons/proxy/impl/to/BaseInvokedTO.java
 Fri Apr 26 17:13:19 2013
@@ -0,0 +1,140 @@
+/*
+ * 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.sling.commons.proxy.impl.to;
+
+import java.lang.reflect.Method;
+
+import org.apache.sling.commons.proxy.impl.lang.MethodType;
+
+/**
+ * BaseInvokedTO - Transfer Object Meant as a convenient way to maintain and
+ * pass a method invocation around The members are not private because the 
class
+ * is package protected and they are final.
+ */
+public class BaseInvokedTO implements InvokedTO {
+
+       /**
+        * The method being invoked
+        */
+       private final Method method;
+
+       /**
+        * The path from the annotations
+        */
+       private final String path;
+
+       /**
+        * The type of method being invoked
+        */
+       private final MethodType mt;
+
+       /**
+        * Constructs a new Base Invoked Transfer Object.
+        * 
+        * @param method
+        *            the method being invoked
+        * @param path
+        *            the path from the annotations
+        * @param mt
+        *            the type of method being invoked
+        */
+       protected BaseInvokedTO(final Method method, final String path,
+                       final MethodType mt) {
+               this.method = method;
+               this.path = path;
+               this.mt = mt;
+       }
+
+       /**
+        * Gets the invoked method.
+        * 
+        * @return the method
+        */
+       public final Method getMethod() {
+               return this.method;
+       }
+
+       /**
+        * Gets the method type, derived from the method name.
+        * 
+        * @return the method type
+        */
+       public final MethodType getMt() {
+               return this.mt;
+       }
+
+       /**
+        * Gets the path specified in the annotation.
+        * 
+        * @return the path
+        */
+       public final String getPath() {
+               return this.path;
+       }
+
+       /*
+        * (non-Javadoc)
+        * 
+        * @see org.apache.sling.commons.proxy.impl.InvokedTO#isAbsolute()
+        */
+       public boolean isAbsolute() {
+               return (this.path != null) && this.path.startsWith("/");
+       }
+
+       /*
+        * (non-Javadoc)
+        * 
+        * @see org.apache.sling.commons.proxy.impl.InvokedTO#isGetter()
+        */
+       public boolean isGetter() {
+               return MethodType.contains(new MethodType[] { 
MethodType.JavaBeanIs,
+                               MethodType.JavaBeanGet }, this.mt);
+       }
+
+       /*
+        * (non-Javadoc)
+        * 
+        * @see org.apache.sling.commons.proxy.impl.InvokedTO#isJavaBean()
+        */
+       public boolean isJavaBean() {
+               return MethodType.contains(new MethodType[] { 
MethodType.JavaBeanIs,
+                               MethodType.JavaBeanGet, MethodType.JavaBeanSet 
}, this.mt);
+       }
+
+       /*
+        * (non-Javadoc)
+        * 
+        * @see org.apache.sling.commons.proxy.impl.InvokedTO#isRelative()
+        */
+       public boolean isRelative() {
+               return (this.path != null) && !this.isAbsolute()
+                               && this.path.contains("/");
+       }
+
+       /*
+        * (non-Javadoc)
+        * 
+        * @see
+        * org.apache.sling.commons.proxy.impl.InvokedTO#isType(org.apache.sling
+        * .commons.proxy.impl.lang.MethodType)
+        */
+       public boolean isType(final MethodType _mt) {
+               return this.mt == _mt;
+       }
+}

Added: 
sling/whiteboard/dklco/sling-proxy/src/main/java/org/apache/sling/commons/proxy/impl/to/InvokedChildrenTO.java
URL: 
http://svn.apache.org/viewvc/sling/whiteboard/dklco/sling-proxy/src/main/java/org/apache/sling/commons/proxy/impl/to/InvokedChildrenTO.java?rev=1476301&view=auto
==============================================================================
--- 
sling/whiteboard/dklco/sling-proxy/src/main/java/org/apache/sling/commons/proxy/impl/to/InvokedChildrenTO.java
 (added)
+++ 
sling/whiteboard/dklco/sling-proxy/src/main/java/org/apache/sling/commons/proxy/impl/to/InvokedChildrenTO.java
 Fri Apr 26 17:13:19 2013
@@ -0,0 +1,65 @@
+/*
+ * 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.sling.commons.proxy.impl.to;
+
+import java.lang.reflect.Method;
+
+import org.apache.sling.commons.proxy.impl.lang.MethodType;
+
+/**
+ * Transfer object for SlingChildren method invocations.
+ */
+public final class InvokedChildrenTO extends BaseInvokedTO {
+
+       /**
+        * The generic type to return when constructing the Iterator of 
children.
+        */
+       private final Class<?> returnType;
+
+       /**
+        * Constructs a new Invoked Children Transfer Object.
+        * 
+        * @param method
+        *            the invoked method
+        * @param args
+        *            the method arguments
+        * @param path
+        *            the path specified in the annotation
+        * @param returnType
+        *            the return type specified in the annotation
+        * @param mt
+        *            the method type
+        */
+       protected InvokedChildrenTO(final Method method, final Object[] args,
+                       final String path, final Class<?> returnType, final 
MethodType mt) {
+               super(method, path, mt);
+               this.returnType = returnType;
+       }
+
+       /**
+        * Gets the generic type to return when constructing the Iterator of
+        * children.
+        * 
+        * @return the returnType
+        */
+       public final Class<?> getReturnType() {
+               return this.returnType;
+       }
+
+}

Added: 
sling/whiteboard/dklco/sling-proxy/src/main/java/org/apache/sling/commons/proxy/impl/to/InvokedPropertyTO.java
URL: 
http://svn.apache.org/viewvc/sling/whiteboard/dklco/sling-proxy/src/main/java/org/apache/sling/commons/proxy/impl/to/InvokedPropertyTO.java?rev=1476301&view=auto
==============================================================================
--- 
sling/whiteboard/dklco/sling-proxy/src/main/java/org/apache/sling/commons/proxy/impl/to/InvokedPropertyTO.java
 (added)
+++ 
sling/whiteboard/dklco/sling-proxy/src/main/java/org/apache/sling/commons/proxy/impl/to/InvokedPropertyTO.java
 Fri Apr 26 17:13:19 2013
@@ -0,0 +1,182 @@
+/*
+ * 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.sling.commons.proxy.impl.to;
+
+import java.lang.reflect.Method;
+
+import org.apache.sling.commons.proxy.annotations.SlingProperty;
+import org.apache.sling.commons.proxy.impl.lang.MethodType;
+
+/**
+ * InvokedPropertyTO - Transfer Object Meant as a convenient way to maintain 
and
+ * pass a method invocation around The members are not private because the 
class
+ * is package protected and they are final.
+ */
+public final class InvokedPropertyTO extends BaseInvokedTO {
+
+       /** The default bytes. */
+       private final byte[] defaultBytes;
+
+       /** The default date. */
+       private final long defaultDate;
+
+       /** The default double. */
+       private final double defaultDouble;
+
+       /** The default long. */
+       private final long defaultLong;
+
+       /** The default string. */
+       private final String defaultString;
+
+       /** The default strings. */
+       private final String[] defaultStrings;
+
+       /** The property name specified in the annotation. */
+       private final String name;
+
+       /**
+        * The full property name, calculated from the path and name from the
+        * annotation parameters.
+        */
+       private final String propertyName;
+
+       /** The use default flag. */
+       private final boolean useDefault;
+
+       private final boolean defaultBoolean;
+
+       /**
+        * Constructs a new Invoked Transfer Object.
+        * 
+        * @param method
+        *            the invoked method
+        * @param args
+        *            the method arguments
+        * @param path
+        *            the path annotation value
+        * @param name
+        *            the name annotation value
+        * @param mt
+        *            the type of method invoked
+        */
+       protected InvokedPropertyTO(final Method method, final Object[] args,
+                       final String path, final String name, final MethodType 
mt) {
+               super(method, path, mt);
+               this.name = name;
+               this.propertyName = (path != null ? path + "/" : "") + name;
+
+               final SlingProperty sp = 
method.getAnnotation(SlingProperty.class);
+               this.defaultBoolean = sp.defaultBoolean();
+               this.defaultBytes = sp.defaultBytes();
+               this.defaultDate = sp.defaultDate();
+               this.defaultDouble = sp.defaultDouble();
+               this.defaultLong = sp.defaultLong();
+               this.defaultString = sp.defaultString();
+               this.defaultStrings = sp.defaultStrings();
+               this.useDefault = sp.useDefault();
+
+       }
+
+       public boolean getDefaultBoolean() {
+               return this.defaultBoolean;
+       }
+
+       /**
+        * Gets the default bytes.
+        * 
+        * @return the default bytes
+        */
+       public byte[] getDefaultBytes() {
+               return this.defaultBytes;
+       }
+
+       /**
+        * Gets the default date.
+        * 
+        * @return the default date
+        */
+       public long getDefaultDate() {
+               return this.defaultDate;
+       }
+
+       /**
+        * Gets the default double.
+        * 
+        * @return the default double
+        */
+       public double getDefaultDouble() {
+               return this.defaultDouble;
+       }
+
+       /**
+        * Gets the default long.
+        * 
+        * @return the default long
+        */
+       public long getDefaultLong() {
+               return this.defaultLong;
+       }
+
+       /**
+        * Gets the default string.
+        * 
+        * @return the default string
+        */
+       public String getDefaultString() {
+               return this.defaultString;
+       }
+
+       /**
+        * Gets the default strings.
+        * 
+        * @return the default strings
+        */
+       public String[] getDefaultStrings() {
+               return this.defaultStrings;
+       }
+
+       /**
+        * Get the name annotation value.
+        * 
+        * @return the name
+        */
+       public String getName() {
+               return this.name;
+       }
+
+       /**
+        * Get the property name to retrieve, this is calculated from the 
annotation
+        * name and path.
+        * 
+        * @return the property name
+        */
+       public String getPropertyName() {
+               return this.propertyName;
+       }
+
+       /**
+        * Checks if is use default.
+        * 
+        * @return true, if is use default
+        */
+       public boolean isUseDefault() {
+               return this.useDefault;
+       }
+}

Added: 
sling/whiteboard/dklco/sling-proxy/src/main/java/org/apache/sling/commons/proxy/impl/to/InvokedTO.java
URL: 
http://svn.apache.org/viewvc/sling/whiteboard/dklco/sling-proxy/src/main/java/org/apache/sling/commons/proxy/impl/to/InvokedTO.java?rev=1476301&view=auto
==============================================================================
--- 
sling/whiteboard/dklco/sling-proxy/src/main/java/org/apache/sling/commons/proxy/impl/to/InvokedTO.java
 (added)
+++ 
sling/whiteboard/dklco/sling-proxy/src/main/java/org/apache/sling/commons/proxy/impl/to/InvokedTO.java
 Fri Apr 26 17:13:19 2013
@@ -0,0 +1,73 @@
+/*
+ * 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.sling.commons.proxy.impl.to;
+
+import org.apache.sling.commons.proxy.impl.lang.MethodType;
+
+/**
+ * Represents a method invocation on the InvocationHandler.
+ */
+public interface InvokedTO {
+
+       public static final InvokedTO UNKNOWN = new InvokedPropertyTO(null, 
null,
+                       null, null, MethodType.Unknown);
+
+       /**
+        * Determines if the item represented by this method Invocation is an
+        * absolute path reference, starts with a /.
+        * 
+        * @return TRUE if the path starts with /, FALSE otherwise
+        */
+       public boolean isAbsolute();
+
+       /**
+        * Determines if the current Invocation is a 'Getter' method - that is a
+        * method that starts with 'get' or 'is', has no arguments, and returns 
a
+        * value.
+        * 
+        * @return TRUE if it is a 'get' or 'is' method, FALSE otherwise
+        */
+       public boolean isGetter();
+
+       /**
+        * Determines if the current Invocation is named in the JavaBeans 
style, '
+        * that is 'get', 'is' or 'set'.
+        * 
+        * @return TRUE if the method is JavaBean compliant, FALSE otherwise
+        */
+       public boolean isJavaBean();
+
+       /**
+        * Determines if the item represented by this method Invocation is a
+        * relative path reference, that is a descendant of the backing Resource
+        * 
+        * @return TRUE if the path contains / but does not start with /, FALSE
+        *         otherwise
+        */
+       public boolean isRelative();
+
+       /**
+        * Determines if the current Invocation is of type 
<code>methodType</code>
+        * 
+        * @param methodType
+        *            MethodType
+        * @return TRUE if it is, FALSE otherwise
+        */
+       public boolean isType(MethodType methodType);
+}

Added: 
sling/whiteboard/dklco/sling-proxy/src/main/java/org/apache/sling/commons/proxy/impl/to/InvokedTOFactory.java
URL: 
http://svn.apache.org/viewvc/sling/whiteboard/dklco/sling-proxy/src/main/java/org/apache/sling/commons/proxy/impl/to/InvokedTOFactory.java?rev=1476301&view=auto
==============================================================================
--- 
sling/whiteboard/dklco/sling-proxy/src/main/java/org/apache/sling/commons/proxy/impl/to/InvokedTOFactory.java
 (added)
+++ 
sling/whiteboard/dklco/sling-proxy/src/main/java/org/apache/sling/commons/proxy/impl/to/InvokedTOFactory.java
 Fri Apr 26 17:13:19 2013
@@ -0,0 +1,98 @@
+/*
+ * 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.sling.commons.proxy.impl.to;
+
+import java.lang.reflect.Method;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.sling.commons.proxy.annotations.SlingChildren;
+import org.apache.sling.commons.proxy.annotations.SlingProperty;
+import org.apache.sling.commons.proxy.annotations.SlingReference;
+import org.apache.sling.commons.proxy.impl.lang.MethodType;
+import org.apache.sling.commons.proxy.impl.reflection.Annotations;
+
+/**
+ * Generates instances of InvokedTO's, based on the annotations available on 
the
+ * method, this will return the correct transfer object type.
+ */
+public class InvokedTOFactory {
+
+       /**
+        * Instantiates a new InvokedTO Object. This object will contain the
+        * relevant invocation properties for the method invocation
+        * 
+        * @param proxy
+        *            the proxy object
+        * @param method
+        *            the invoked method
+        * @param args
+        *            the method arguments
+        * @return the invocation TO
+        */
+       public static InvokedTO newInstance(final Object proxy,
+                       final Method method, final Object[] args) {
+
+               final MethodType mt = MethodType.getMethodType(method);
+               if (mt.equals(MethodType.BackingResource)
+                               || mt.equals(MethodType.Equals)
+                               || mt.equals(MethodType.HashCode)
+                               || mt.equals(MethodType.ToString)) {
+                       return new BaseInvokedTO(method, "", mt);
+               } else if (Annotations
+                               .methodHasAnnotation(method, 
SlingReference.class)) {
+                       final SlingReference sr = method
+                                       .getAnnotation(SlingReference.class);
+
+                       final String path = StringUtils.trim(sr.path());
+
+                       return new BaseInvokedTO(method, path, mt);
+               } else if (Annotations.methodHasAnnotation(method, 
SlingChildren.class)) {
+                       final SlingChildren sc = 
method.getAnnotation(SlingChildren.class);
+                       final String path = StringUtils.trim(sc.path());
+                       final Class<?> returnType = sc.returnType();
+
+                       return new InvokedChildrenTO(method, args, path, 
returnType, mt);
+               } else {
+                       final SlingProperty sp = 
method.getAnnotation(SlingProperty.class);
+                       if (sp == null) {
+                               throw new 
java.lang.IllegalStateException("Method "
+                                               + method.getName() + " on class 
"
+                                               + 
method.getClass().getCanonicalName()
+                                               + " does not have required 
annotations");
+                       }
+
+                       final String path = StringUtils.trim(sp.path());
+                       final String name = StringUtils.trim(sp.name());
+
+                       String property = (path.length() > 0 ? path + "/" : 
path) + name;
+                       if ((property == null) || (property.length() < 1)) {
+                               property = MethodType.getBeanName(mt, method);
+                               property = property.replace("_", ":");
+                       }
+                       if ((property == null) || (property.length() < 1)) {
+                               final String msg = "Could not determine Bean 
Property name either from @SlingProperty annotation or the JavaBean method 
name.";
+                               throw new IllegalStateException(msg);
+                       }
+
+                       return new InvokedPropertyTO(method, args, path, name, 
mt);
+               }
+
+       }
+
+}

Added: 
sling/whiteboard/dklco/sling-proxy/src/main/java/org/apache/sling/commons/proxy/impl/to/package.html
URL: 
http://svn.apache.org/viewvc/sling/whiteboard/dklco/sling-proxy/src/main/java/org/apache/sling/commons/proxy/impl/to/package.html?rev=1476301&view=auto
==============================================================================
--- 
sling/whiteboard/dklco/sling-proxy/src/main/java/org/apache/sling/commons/proxy/impl/to/package.html
 (added)
+++ 
sling/whiteboard/dklco/sling-proxy/src/main/java/org/apache/sling/commons/proxy/impl/to/package.html
 Fri Apr 26 17:13:19 2013
@@ -0,0 +1,7 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head></head>
+<body>
+  Provides the Transfer Objects for transferring method invocation data.
+</body>
+</html>
\ No newline at end of file

Added: 
sling/whiteboard/dklco/sling-proxy/src/main/java/org/apache/sling/commons/proxy/package.html
URL: 
http://svn.apache.org/viewvc/sling/whiteboard/dklco/sling-proxy/src/main/java/org/apache/sling/commons/proxy/package.html?rev=1476301&view=auto
==============================================================================
--- 
sling/whiteboard/dklco/sling-proxy/src/main/java/org/apache/sling/commons/proxy/package.html
 (added)
+++ 
sling/whiteboard/dklco/sling-proxy/src/main/java/org/apache/sling/commons/proxy/package.html
 Fri Apr 26 17:13:19 2013
@@ -0,0 +1,7 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head></head>
+<body>
+  Provides an implementation of the Java Dynamic Proxy API for Apache Sling.
+</body>
+</html>
\ No newline at end of file

Added: sling/whiteboard/dklco/sling-proxy/src/site/proxy.mdtext
URL: 
http://svn.apache.org/viewvc/sling/whiteboard/dklco/sling-proxy/src/site/proxy.mdtext?rev=1476301&view=auto
==============================================================================
--- sling/whiteboard/dklco/sling-proxy/src/site/proxy.mdtext (added)
+++ sling/whiteboard/dklco/sling-proxy/src/site/proxy.mdtext Fri Apr 26 
17:13:19 2013
@@ -0,0 +1,46 @@
+Title: Sling Proxy
+
+Sling Proxy allows you to develop interfaces which will be instantiated with 
properties from the Sling repository at runtime.  Sling Proxy uses the [Java 
Dynamic Proxies 
API|http://docs.oracle.com/javase/1.4.2/docs/guide/reflection/proxy.html] to 
dynamically handle method calls against the interface.  The Sling Proxy API 
allows you to avoid having to write custom code to handle the mapping of Sling 
properties to Java fields allowing you to spend less time on boilerplate code 
and more on your application.  
+
+## Creating a Sling Proxy
+
+To create a Sling Proxy, simply create an interface which extends the 
SlingProxy interface.  All methods on the interface should either correspond to 
Resource properties through the Java Bean standards, via the method name, or 
should use the @SlingProperty annotation to override the path and/or property 
name.
+
+### Method Name Mapping
+
+Sling Proxy, by default uses the method name to determine which property to 
retrieve from the underlying Resource.  In order to map the method name to the 
corresponding property on the underlying resource, the Proxy service performs 
the following steps: 
+
+1. If the method name is JavaBean compliant, remove the get or is and convert 
the first letter to lower case
+2. Check to see if a property exists with the name, if so use that name
+3. Replace the first uppercase character with a colon and the equivalent lower 
case character
+4. Check to see if a property exists with the name, if so use that name
+
+If no corresponding property can be found, null is returned.  This behavior 
can be overridden by using the @SlingProperty annotation or by using custom 
annotations.
+
+## Retrieving a Sling Proxy Instance
+
+To retrieve a Sling Proxy instance, retrieve a reference to the 
SlingProxyService.  This service has one method, getProxy, which allows you to 
retrieve a proxy implemetation:
+
+    SlingProxyService slingProxyService = 
sling.getService(SlingProxyService.class);
+    MySlingProxy mySlingProxy = slingProxyService.getProxy(resource, 
MySlingProxy.class);
+
+## Making your Sling Proxy adaptable
+
+Using the SlingProxyService is convenient, but with a little more code, you 
can adapt Sling Resources directly to your Proxy interfaces.  To enable 
adapting resources to your proxy interfaces, create a AdapterFactory service, 
which extends the AbstractProxyAdapterFactory class.  For example:
+
+    @Component(label = "File Proxy Adapter Factory", name = 
"org.apache.sling.commons.proxy.test.FileProxyAdapterFactory", metatype = true, 
immediate = true)
+    @Service(value = AdapterFactory.class)
+    @Properties(value = {
+               @Property(name = AdapterFactory.ADAPTABLE_CLASSES, value = 
"org.apache.sling.api.resource.Resource"),
+               @Property(name = AdapterFactory.ADAPTER_CLASSES, value = 
"org.apache.sling.commons.proxy.test.FileProxy"),
+               @Property(name = "service.vendor", value = "The Apache Software 
Foundation"),
+               @Property(name = "service.description", value = "File Proxy 
Adapter Factory") })
+    public class FileProxyAdapterFactory extends AbstractProxyAdapterFactory {
+    
+    }
+
+The AbstractProxyAdapterFactory will automatically handle the default 
behavior, but you can of course override the default behavior to support more 
adaptables or perform pre/post-processing.
+
+## Overriding the Proxy Behavior
+
+To override the default behavior of the Sling Proxy, you can create custom 
Annotations and AnnotationHandlers to execute custom code when interface 
methods are invoked.   
\ No newline at end of file

Added: 
sling/whiteboard/dklco/sling-proxy/src/test/java/org/apache/sling/commons/proxy/BaseSlingProxyTest.java
URL: 
http://svn.apache.org/viewvc/sling/whiteboard/dklco/sling-proxy/src/test/java/org/apache/sling/commons/proxy/BaseSlingProxyTest.java?rev=1476301&view=auto
==============================================================================
--- 
sling/whiteboard/dklco/sling-proxy/src/test/java/org/apache/sling/commons/proxy/BaseSlingProxyTest.java
 (added)
+++ 
sling/whiteboard/dklco/sling-proxy/src/test/java/org/apache/sling/commons/proxy/BaseSlingProxyTest.java
 Fri Apr 26 17:13:19 2013
@@ -0,0 +1,80 @@
+/*
+ * 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.sling.commons.proxy;
+
+import org.apache.sling.commons.proxy.impl.DefaultSlingProxyServiceImpl;
+import org.apache.sling.commons.testing.sling.MockResource;
+import org.apache.sling.commons.testing.sling.MockResourceResolver;
+import org.junit.Before;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Base SlingProxy test class. Sets up the Sling mock objects.
+ */
+public class BaseSlingProxyTest {
+       public static final String TITLE = "My Title";
+       public static final String CONTENT_RESOURCE_TYPE = 
"myapp/components/page";
+       public static final String PAGE_RESOURCE_TYPE = "myapp:Page";
+       private final static Logger log = LoggerFactory
+                       .getLogger(TestSlingPropertyProxy.class);
+       protected final MockResourceResolver resolver = new 
MockResourceResolver();
+       protected final SlingProxyService slingProxyService = new 
DefaultSlingProxyServiceImpl();
+
+       /**
+        * Sets up the Sling mock objects
+        * 
+        * @throws Exception
+        */
+       @Before
+       public void init() throws Exception {
+               log.info("init");
+
+               log.info("Creating Mock Resources");
+               final MockResource pageResource = new MockResource(resolver,
+                               "/content/test", PAGE_RESOURCE_TYPE) {
+                       public <AdapterType> AdapterType 
adaptTo(Class<AdapterType> type) {
+                               if (SlingProxy.class.isAssignableFrom(type)) {
+                                       return slingProxyService.getProxy(this, 
type);
+                               } else {
+                                       return super.adaptTo(type);
+                               }
+                       }
+               };
+               pageResource.addProperty("sling:resourceType", 
PAGE_RESOURCE_TYPE);
+               resolver.addResource(pageResource);
+               final MockResource contentResource = new MockResource(resolver,
+                               "/content/test/jcr:content", 
CONTENT_RESOURCE_TYPE) {
+                       public <AdapterType> AdapterType 
adaptTo(Class<AdapterType> type) {
+                               if (SlingProxy.class.isAssignableFrom(type)) {
+                                       return slingProxyService.getProxy(this, 
type);
+                               } else {
+                                       return super.adaptTo(type);
+                               }
+                       }
+               };
+               contentResource.addProperty("jcr:title", TITLE);
+               contentResource
+                               .addProperty("sling:resourceType", 
CONTENT_RESOURCE_TYPE);
+               contentResource.addProperty("active", false);
+               resolver.addResource(contentResource);
+
+               log.info("Initialization complete");
+       }
+}

Added: 
sling/whiteboard/dklco/sling-proxy/src/test/java/org/apache/sling/commons/proxy/TestSlingPropertyProxy.java
URL: 
http://svn.apache.org/viewvc/sling/whiteboard/dklco/sling-proxy/src/test/java/org/apache/sling/commons/proxy/TestSlingPropertyProxy.java?rev=1476301&view=auto
==============================================================================
--- 
sling/whiteboard/dklco/sling-proxy/src/test/java/org/apache/sling/commons/proxy/TestSlingPropertyProxy.java
 (added)
+++ 
sling/whiteboard/dklco/sling-proxy/src/test/java/org/apache/sling/commons/proxy/TestSlingPropertyProxy.java
 Fri Apr 26 17:13:19 2013
@@ -0,0 +1,68 @@
+/*
+ * 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.sling.commons.proxy;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+import org.apache.sling.api.resource.Resource;
+import org.apache.sling.commons.proxy.samples.NoAnnotationSlingProxy;
+import org.apache.sling.commons.proxy.samples.SlingPropertyProxy;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Tests the Sling Proxy retrieval of properties. 
+ */
+public class TestSlingPropertyProxy extends BaseSlingProxyTest {
+       private static final Logger log = LoggerFactory
+                       .getLogger(TestSlingPropertyProxy.class);
+
+       @Test
+       public void runTests() {
+
+               log.info("runTests");
+
+               Resource resource = 
resolver.getResource("/content/test/jcr:content");
+               try {
+                       NoAnnotationSlingProxy simpleSlingProxy = resource
+                                       .adaptTo(NoAnnotationSlingProxy.class);
+                       fail("Expected UnsupportedOperationException getting: "
+                                       + simpleSlingProxy);
+               } catch (UnsupportedOperationException uoe) {
+                       log.debug("Passed initial test");
+               }
+
+               Resource pageResource = resolver.getResource("/content/test");
+               SlingPropertyProxy pageProxy = pageResource
+                               .adaptTo(SlingPropertyProxy.class);
+
+               log.info("Testing backing resource");
+               assertEquals(pageProxy.getBackingResource(), pageResource);
+
+               log.info("Testing property retrieval");
+               assertEquals(TITLE, pageProxy.getTitle());
+               assertEquals(PAGE_RESOURCE_TYPE, 
pageProxy.getSlingResourceType());
+               assertEquals(null, pageProxy.getNonExistentProperty());
+               assertEquals(false, pageProxy.isActive());
+
+               log.info("Tests Successful");
+       }
+}

Added: 
sling/whiteboard/dklco/sling-proxy/src/test/java/org/apache/sling/commons/proxy/lang/TestJDPEquals.java
URL: 
http://svn.apache.org/viewvc/sling/whiteboard/dklco/sling-proxy/src/test/java/org/apache/sling/commons/proxy/lang/TestJDPEquals.java?rev=1476301&view=auto
==============================================================================
--- 
sling/whiteboard/dklco/sling-proxy/src/test/java/org/apache/sling/commons/proxy/lang/TestJDPEquals.java
 (added)
+++ 
sling/whiteboard/dklco/sling-proxy/src/test/java/org/apache/sling/commons/proxy/lang/TestJDPEquals.java
 Fri Apr 26 17:13:19 2013
@@ -0,0 +1,80 @@
+/*
+ * 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.sling.commons.proxy.lang;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import org.apache.sling.api.resource.Resource;
+import org.apache.sling.commons.proxy.BaseSlingProxyTest;
+import org.apache.sling.commons.proxy.SlingProxyService;
+import org.apache.sling.commons.proxy.impl.DefaultSlingProxyServiceImpl;
+import org.apache.sling.commons.proxy.samples.DuplicateSlingPropertyProxy;
+import org.apache.sling.commons.proxy.samples.SlingPropertyProxy;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Tests for the Sling Proxy hashCode implementation.
+ */
+public class TestJDPEquals extends BaseSlingProxyTest {
+       private static final Logger log = LoggerFactory
+                       .getLogger(TestJDPEquals.class);
+
+       /**
+        * All of the tests for the hashCode implementation.
+        */
+       @Test
+       public void runTests() {
+
+               log.info("runTests");
+
+               Resource pageResource = resolver.getResource("/content/test");
+               SlingPropertyProxy pageProxy = pageResource
+                               .adaptTo(SlingPropertyProxy.class);
+
+               log.info("Testing Equals functionality");
+
+               log.info("Ensuring the same proxy interface from the same 
resource are equal");
+               SlingPropertyProxy pageProxy2 = pageResource
+                               .adaptTo(SlingPropertyProxy.class);
+               assertTrue(pageProxy.equals(pageProxy2));
+
+               log.info("Ensuring different proxy interfaces from the same 
resource are not equal");
+               DuplicateSlingPropertyProxy pageProxy3 = pageResource
+                               .adaptTo(DuplicateSlingPropertyProxy.class);
+               assertFalse(pageProxy.equals(pageProxy3));
+
+
+               log.info("Ensuring retrieving the same proxy from different 
proxy services are equal");
+               SlingProxyService slingProxyService2 = new 
DefaultSlingProxyServiceImpl();
+               SlingPropertyProxy pageProxy4 = slingProxyService2.getProxy(
+                               pageResource, SlingPropertyProxy.class);
+               assertTrue(pageProxy.equals(pageProxy4));
+               
+               log.info("Ensuring the same proxy interfaces from the differet 
resources are not equal");
+               Resource pageContentResource = 
resolver.getResource("/content/test/jcr:content");
+               SlingPropertyProxy pageProxy5 = pageContentResource
+                               .adaptTo(SlingPropertyProxy.class);
+               assertFalse(pageProxy.equals(pageProxy5));
+
+               log.info("Tests Successful");
+       }
+}

Added: 
sling/whiteboard/dklco/sling-proxy/src/test/java/org/apache/sling/commons/proxy/lang/TestJDPHashCode.java
URL: 
http://svn.apache.org/viewvc/sling/whiteboard/dklco/sling-proxy/src/test/java/org/apache/sling/commons/proxy/lang/TestJDPHashCode.java?rev=1476301&view=auto
==============================================================================
--- 
sling/whiteboard/dklco/sling-proxy/src/test/java/org/apache/sling/commons/proxy/lang/TestJDPHashCode.java
 (added)
+++ 
sling/whiteboard/dklco/sling-proxy/src/test/java/org/apache/sling/commons/proxy/lang/TestJDPHashCode.java
 Fri Apr 26 17:13:19 2013
@@ -0,0 +1,80 @@
+/*
+ * 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.sling.commons.proxy.lang;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertEquals;
+
+import org.apache.sling.api.resource.Resource;
+import org.apache.sling.commons.proxy.BaseSlingProxyTest;
+import org.apache.sling.commons.proxy.SlingProxyService;
+import org.apache.sling.commons.proxy.impl.DefaultSlingProxyServiceImpl;
+import org.apache.sling.commons.proxy.samples.DuplicateSlingPropertyProxy;
+import org.apache.sling.commons.proxy.samples.SlingPropertyProxy;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Tests for the Sling Proxy hashCode implementation.
+ */
+public class TestJDPHashCode extends BaseSlingProxyTest {
+       private static final Logger log = LoggerFactory
+                       .getLogger(TestJDPHashCode.class);
+
+       /**
+        * All of the tests for the hashCode implementation.
+        */
+       @Test
+       public void runTests() {
+
+               log.info("runTests");
+
+               Resource pageResource = resolver.getResource("/content/test");
+               SlingPropertyProxy pageProxy = pageResource
+                               .adaptTo(SlingPropertyProxy.class);
+
+               log.info("Testing Equals functionality");
+               int hashCode = pageProxy.hashCode();
+               assertNotNull(hashCode);
+               log.info("HashCode: " + hashCode);
+
+               log.info("Ensuring the same proxy interface from the same 
resource get the same hash code");
+               SlingPropertyProxy pageProxy2 = pageResource
+                               .adaptTo(SlingPropertyProxy.class);
+               log.info("HashCode1 {}, HashCode 2 {}", hashCode, 
pageProxy2.hashCode());
+               assertEquals(pageProxy2.hashCode(), hashCode);
+
+               log.info("Ensuring different proxy interfaces from the same 
resource get different hash codes");
+               DuplicateSlingPropertyProxy pageProxy3 = pageResource
+                               .adaptTo(DuplicateSlingPropertyProxy.class);
+               log.info("HashCode1 {}, HashCode 2 {}", hashCode, 
pageProxy3.hashCode());
+               assertFalse(pageProxy3.hashCode() == hashCode);
+
+               log.info("Ensuring retrieving the same proxy from different 
proxy services results in the same hashCode");
+               SlingProxyService slingProxyService2 = new 
DefaultSlingProxyServiceImpl();
+               SlingPropertyProxy pageProxy4 = slingProxyService2.getProxy(
+                               pageResource, SlingPropertyProxy.class);
+               log.info("HashCode1 {}, HashCode 2 {}", hashCode, 
pageProxy4.hashCode());
+               assertEquals(hashCode, pageProxy4.hashCode());
+
+               log.info("Tests Successful");
+       }
+}

Added: 
sling/whiteboard/dklco/sling-proxy/src/test/java/org/apache/sling/commons/proxy/lang/TestJDPToString.java
URL: 
http://svn.apache.org/viewvc/sling/whiteboard/dklco/sling-proxy/src/test/java/org/apache/sling/commons/proxy/lang/TestJDPToString.java?rev=1476301&view=auto
==============================================================================
--- 
sling/whiteboard/dklco/sling-proxy/src/test/java/org/apache/sling/commons/proxy/lang/TestJDPToString.java
 (added)
+++ 
sling/whiteboard/dklco/sling-proxy/src/test/java/org/apache/sling/commons/proxy/lang/TestJDPToString.java
 Fri Apr 26 17:13:19 2013
@@ -0,0 +1,56 @@
+/*
+ * 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.sling.commons.proxy.lang;
+
+import static org.junit.Assert.assertNotNull;
+
+import org.apache.sling.api.resource.Resource;
+import org.apache.sling.commons.proxy.BaseSlingProxyTest;
+import org.apache.sling.commons.proxy.samples.SlingPropertyProxy;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Tests for the SlingProxy toString method.
+ */
+public class TestJDPToString extends BaseSlingProxyTest {
+       private static final Logger log = LoggerFactory
+                       .getLogger(TestJDPToString.class);
+
+       /**
+        * Test the SlingProxy toString method.
+        */
+       @Test
+       public void runTests() {
+
+               log.info("runTests");
+
+               Resource pageResource = resolver.getResource("/content/test");
+               SlingPropertyProxy pageProxy = pageResource
+                               .adaptTo(SlingPropertyProxy.class);
+
+               log.info("Testing toString functionality");
+               String stringed = pageProxy.toString();
+               assertNotNull(stringed);
+               log.info(stringed);
+
+               log.info("Tests Successful");
+       }
+}

Added: 
sling/whiteboard/dklco/sling-proxy/src/test/java/org/apache/sling/commons/proxy/samples/DuplicateSlingPropertyProxy.java
URL: 
http://svn.apache.org/viewvc/sling/whiteboard/dklco/sling-proxy/src/test/java/org/apache/sling/commons/proxy/samples/DuplicateSlingPropertyProxy.java?rev=1476301&view=auto
==============================================================================
--- 
sling/whiteboard/dklco/sling-proxy/src/test/java/org/apache/sling/commons/proxy/samples/DuplicateSlingPropertyProxy.java
 (added)
+++ 
sling/whiteboard/dklco/sling-proxy/src/test/java/org/apache/sling/commons/proxy/samples/DuplicateSlingPropertyProxy.java
 Fri Apr 26 17:13:19 2013
@@ -0,0 +1,41 @@
+/*
+ * 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.sling.commons.proxy.samples;
+
+import org.apache.sling.commons.proxy.SlingProxy;
+import org.apache.sling.commons.proxy.annotations.SlingProperty;
+
+/**
+ * Duplicate of the SlingPropertyProxy class. This is used to see if really
+ * similar proxies are treated as different.
+ */
+public interface DuplicateSlingPropertyProxy extends SlingProxy {
+
+       @SlingProperty(path = "jcr:content")
+       public String getNonExistentProperty();
+
+       @SlingProperty(name = "sling:resourceType")
+       public String getSlingResourceType();
+
+       @SlingProperty(name = "jcr:title", path = "jcr:content")
+       public String getTitle();
+
+       @SlingProperty(path = "jcr:content", name = "active")
+       public Boolean isActive();
+}

Added: 
sling/whiteboard/dklco/sling-proxy/src/test/java/org/apache/sling/commons/proxy/samples/NoAnnotationSlingProxy.java
URL: 
http://svn.apache.org/viewvc/sling/whiteboard/dklco/sling-proxy/src/test/java/org/apache/sling/commons/proxy/samples/NoAnnotationSlingProxy.java?rev=1476301&view=auto
==============================================================================
--- 
sling/whiteboard/dklco/sling-proxy/src/test/java/org/apache/sling/commons/proxy/samples/NoAnnotationSlingProxy.java
 (added)
+++ 
sling/whiteboard/dklco/sling-proxy/src/test/java/org/apache/sling/commons/proxy/samples/NoAnnotationSlingProxy.java
 Fri Apr 26 17:13:19 2013
@@ -0,0 +1,71 @@
+/*
+ * 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.sling.commons.proxy.samples;
+
+import org.apache.sling.commons.proxy.SlingProxy;
+
+/**
+ * A simple proxy interface for testing the SlingProxy API. This proxy 
interface
+ * only utilizes the default property retrieval mechanism.
+ */
+public interface NoAnnotationSlingProxy extends SlingProxy {
+    
+       /**
+        * Gets the jcr:title attribute
+        * 
+        * @return
+        */
+       public String getJcrTitle();
+
+       /**
+        * Gets the sling:resourceType attribute.
+        * 
+        * @return
+        */
+       public String getSlingResourceType();
+
+       /**
+        * Another form of retrieving the jcr:title.
+        * 
+        * @return
+        */
+       public String jcrTitle();
+
+       /**
+        * Gets the active attribute.
+        * 
+        * @return
+        */
+       public Boolean isActive();
+
+       /**
+        * Gets the active attribute as a string.
+        * 
+        * @return
+        */
+       public String active();
+
+       /**
+        * Attempts to retrieve a property which does not exist.
+        * 
+        * @return
+        */
+       public String getNonExistentProperty();
+
+}

Added: 
sling/whiteboard/dklco/sling-proxy/src/test/java/org/apache/sling/commons/proxy/samples/SlingPropertyProxy.java
URL: 
http://svn.apache.org/viewvc/sling/whiteboard/dklco/sling-proxy/src/test/java/org/apache/sling/commons/proxy/samples/SlingPropertyProxy.java?rev=1476301&view=auto
==============================================================================
--- 
sling/whiteboard/dklco/sling-proxy/src/test/java/org/apache/sling/commons/proxy/samples/SlingPropertyProxy.java
 (added)
+++ 
sling/whiteboard/dklco/sling-proxy/src/test/java/org/apache/sling/commons/proxy/samples/SlingPropertyProxy.java
 Fri Apr 26 17:13:19 2013
@@ -0,0 +1,40 @@
+/*
+ * 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.sling.commons.proxy.samples;
+
+import org.apache.sling.commons.proxy.SlingProxy;
+import org.apache.sling.commons.proxy.annotations.SlingProperty;
+
+/**
+ * A simple proxy with only properties.
+ */
+public interface SlingPropertyProxy extends SlingProxy {
+
+       @SlingProperty(name = "jcr:title", path = "jcr:content")
+       public String getTitle();
+
+       @SlingProperty(name = "sling:resourceType")
+       public String getSlingResourceType();
+
+       @SlingProperty(path = "jcr:content", name = "active")
+       public Boolean isActive();
+
+       @SlingProperty(path = "jcr:content")
+       public String getNonExistentProperty();
+}

Added: 
sling/whiteboard/dklco/sling-proxy/src/test/resources/simplelogger.properties
URL: 
http://svn.apache.org/viewvc/sling/whiteboard/dklco/sling-proxy/src/test/resources/simplelogger.properties?rev=1476301&view=auto
==============================================================================
--- 
sling/whiteboard/dklco/sling-proxy/src/test/resources/simplelogger.properties 
(added)
+++ 
sling/whiteboard/dklco/sling-proxy/src/test/resources/simplelogger.properties 
Fri Apr 26 17:13:19 2013
@@ -0,0 +1 @@
+org.slf4j.simpleLogger.defaultLogLevel=trace
\ No newline at end of file


Reply via email to