This is an automated email from the ASF dual-hosted git repository. rombert pushed a commit to annotated tag org.apache.sling.scripting.sightly.testing-content-1.0.6 in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-scripting-sightly-testing-content.git
commit 577dc12d9cee12440527cec4807f5d8093eb9717 Author: Radu Cotescu <[email protected]> AuthorDate: Wed Sep 2 13:52:34 2015 +0000 SLING-4554 - Support for OSGi-services in data-sly-use * if the resolved class is an OSGi service return the service's instance git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/scripting/sightly/testing-content@1700816 13f79535-47bb-0310-9956-ffa450edef68 --- .../scripting/sightly/testing/use/TestService.java | 23 ++++++++++++++++ .../sightly/testing/use/impl/TestServiceImpl.java | 31 ++++++++++++++++++++++ .../SLING-INF/apps/sightly/scripts/use/use.html | 1 + 3 files changed, 55 insertions(+) diff --git a/src/main/java/org/apache/sling/scripting/sightly/testing/use/TestService.java b/src/main/java/org/apache/sling/scripting/sightly/testing/use/TestService.java new file mode 100644 index 0000000..5f6a6e2 --- /dev/null +++ b/src/main/java/org/apache/sling/scripting/sightly/testing/use/TestService.java @@ -0,0 +1,23 @@ +/******************************************************************************* + * 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.scripting.sightly.testing.use; + +public interface TestService { + + String sayHello(); + +} diff --git a/src/main/java/org/apache/sling/scripting/sightly/testing/use/impl/TestServiceImpl.java b/src/main/java/org/apache/sling/scripting/sightly/testing/use/impl/TestServiceImpl.java new file mode 100644 index 0000000..acc037f --- /dev/null +++ b/src/main/java/org/apache/sling/scripting/sightly/testing/use/impl/TestServiceImpl.java @@ -0,0 +1,31 @@ +/******************************************************************************* + * 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.scripting.sightly.testing.use.impl; + +import org.apache.felix.scr.annotations.Component; +import org.apache.felix.scr.annotations.Service; +import org.apache.sling.scripting.sightly.testing.use.TestService; + +@Component +@Service(TestService.class) +public class TestServiceImpl implements TestService { + + @Override + public String sayHello() { + return "Hello World!"; + } +} diff --git a/src/main/resources/SLING-INF/apps/sightly/scripts/use/use.html b/src/main/resources/SLING-INF/apps/sightly/scripts/use/use.html index 6efc1d8..b80eb37 100644 --- a/src/main/resources/SLING-INF/apps/sightly/scripts/use/use.html +++ b/src/main/resources/SLING-INF/apps/sightly/scripts/use/use.html @@ -28,5 +28,6 @@ data-sly-use.reqadapt="org.apache.sling.scripting.sightly.testing.adaptable.RequestAdapterUseObject">${reqadapt.title}</div> <div id="resadapt" data-sly-use.resadapt="org.apache.sling.scripting.sightly.testing.adaptable.ResourceAdapterUseObject">${resadapt.title}</div> + <div id="osgi" data-sly-use.osgi="org.apache.sling.scripting.sightly.testing.use.TestService">${osgi.sayHello}</div> </body> </html> \ No newline at end of file -- To stop receiving notification emails like this one, please contact "[email protected]" <[email protected]>.
