http://git-wip-us.apache.org/repos/asf/zest-java/blob/ab97249b/libraries/rest/src/main/java/org/apache/zest/library/rest/admin/ZestServerServlet.java ---------------------------------------------------------------------- diff --git a/libraries/rest/src/main/java/org/apache/zest/library/rest/admin/ZestServerServlet.java b/libraries/rest/src/main/java/org/apache/zest/library/rest/admin/ZestServerServlet.java new file mode 100644 index 0000000..c1cc393 --- /dev/null +++ b/libraries/rest/src/main/java/org/apache/zest/library/rest/admin/ZestServerServlet.java @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2008, Rickard Ãberg. All Rights Reserved. + * + * Licensed 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.zest.library.rest.admin; + +import org.apache.zest.api.injection.scope.Structure; +import org.apache.zest.api.structure.Module; +import org.restlet.Application; +import org.restlet.Context; +import org.restlet.ext.servlet.ServerServlet; + +/** + * Integration with Zest. Register an object extending Application to use. + */ +public class ZestServerServlet + extends ServerServlet +{ + @Structure + Module module; + + @Override + @SuppressWarnings( "unchecked" ) + protected Application createApplication( Context context ) + { + return module.newObject( Application.class, context.createChildContext(), getServletConfig(), getServletContext() ); + } +}
http://git-wip-us.apache.org/repos/asf/zest-java/blob/ab97249b/libraries/rest/src/main/java/org/apache/zest/library/rest/admin/ZestServerServletService.java ---------------------------------------------------------------------- diff --git a/libraries/rest/src/main/java/org/apache/zest/library/rest/admin/ZestServerServletService.java b/libraries/rest/src/main/java/org/apache/zest/library/rest/admin/ZestServerServletService.java new file mode 100644 index 0000000..21586eb --- /dev/null +++ b/libraries/rest/src/main/java/org/apache/zest/library/rest/admin/ZestServerServletService.java @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2008, Rickard Ãberg. All Rights Reserved. + * + * Licensed 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.zest.library.rest.admin; + +import javax.servlet.Servlet; +import org.apache.zest.api.mixin.Mixins; +import org.apache.zest.api.service.ServiceComposite; + +/** + * JAVADOC + */ +@Mixins( ZestServerServlet.class ) +public interface ZestServerServletService + extends Servlet, ServiceComposite +{ +} http://git-wip-us.apache.org/repos/asf/zest-java/blob/ab97249b/libraries/rest/src/main/resources/org/apache/zest/library/rest/admin/sparqlform.html ---------------------------------------------------------------------- diff --git a/libraries/rest/src/main/resources/org/apache/zest/library/rest/admin/sparqlform.html b/libraries/rest/src/main/resources/org/apache/zest/library/rest/admin/sparqlform.html index 83335f6..455639a 100644 --- a/libraries/rest/src/main/resources/org/apache/zest/library/rest/admin/sparqlform.html +++ b/libraries/rest/src/main/resources/org/apache/zest/library/rest/admin/sparqlform.html @@ -23,12 +23,12 @@ <body> <form method="GET" action=""> <label>Query:</label><br/> - <textarea rows="20" cols="80" name="query">PREFIX ns0: <urn:qi4j:type:org.qi4j.api.entity.Identity#> + <textarea rows="20" cols="80" name="query">PREFIX ns0: <urn:zest:type:org.apache.zest.api.entity.Identity#> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> SELECT DISTINCT ?entityType ?identity WHERE { - ?entityType rdfs:subClassOf <urn:qi4j:type:org.qi4j.api.entity.Entity>. + ?entityType rdfs:subClassOf <urn:zest:type:org.apache.zest.api.entity.Entity>. ?entity rdf:type ?entityType. ?entity ns0:identity ?identity. } @@ -40,12 +40,12 @@ <h3>Get all entities</h3> <pre> -PREFIX ns0: <urn:qi4j:type:org.qi4j.api.entity.Identity#> +PREFIX ns0: <urn:zest:type:org.apache.zest.api.entity.Identity#> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> SELECT DISTINCT ?entityType ?identity WHERE { - ?entityType rdfs:subClassOf <urn:qi4j:type:org.qi4j.api.entity.Entity>. + ?entityType rdfs:subClassOf <urn:zest:type:org.apache.zest.api.entity.Entity>. ?entity rdf:type ?entityType. ?entity ns0:identity ?identity. } @@ -53,26 +53,26 @@ PREFIX ns0: <urn:qi4j:type:org.qi4j.api.entity.Identity#> </pre> <h3>Get entities of a given type</h3> <pre> -PREFIX ns0: <urn:qi4j:type:org.qi4j.api.entity.Identity#> +PREFIX ns0: <urn:zest:type:org.apache.zest.api.entity.Identity#> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> SELECT DISTINCT ?identity WHERE { - ?entity rdf:type <urn:qi4j:type:org.qi4j.rest.TestEntity>. + ?entity rdf:type <urn:zest:type:org.apache.zest.rest.TestEntity>. ?entity ns0:identity ?identity. } </pre> <h3>Get entities with a given property value</h3> <pre> -PREFIX ns0: <urn:qi4j:type:org.qi4j.api.entity.Identity#> +PREFIX ns0: <urn:zest:type:org.apache.zest.api.entity.Identity#> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> SELECT DISTINCT ?identity WHERE { - ?entity rdf:type <urn:qi4j:type:org.qi4j.rest.TestEntity>. + ?entity rdf:type <urn:zest:type:org.apache.zest.rest.TestEntity>. ?entity ns0:identity ?identity. - ?entity <urn:qi4j:type:org.qi4j.rest.Named#name> "Foo bar" + ?entity <urn:zest:type:org.apache.zest.rest.Named#name> "Foo bar" } </pre> </body> http://git-wip-us.apache.org/repos/asf/zest-java/blob/ab97249b/libraries/rest/src/test/java/org/apache/zest/library/rest/admin/Main.java ---------------------------------------------------------------------- diff --git a/libraries/rest/src/test/java/org/apache/zest/library/rest/admin/Main.java b/libraries/rest/src/test/java/org/apache/zest/library/rest/admin/Main.java index e302f3e..c0d6920 100644 --- a/libraries/rest/src/test/java/org/apache/zest/library/rest/admin/Main.java +++ b/libraries/rest/src/test/java/org/apache/zest/library/rest/admin/Main.java @@ -33,8 +33,8 @@ public class Main public Main() throws Exception { - Energy4Java qi4j = new Energy4Java(); - application = qi4j.newApplication( new MainAssembler() ); + Energy4Java zest = new Energy4Java(); + application = zest.newApplication( new MainAssembler() ); application.activate(); } http://git-wip-us.apache.org/repos/asf/zest-java/blob/ab97249b/libraries/rest/src/test/java/org/apache/zest/library/rest/admin/RestTest.java ---------------------------------------------------------------------- diff --git a/libraries/rest/src/test/java/org/apache/zest/library/rest/admin/RestTest.java b/libraries/rest/src/test/java/org/apache/zest/library/rest/admin/RestTest.java index 6273b26..543ecf3 100644 --- a/libraries/rest/src/test/java/org/apache/zest/library/rest/admin/RestTest.java +++ b/libraries/rest/src/test/java/org/apache/zest/library/rest/admin/RestTest.java @@ -45,21 +45,21 @@ import org.apache.zest.bootstrap.ModuleAssembly; import org.apache.zest.entitystore.memory.MemoryEntityStoreService; import org.apache.zest.index.rdf.assembly.RdfMemoryStoreAssembler; import org.apache.zest.spi.uuid.UuidIdentityGeneratorService; -import org.apache.zest.test.AbstractQi4jTest; +import org.apache.zest.test.AbstractZestTest; import static org.hamcrest.CoreMatchers.anyOf; import static org.hamcrest.CoreMatchers.equalTo; import static org.junit.Assert.*; public class RestTest - extends AbstractQi4jTest + extends AbstractZestTest { @Override protected ApplicationDescriptor newApplication() throws AssemblyException { - return qi4j.newApplicationModel( new ApplicationAssemblerAdapter( new Assembler[][][] + return zest.newApplicationModel( new ApplicationAssemblerAdapter( new Assembler[][][] { { { @@ -123,12 +123,12 @@ public class RestTest // System.out.println( rdf.replaceAll( "\n", "\\\\n" ).replaceAll( "\"", "\\\\\"" ) ); assertThat( "Incorrect RDF produced", rdf, anyOf( // Open JDK 8 & Valid - equalTo( "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<rdf:RDF\n xmlns:qi4j=\"http://www.qi4j.org/rdf/model/1.0/\"\n xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"\n xmlns:rdfs=\"http://www.w3.org/2000/01/rdf-schema#\">\n<org.qi4j.library.rest.admin.RestTest-PersonEntity xmlns=\"urn:qi4j:type:\" rdf:about=\"urn:qi4j:entity:P1\">\n <lastname xmlns=\"urn:qi4j:type:org.qi4j.library.rest.admin.RestTest-Person#\">Doe</lastname>\n <firstname xmlns=\"urn:qi4j:type:org.qi4j.library.rest.admin.RestTest-Person#\">Joe</firstname>\n <identity xmlns=\"urn:qi4j:type:org.qi4j.api.entity.Identity#\">P1</identity>\n <mother xmlns=\"urn:qi4j:type:org.qi4j.library.rest.admin.RestTest-Person#\" rdf:resource=\"urn:qi4j:entity:P2\"/>\n</org.qi4j.library.rest.admin.RestTest-PersonEntity>\n\n</rdf:RDF>" ), - equalTo( "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<rdf:RDF\n xmlns:qi4j=\"http://www.qi4j.org/rdf/model/1.0/\"\n xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"\n xmlns:rdfs=\"http://www.w3.org/2000/01/rdf-schema#\">\n<org.qi4j.library.rest.admin.RestTest-PersonEntity xmlns=\"urn:qi4j:type:\" rdf:about=\"urn:qi4j:entity:P1\">\n <identity xmlns=\"urn:qi4j:type:org.qi4j.api.entity.Identity#\">P1</identity>\n <firstname xmlns=\"urn:qi4j:type:org.qi4j.library.rest.admin.RestTest-Person#\">Joe</firstname>\n <lastname xmlns=\"urn:qi4j:type:org.qi4j.library.rest.admin.RestTest-Person#\">Doe</lastname>\n <mother xmlns=\"urn:qi4j:type:org.qi4j.library.rest.admin.RestTest-Person#\" rdf:resource=\"urn:qi4j:entity:P2\"/>\n</org.qi4j.library.rest.admin.RestTest-PersonEntity>\n\n</rdf:RDF>" ), + equalTo( "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<rdf:RDF\n xmlns:zest=\"http://zest.apache.org/rdf/model/1.0/\"\n xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"\n xmlns:rdfs=\"http://www.w3.org/2000/01/rdf-schema#\">\n<org.apache.zest.library.rest.admin.RestTest-PersonEntity xmlns=\"urn:zest:type:\" rdf:about=\"urn:zest:entity:P1\">\n <lastname xmlns=\"urn:zest:type:org.apache.zest.library.rest.admin.RestTest-Person#\">Doe</lastname>\n <firstname xmlns=\"urn:zest:type:org.apache.zest.library.rest.admin.RestTest-Person#\">Joe</firstname>\n <identity xmlns=\"urn:zest:type:org.apache.zest.api.entity.Identity#\">P1</identity>\n <mother xmlns=\"urn:zest:type:org.apache.zest.library.rest.admin.RestTest-Person#\" rdf:resource=\"urn:zest:entity:P2\"/>\n</org.apache.zest.library.rest.admin.RestTest-PersonEntity>\n\n</rdf:RDF>" ), + equalTo( "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<rdf:RDF\n xmlns:zest=\"http://zest.apache.org/rdf/model/1.0/\"\n xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"\n xmlns:rdfs=\"http://www.w3.org/2000/01/rdf-schema#\">\n<org.apache.zest.library.rest.admin.RestTest-PersonEntity xmlns=\"urn:zest:type:\" rdf:about=\"urn:zest:entity:P1\">\n <identity xmlns=\"urn:zest:type:org.apache.zest.api.entity.Identity#\">P1</identity>\n <firstname xmlns=\"urn:zest:type:org.apache.zest.library.rest.admin.RestTest-Person#\">Joe</firstname>\n <lastname xmlns=\"urn:zest:type:org.apache.zest.library.rest.admin.RestTest-Person#\">Doe</lastname>\n <mother xmlns=\"urn:zest:type:org.apache.zest.library.rest.admin.RestTest-Person#\" rdf:resource=\"urn:zest:entity:P2\"/>\n</org.apache.zest.library.rest.admin.RestTest-PersonEntity>\n\n</rdf:RDF>" ), // Sun JDK 6 / Oracle JDK 7 & Valid - equalTo( "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<rdf:RDF\n xmlns:qi4j=\"http://www.qi4j.org/rdf/model/1.0/\"\n xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"\n xmlns:rdfs=\"http://www.w3.org/2000/01/rdf-schema#\">\n<org.qi4j.library.rest.admin.RestTest-PersonEntity xmlns=\"urn:qi4j:type:\" rdf:about=\"urn:qi4j:entity:P1\">\n <firstname xmlns=\"urn:qi4j:type:org.qi4j.library.rest.admin.RestTest-Person#\">Joe</firstname>\n <lastname xmlns=\"urn:qi4j:type:org.qi4j.library.rest.admin.RestTest-Person#\">Doe</lastname>\n <identity xmlns=\"urn:qi4j:type:org.qi4j.api.entity.Identity#\">P1</identity>\n <mother xmlns=\"urn:qi4j:type:org.qi4j.library.rest.admin.RestTest-Person#\" rdf:resource=\"urn:qi4j:entity:P2\"/>\n</org.qi4j.library.rest.admin.RestTest-PersonEntity>\n\n</rdf:RDF>" ), + equalTo( "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<rdf:RDF\n xmlns:zest=\"http://zest.apache.org/rdf/model/1.0/\"\n xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"\n xmlns:rdfs=\"http://www.w3.org/2000/01/rdf-schema#\">\n<org.apache.zest.library.rest.admin.RestTest-PersonEntity xmlns=\"urn:zest:type:\" rdf:about=\"urn:zest:entity:P1\">\n <firstname xmlns=\"urn:zest:type:org.apache.zest.library.rest.admin.RestTest-Person#\">Joe</firstname>\n <lastname xmlns=\"urn:zest:type:org.apache.zest.library.rest.admin.RestTest-Person#\">Doe</lastname>\n <identity xmlns=\"urn:zest:type:org.apache.zest.api.entity.Identity#\">P1</identity>\n <mother xmlns=\"urn:zest:type:org.apache.zest.library.rest.admin.RestTest-Person#\" rdf:resource=\"urn:zest:entity:P2\"/>\n</org.apache.zest.library.rest.admin.RestTest-PersonEntity>\n\n</rdf:RDF>" ), // IBM JDK 6 & Valid - equalTo( "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<rdf:RDF\n xmlns:qi4j=\"http://www.qi4j.org/rdf/model/1.0/\"\n xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"\n xmlns:rdfs=\"http://www.w3.org/2000/01/rdf-schema#\">\n<org.qi4j.library.rest.admin.RestTest-PersonEntity xmlns=\"urn:qi4j:type:\" rdf:about=\"urn:qi4j:entity:P1\">\n <identity xmlns=\"urn:qi4j:type:org.qi4j.api.entity.Identity#\">P1</identity>\n <lastname xmlns=\"urn:qi4j:type:org.qi4j.library.rest.admin.RestTest-Person#\">Doe</lastname>\n <firstname xmlns=\"urn:qi4j:type:org.qi4j.library.rest.admin.RestTest-Person#\">Joe</firstname>\n <mother xmlns=\"urn:qi4j:type:org.qi4j.library.rest.admin.RestTest-Person#\" rdf:resource=\"urn:qi4j:entity:P2\"/>\n</org.qi4j.library.rest.admin.RestTest-PersonEntity>\n\n</rdf:RDF>" ) ) ); + equalTo( "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<rdf:RDF\n xmlns:zest=\"http://zest.apache.org/rdf/model/1.0/\"\n xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"\n xmlns:rdfs=\"http://www.w3.org/2000/01/rdf-schema#\">\n<org.apache.zest.library.rest.admin.RestTest-PersonEntity xmlns=\"urn:zest:type:\" rdf:about=\"urn:zest:entity:P1\">\n <identity xmlns=\"urn:zest:type:org.apache.zest.api.entity.Identity#\">P1</identity>\n <lastname xmlns=\"urn:zest:type:org.apache.zest.library.rest.admin.RestTest-Person#\">Doe</lastname>\n <firstname xmlns=\"urn:zest:type:org.apache.zest.library.rest.admin.RestTest-Person#\">Joe</firstname>\n <mother xmlns=\"urn:zest:type:org.apache.zest.library.rest.admin.RestTest-Person#\" rdf:resource=\"urn:zest:entity:P2\"/>\n</org.apache.zest.library.rest.admin.RestTest-PersonEntity>\n\n</rdf:RDF>" ) ) ); } @Test @@ -191,10 +191,10 @@ public class RestTest assertThat( "Returned RDF", result, anyOf( - equalTo( "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<rdf:RDF\n\txmlns=\"urn:qi4j:\"\n\txmlns:qi4j=\"http://www.qi4j.org/rdf/model/1.0/\"\n\txmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"\n\txmlns:rdfs=\"http://www.w3.org/2000/01/rdf-schema#\">\n<qi4j:entity rdf:about=\"/entity/P2.rdf\"/>\n<qi4j:entity rdf:about=\"/entity/P1.rdf\"/>\n</rdf:RDF>\n" ), - equalTo( "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\\\"no\\\"?>\n<rdf:RDF\n\txmlns=\"urn:qi4j:\"\n\txmlns:qi4j=\"http://www.qi4j.org/rdf/model/1.0/\"\n\txmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"\n\txmlns:rdfs=\"http://www.w3.org/2000/01/rdf-schema#\">\n<qi4j:entity rdf:about=\"/entity/P2.rdf\"/>\n<qi4j:entity rdf:about=\"/entity/P1.rdf\"/>\n</rdf:RDF>\n" ), - equalTo( "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<rdf:RDF\n\txmlns=\"urn:qi4j:\"\n\txmlns:qi4j=\"http://www.qi4j.org/rdf/model/1.0/\"\n\txmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"\n\txmlns:rdfs=\"http://www.w3.org/2000/01/rdf-schema#\">\n<qi4j:entity rdf:about=\"/entity/P1.rdf\"/>\n<qi4j:entity rdf:about=\"/entity/P2.rdf\"/>\n</rdf:RDF>\n" ), - equalTo( "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\\\"no\\\"?>\n<rdf:RDF\n\txmlns=\"urn:qi4j:\"\n\txmlns:qi4j=\"http://www.qi4j.org/rdf/model/1.0/\"\n\txmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"\n\txmlns:rdfs=\"http://www.w3.org/2000/01/rdf-schema#\">\n<qi4j:entity rdf:about=\"/entity/P1.rdf\"/>\n<qi4j:entity rdf:about=\"/entity/P2.rdf\"/>\n</rdf:RDF>\n" ) ) ); + equalTo( "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<rdf:RDF\n\txmlns=\"urn:zest:\"\n\txmlns:zest=\"http://zest.apache.org/rdf/model/1.0/\"\n\txmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"\n\txmlns:rdfs=\"http://www.w3.org/2000/01/rdf-schema#\">\n<zest:entity rdf:about=\"/entity/P2.rdf\"/>\n<zest:entity rdf:about=\"/entity/P1.rdf\"/>\n</rdf:RDF>\n" ), + equalTo( "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\\\"no\\\"?>\n<rdf:RDF\n\txmlns=\"urn:zest:\"\n\txmlns:zest=\"http://zest.apache.org/rdf/model/1.0/\"\n\txmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"\n\txmlns:rdfs=\"http://www.w3.org/2000/01/rdf-schema#\">\n<zest:entity rdf:about=\"/entity/P2.rdf\"/>\n<zest:entity rdf:about=\"/entity/P1.rdf\"/>\n</rdf:RDF>\n" ), + equalTo( "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<rdf:RDF\n\txmlns=\"urn:zest:\"\n\txmlns:zest=\"http://zest.apache.org/rdf/model/1.0/\"\n\txmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"\n\txmlns:rdfs=\"http://www.w3.org/2000/01/rdf-schema#\">\n<zest:entity rdf:about=\"/entity/P1.rdf\"/>\n<zest:entity rdf:about=\"/entity/P2.rdf\"/>\n</rdf:RDF>\n" ), + equalTo( "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\\\"no\\\"?>\n<rdf:RDF\n\txmlns=\"urn:zest:\"\n\txmlns:zest=\"http://zest.apache.org/rdf/model/1.0/\"\n\txmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"\n\txmlns:rdfs=\"http://www.w3.org/2000/01/rdf-schema#\">\n<zest:entity rdf:about=\"/entity/P1.rdf\"/>\n<zest:entity rdf:about=\"/entity/P2.rdf\"/>\n</rdf:RDF>\n" ) ) ); } public static class RestTester http://git-wip-us.apache.org/repos/asf/zest-java/blob/ab97249b/libraries/rest/src/test/java/org/apache/zest/library/rest/admin/RestletServletAssembler.java ---------------------------------------------------------------------- diff --git a/libraries/rest/src/test/java/org/apache/zest/library/rest/admin/RestletServletAssembler.java b/libraries/rest/src/test/java/org/apache/zest/library/rest/admin/RestletServletAssembler.java index 6dd50d2..93b1941 100644 --- a/libraries/rest/src/test/java/org/apache/zest/library/rest/admin/RestletServletAssembler.java +++ b/libraries/rest/src/test/java/org/apache/zest/library/rest/admin/RestletServletAssembler.java @@ -30,7 +30,7 @@ public class RestletServletAssembler public void assemble( ModuleAssembly module ) throws AssemblyException { - addServlets( serve( "/qi4j/*" ).with( Qi4jServerServletService.class ) ).to( module ); + addServlets( serve( "/zest/*" ).with( ZestServerServletService.class ) ).to( module ); // addFilters( filter( "/*" ).through( UnitOfWorkFilterService.class ).on( REQUEST ) ).to( module ); } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-java/blob/ab97249b/libraries/scheduler/build.gradle ---------------------------------------------------------------------- diff --git a/libraries/scheduler/build.gradle b/libraries/scheduler/build.gradle index bc426ce..37b63d0 100644 --- a/libraries/scheduler/build.gradle +++ b/libraries/scheduler/build.gradle @@ -23,15 +23,15 @@ jar { manifest { name = "Apache Zest⢠Library - Scheduler" }} dependencies { - compile project( ":org.qi4j.core:org.qi4j.core.bootstrap" ) - compile project( ':org.qi4j.libraries:org.qi4j.library.constraints' ) + compile project( ":org.apache.zest.core:org.apache.zest.core.bootstrap" ) + compile project( ':org.apache.zest.libraries:org.apache.zest.library.constraints' ) compile libraries.sked compile libraries.slf4j_api - testCompile project( ":org.qi4j.core:org.qi4j.core.testsupport" ) - testCompile project( ":org.qi4j.extensions:org.qi4j.extension.indexing-rdf" ) + testCompile project( ":org.apache.zest.core:org.apache.zest.core.testsupport" ) + testCompile project( ":org.apache.zest.extensions:org.apache.zest.extension.indexing-rdf" ) testCompile libraries.awaitility - testRuntime project( ":org.qi4j.core:org.qi4j.core.runtime" ) + testRuntime project( ":org.apache.zest.core:org.apache.zest.core.runtime" ) testRuntime libraries.logback } http://git-wip-us.apache.org/repos/asf/zest-java/blob/ab97249b/libraries/scheduler/dev-status.xml ---------------------------------------------------------------------- diff --git a/libraries/scheduler/dev-status.xml b/libraries/scheduler/dev-status.xml index fc11ce4..1605bd6 100644 --- a/libraries/scheduler/dev-status.xml +++ b/libraries/scheduler/dev-status.xml @@ -15,10 +15,10 @@ See the License for the specific language governing permissions and limitations under the License. --> -<module xmlns="http://www.qi4j.org/schemas/2008/dev-status/1" +<module xmlns="http://zest.apache.org/schemas/2008/dev-status/1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://www.qi4j.org/schemas/2008/dev-status/1 - http://www.qi4j.org/schemas/2008/dev-status/1/dev-status.xsd"> + xsi:schemaLocation="http://zest.apache.org/schemas/2008/dev-status/1 + http://zest.apache.org/schemas/2008/dev-status/1/dev-status.xsd"> <status> <!--none,early,beta,stable,mature--> <codebase>beta</codebase> http://git-wip-us.apache.org/repos/asf/zest-java/blob/ab97249b/libraries/scheduler/src/test/java/org/apache/zest/library/scheduler/AbstractSchedulerTest.java ---------------------------------------------------------------------- diff --git a/libraries/scheduler/src/test/java/org/apache/zest/library/scheduler/AbstractSchedulerTest.java b/libraries/scheduler/src/test/java/org/apache/zest/library/scheduler/AbstractSchedulerTest.java index e1ebdca..ca5b8bd 100644 --- a/libraries/scheduler/src/test/java/org/apache/zest/library/scheduler/AbstractSchedulerTest.java +++ b/libraries/scheduler/src/test/java/org/apache/zest/library/scheduler/AbstractSchedulerTest.java @@ -22,11 +22,11 @@ import org.apache.zest.api.unitofwork.UnitOfWork; import org.apache.zest.bootstrap.AssemblyException; import org.apache.zest.bootstrap.ModuleAssembly; import org.apache.zest.index.rdf.assembly.RdfMemoryStoreAssembler; -import org.apache.zest.test.AbstractQi4jTest; +import org.apache.zest.test.AbstractZestTest; import org.apache.zest.test.EntityTestAssembler; public abstract class AbstractSchedulerTest - extends AbstractQi4jTest + extends AbstractZestTest { @Override public final void assemble( ModuleAssembly assembly ) http://git-wip-us.apache.org/repos/asf/zest-java/blob/ab97249b/libraries/scripting/build.gradle ---------------------------------------------------------------------- diff --git a/libraries/scripting/build.gradle b/libraries/scripting/build.gradle index 2d65e32..c729b38 100644 --- a/libraries/scripting/build.gradle +++ b/libraries/scripting/build.gradle @@ -22,12 +22,12 @@ description = "Apache Zest⢠Common Scripting Library contains common classes a jar { manifest { name = "Apache Zest⢠Library - Scripting - Common" }} dependencies { - compile(project(":org.qi4j.core:org.qi4j.core.api")) - compile(project(":org.qi4j.core:org.qi4j.core.bootstrap")) + compile(project(":org.apache.zest.core:org.apache.zest.core.api")) + compile(project(":org.apache.zest.core:org.apache.zest.core.bootstrap")) compile(libraries.slf4j_api) testCompile(libraries.junit) - testCompile(project(":org.qi4j.core:org.qi4j.core.testsupport")) - testRuntime(project(":org.qi4j.core:org.qi4j.core.runtime")) + testCompile(project(":org.apache.zest.core:org.apache.zest.core.testsupport")) + testRuntime(project(":org.apache.zest.core:org.apache.zest.core.runtime")) testRuntime(libraries.asm) testRuntime(libraries.asm_commons) testRuntime(libraries.slf4j_simple) http://git-wip-us.apache.org/repos/asf/zest-java/blob/ab97249b/libraries/scripting/dev-status.xml ---------------------------------------------------------------------- diff --git a/libraries/scripting/dev-status.xml b/libraries/scripting/dev-status.xml index afa3369..d195034 100644 --- a/libraries/scripting/dev-status.xml +++ b/libraries/scripting/dev-status.xml @@ -15,10 +15,10 @@ See the License for the specific language governing permissions and limitations under the License. --> -<module xmlns="http://www.qi4j.org/schemas/2008/dev-status/1" +<module xmlns="http://zest.apache.org/schemas/2008/dev-status/1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://www.qi4j.org/schemas/2008/dev-status/1 - http://www.qi4j.org/schemas/2008/dev-status/1/dev-status.xsd"> + xsi:schemaLocation="http://zest.apache.org/schemas/2008/dev-status/1 + http://zest.apache.org/schemas/2008/dev-status/1/dev-status.xsd"> <status> <!--none,early,beta,stable,mature--> <codebase>stable</codebase> http://git-wip-us.apache.org/repos/asf/zest-java/blob/ab97249b/libraries/servlet/build.gradle ---------------------------------------------------------------------- diff --git a/libraries/servlet/build.gradle b/libraries/servlet/build.gradle index 130afdb..5868a96 100644 --- a/libraries/servlet/build.gradle +++ b/libraries/servlet/build.gradle @@ -22,14 +22,14 @@ description = "Apache Zest⢠Servlet Library provides integration of Apache Zes jar { manifest { name = "Apache Zest⢠Library - Servlet" }} dependencies { - compile( project(":org.qi4j.core:org.qi4j.core.bootstrap") ) + compile( project(":org.apache.zest.core:org.apache.zest.core.bootstrap") ) compile libraries.servlet_api compile libraries.slf4j_api - testCompile( project(":org.qi4j.core:org.qi4j.core.testsupport") ) + testCompile( project(":org.apache.zest.core:org.apache.zest.core.testsupport") ) testCompile( libraries.jetty_webapp ) testCompile( libraries.http_client ) - testRuntime( project(":org.qi4j.core:org.qi4j.core.runtime") ) + testRuntime( project(":org.apache.zest.core:org.apache.zest.core.runtime") ) testRuntime(libraries.logback ) } http://git-wip-us.apache.org/repos/asf/zest-java/blob/ab97249b/libraries/servlet/dev-status.xml ---------------------------------------------------------------------- diff --git a/libraries/servlet/dev-status.xml b/libraries/servlet/dev-status.xml index cbcd274..a1fe908 100644 --- a/libraries/servlet/dev-status.xml +++ b/libraries/servlet/dev-status.xml @@ -15,10 +15,10 @@ See the License for the specific language governing permissions and limitations under the License. --> -<module xmlns="http://www.qi4j.org/schemas/2008/dev-status/1" +<module xmlns="http://zest.apache.org/schemas/2008/dev-status/1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://www.qi4j.org/schemas/2008/dev-status/1 - http://www.qi4j.org/schemas/2008/dev-status/1/dev-status.xsd"> + xsi:schemaLocation="http://zest.apache.org/schemas/2008/dev-status/1 + http://zest.apache.org/schemas/2008/dev-status/1/dev-status.xsd"> <status> <!--none,early,beta,stable,mature--> <codebase>stable</codebase> http://git-wip-us.apache.org/repos/asf/zest-java/blob/ab97249b/libraries/servlet/src/docs/servlet.txt ---------------------------------------------------------------------- diff --git a/libraries/servlet/src/docs/servlet.txt b/libraries/servlet/src/docs/servlet.txt index 763a47a..6bb73dd 100644 --- a/libraries/servlet/src/docs/servlet.txt +++ b/libraries/servlet/src/docs/servlet.txt @@ -34,10 +34,10 @@ include::../../build/docs/buildinfo/artifact.txt[] == Application Bootstrap == -Extends `AbstractQi4jServletBootstrap` to easily bind a Zest⢠`Application` activation/passivation to your webapp +Extends `AbstractZestServletBootstrap` to easily bind a Zest⢠`Application` activation/passivation to your webapp lifecycle. -Use `Qi4jServletSupport#application(javax.servlet.ServletContext)` to get a handle on the `Application` from the +Use `ZestServletSupport#application(javax.servlet.ServletContext)` to get a handle on the `Application` from the `ServletContext`. Here is an example ServletContextListener: @@ -51,7 +51,7 @@ tag=bootstrap == Facilities == -`Qi4jServlet` and `Qi4jFilter` respectively provide base class for easy access to the `Application` from the +`ZestServlet` and `ZestFilter` respectively provide base class for easy access to the `Application` from the `ServletContext`. Here is a sample servlet that simply output the assembled Application name: http://git-wip-us.apache.org/repos/asf/zest-java/blob/ab97249b/libraries/servlet/src/main/java/org/apache/zest/library/servlet/Qi4jFilter.java ---------------------------------------------------------------------- diff --git a/libraries/servlet/src/main/java/org/apache/zest/library/servlet/Qi4jFilter.java b/libraries/servlet/src/main/java/org/apache/zest/library/servlet/Qi4jFilter.java deleted file mode 100644 index 85a3417..0000000 --- a/libraries/servlet/src/main/java/org/apache/zest/library/servlet/Qi4jFilter.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2010, Paul Merlin. All Rights Reserved. - * - * Licensed 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.zest.library.servlet; - -import javax.servlet.Filter; -import javax.servlet.FilterConfig; -import javax.servlet.ServletContext; -import javax.servlet.ServletException; -import org.apache.zest.api.structure.Application; -import org.apache.zest.library.servlet.lifecycle.AbstractQi4jServletBootstrap; - -/** - * Base Filter providing easy access to the {@link Application} from the {@link ServletContext}. - * @see AbstractQi4jServletBootstrap - */ -public abstract class Qi4jFilter - implements Filter -{ - - private Application application; - - @Override - public void init( FilterConfig filterConfig ) - throws ServletException - { - application = Qi4jServletSupport.application( filterConfig.getServletContext() ); - } - - protected final Application application() - { - return application; - } - -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/ab97249b/libraries/servlet/src/main/java/org/apache/zest/library/servlet/Qi4jServlet.java ---------------------------------------------------------------------- diff --git a/libraries/servlet/src/main/java/org/apache/zest/library/servlet/Qi4jServlet.java b/libraries/servlet/src/main/java/org/apache/zest/library/servlet/Qi4jServlet.java deleted file mode 100644 index 4667b2f..0000000 --- a/libraries/servlet/src/main/java/org/apache/zest/library/servlet/Qi4jServlet.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2010, Paul Merlin. All Rights Reserved. - * - * Licensed 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.zest.library.servlet; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import org.apache.zest.api.structure.Application; -import org.apache.zest.library.servlet.lifecycle.AbstractQi4jServletBootstrap; - -/** - * Base HttpServlet providing easy access to the {@link org.apache.zest.api.structure.Application} from the - * {@link javax.servlet.ServletContext}. - * - * @see AbstractQi4jServletBootstrap - */ -public class Qi4jServlet - extends HttpServlet -{ - - private Application application; - - public Qi4jServlet() - { - super(); - } - - @Override - public void init() - throws ServletException - { - super.init(); - application = Qi4jServletSupport.application( getServletContext() ); - } - - protected final Application application() - { - return application; - } - -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/ab97249b/libraries/servlet/src/main/java/org/apache/zest/library/servlet/Qi4jServletSupport.java ---------------------------------------------------------------------- diff --git a/libraries/servlet/src/main/java/org/apache/zest/library/servlet/Qi4jServletSupport.java b/libraries/servlet/src/main/java/org/apache/zest/library/servlet/Qi4jServletSupport.java deleted file mode 100644 index 053d33a..0000000 --- a/libraries/servlet/src/main/java/org/apache/zest/library/servlet/Qi4jServletSupport.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2010, Paul Merlin. All Rights Reserved. - * - * Licensed 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.zest.library.servlet; - -import javax.servlet.ServletContext; -import org.apache.zest.api.structure.Application; -import org.apache.zest.library.servlet.lifecycle.AbstractQi4jServletBootstrap; - -public final class Qi4jServletSupport -{ - - public static final String APP_IN_CTX = "qi4j-application-servlet-context-attribute"; - - /** - * @param servletContext ServletContext - * @return The Application from the servlet context attribute previously set by {@link AbstractQi4jServletBootstrap} - */ - public static Application application( ServletContext servletContext ) - { - return ( Application ) servletContext.getAttribute( APP_IN_CTX ); // TODO try/catch and find a suitable Zest exception - } - - private Qi4jServletSupport() - { - } - -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/ab97249b/libraries/servlet/src/main/java/org/apache/zest/library/servlet/ZestFilter.java ---------------------------------------------------------------------- diff --git a/libraries/servlet/src/main/java/org/apache/zest/library/servlet/ZestFilter.java b/libraries/servlet/src/main/java/org/apache/zest/library/servlet/ZestFilter.java new file mode 100644 index 0000000..f8ff9aa --- /dev/null +++ b/libraries/servlet/src/main/java/org/apache/zest/library/servlet/ZestFilter.java @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2010, Paul Merlin. All Rights Reserved. + * + * Licensed 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.zest.library.servlet; + +import javax.servlet.Filter; +import javax.servlet.FilterConfig; +import javax.servlet.ServletContext; +import javax.servlet.ServletException; +import org.apache.zest.api.structure.Application; +import org.apache.zest.library.servlet.lifecycle.AbstractZestServletBootstrap; + +/** + * Base Filter providing easy access to the {@link Application} from the {@link ServletContext}. + * @see AbstractZestServletBootstrap + */ +public abstract class ZestFilter + implements Filter +{ + + private Application application; + + @Override + public void init( FilterConfig filterConfig ) + throws ServletException + { + application = ZestServletSupport.application( filterConfig.getServletContext() ); + } + + protected final Application application() + { + return application; + } + +} http://git-wip-us.apache.org/repos/asf/zest-java/blob/ab97249b/libraries/servlet/src/main/java/org/apache/zest/library/servlet/ZestServlet.java ---------------------------------------------------------------------- diff --git a/libraries/servlet/src/main/java/org/apache/zest/library/servlet/ZestServlet.java b/libraries/servlet/src/main/java/org/apache/zest/library/servlet/ZestServlet.java new file mode 100644 index 0000000..6eee571 --- /dev/null +++ b/libraries/servlet/src/main/java/org/apache/zest/library/servlet/ZestServlet.java @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2010, Paul Merlin. All Rights Reserved. + * + * Licensed 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.zest.library.servlet; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import org.apache.zest.api.structure.Application; +import org.apache.zest.library.servlet.lifecycle.AbstractZestServletBootstrap; + +/** + * Base HttpServlet providing easy access to the {@link org.apache.zest.api.structure.Application} from the + * {@link javax.servlet.ServletContext}. + * + * @see AbstractZestServletBootstrap + */ +public class ZestServlet extends HttpServlet +{ + + private Application application; + + public ZestServlet() + { + super(); + } + + @Override + public void init() + throws ServletException + { + super.init(); + application = ZestServletSupport.application( getServletContext() ); + } + + protected final Application application() + { + return application; + } + +} http://git-wip-us.apache.org/repos/asf/zest-java/blob/ab97249b/libraries/servlet/src/main/java/org/apache/zest/library/servlet/ZestServletSupport.java ---------------------------------------------------------------------- diff --git a/libraries/servlet/src/main/java/org/apache/zest/library/servlet/ZestServletSupport.java b/libraries/servlet/src/main/java/org/apache/zest/library/servlet/ZestServletSupport.java new file mode 100644 index 0000000..e857550 --- /dev/null +++ b/libraries/servlet/src/main/java/org/apache/zest/library/servlet/ZestServletSupport.java @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2010, Paul Merlin. All Rights Reserved. + * + * Licensed 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.zest.library.servlet; + +import javax.servlet.ServletContext; +import org.apache.zest.api.structure.Application; +import org.apache.zest.library.servlet.lifecycle.AbstractZestServletBootstrap; + +public final class ZestServletSupport +{ + + public static final String APP_IN_CTX = "zest-application-servlet-context-attribute"; + + /** + * @param servletContext ServletContext + * @return The Application from the servlet context attribute previously set by {@link AbstractZestServletBootstrap} + */ + public static Application application( ServletContext servletContext ) + { + return ( Application ) servletContext.getAttribute( APP_IN_CTX ); // TODO try/catch and find a suitable Zest exception + } + + private ZestServletSupport() + { + } + +} http://git-wip-us.apache.org/repos/asf/zest-java/blob/ab97249b/libraries/servlet/src/main/java/org/apache/zest/library/servlet/lifecycle/AbstractQi4jServletBootstrap.java ---------------------------------------------------------------------- diff --git a/libraries/servlet/src/main/java/org/apache/zest/library/servlet/lifecycle/AbstractQi4jServletBootstrap.java b/libraries/servlet/src/main/java/org/apache/zest/library/servlet/lifecycle/AbstractQi4jServletBootstrap.java deleted file mode 100644 index 93cf113..0000000 --- a/libraries/servlet/src/main/java/org/apache/zest/library/servlet/lifecycle/AbstractQi4jServletBootstrap.java +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Copyright (c) 2010, Paul Merlin. All Rights Reserved. - * - * Licensed 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.zest.library.servlet.lifecycle; - -import javax.servlet.ServletContext; -import javax.servlet.ServletContextEvent; -import javax.servlet.ServletContextListener; -import org.apache.zest.api.Qi4j; -import org.apache.zest.api.common.InvalidApplicationException; -import org.apache.zest.api.structure.Application; -import org.apache.zest.api.structure.ApplicationDescriptor; -import org.apache.zest.bootstrap.ApplicationAssembler; -import org.apache.zest.bootstrap.Energy4Java; -import org.apache.zest.library.servlet.Qi4jServlet; -import org.apache.zest.library.servlet.Qi4jServletSupport; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * Abstract ServletContextListener implementing ApplicationAssembler. - * - * Extends this class to easily bind a Zest Application activation/passivation to your webapp lifecycle. - * - * The {@link Application} is set as a {@link ServletContext} attribute named using a constant. - * In your servlets, filters, whatever has access to the {@link ServletContext} use the following code to get a - * handle on the {@link Application}: - * - * <pre> - * org.qi4j.api.structure.Application application; - * - * application = ( Application ) servletContext.getAttribute( Qi4jServletSupport.APP_IN_CTX ); - * - * // Or, shorter: - * - * application = Qi4jServletSupport.application( servletContext ); - * - * </pre> - * - * Rembember that the servlet specification states: - * - * In cases where the container is distributed over many virtual machines, a Web application will have an instance of - * the ServletContext for each JVM. - * - * Context attributes are local to the JVM in which they were created. This prevents ServletContext attributes from - * being a shared memory store in a distributed container. When information needs to be shared between servlets running - * in a distributed environment, the information should be placed into a session, stored in a database, or set in an - * Enterprise JavaBeans component. - */ -public abstract class AbstractQi4jServletBootstrap - implements ServletContextListener, ApplicationAssembler -{ - - private static final Logger LOGGER = LoggerFactory.getLogger( Qi4jServlet.class.getPackage().getName() ); - // Zest Runtime - protected Qi4j api; - protected Energy4Java qi4j; - // Zest Application - protected ApplicationDescriptor applicationModel; - protected Application application; - - @Override - public final void contextInitialized( ServletContextEvent sce ) - { - try { - - ServletContext context = sce.getServletContext(); - - LOGGER.trace( "Assembling Application" ); - qi4j = new Energy4Java(); - applicationModel = qi4j.newApplicationModel( this ); - - LOGGER.trace( "Instanciating and activating Application" ); - application = applicationModel.newInstance( qi4j.api() ); - api = qi4j.api(); - beforeApplicationActivation( application ); - application.activate(); - afterApplicationActivation( application ); - - LOGGER.trace( "Storing Application in ServletContext" ); - context.setAttribute( Qi4jServletSupport.APP_IN_CTX, application ); - - } catch ( Exception ex ) { - if ( application != null ) { - try { - beforeApplicationPassivation( application ); - application.passivate(); - afterApplicationPassivation( application ); - } catch ( Exception ex1 ) { - LOGGER.warn( "Application not null and could not passivate it.", ex1 ); - } - } - throw new InvalidApplicationException( "Unexpected error during ServletContext initialization, see previous log for errors.", ex ); - } - } - - protected void beforeApplicationActivation( Application app ) - { - } - - protected void afterApplicationActivation( Application app ) - { - } - - @Override - public final void contextDestroyed( ServletContextEvent sce ) - { - try { - if ( application != null ) { - beforeApplicationPassivation( application ); - application.passivate(); - afterApplicationPassivation( application ); - } - } catch ( Exception ex ) { - LOGGER.warn( "Unable to passivate Zest Application.", ex ); - } - } - - protected void beforeApplicationPassivation( Application app ) - { - } - - protected void afterApplicationPassivation( Application app ) - { - } - -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/ab97249b/libraries/servlet/src/main/java/org/apache/zest/library/servlet/lifecycle/AbstractZestServletBootstrap.java ---------------------------------------------------------------------- diff --git a/libraries/servlet/src/main/java/org/apache/zest/library/servlet/lifecycle/AbstractZestServletBootstrap.java b/libraries/servlet/src/main/java/org/apache/zest/library/servlet/lifecycle/AbstractZestServletBootstrap.java new file mode 100644 index 0000000..a604956 --- /dev/null +++ b/libraries/servlet/src/main/java/org/apache/zest/library/servlet/lifecycle/AbstractZestServletBootstrap.java @@ -0,0 +1,137 @@ +/* + * Copyright (c) 2010, Paul Merlin. All Rights Reserved. + * + * Licensed 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.zest.library.servlet.lifecycle; + +import javax.servlet.ServletContext; +import javax.servlet.ServletContextEvent; +import javax.servlet.ServletContextListener; +import org.apache.zest.api.ZestAPI; +import org.apache.zest.api.common.InvalidApplicationException; +import org.apache.zest.api.structure.Application; +import org.apache.zest.api.structure.ApplicationDescriptor; +import org.apache.zest.bootstrap.ApplicationAssembler; +import org.apache.zest.bootstrap.Energy4Java; +import org.apache.zest.library.servlet.ZestServlet; +import org.apache.zest.library.servlet.ZestServletSupport; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Abstract ServletContextListener implementing ApplicationAssembler. + * + * Extends this class to easily bind a Zest Application activation/passivation to your webapp lifecycle. + * + * The {@link Application} is set as a {@link ServletContext} attribute named using a constant. + * In your servlets, filters, whatever has access to the {@link ServletContext} use the following code to get a + * handle on the {@link Application}: + * + * <pre> + * org.apache.zest.api.structure.Application application; + * + * application = ( Application ) servletContext.getAttribute( ZestServletSupport.APP_IN_CTX ); + * + * // Or, shorter: + * + * application = ZestServletSupport.application( servletContext ); + * + * </pre> + * + * Rembember that the servlet specification states: + * + * In cases where the container is distributed over many virtual machines, a Web application will have an instance of + * the ServletContext for each JVM. + * + * Context attributes are local to the JVM in which they were created. This prevents ServletContext attributes from + * being a shared memory store in a distributed container. When information needs to be shared between servlets running + * in a distributed environment, the information should be placed into a session, stored in a database, or set in an + * Enterprise JavaBeans component. + */ +public abstract class AbstractZestServletBootstrap + implements ServletContextListener, ApplicationAssembler +{ + + private static final Logger LOGGER = LoggerFactory.getLogger( ZestServlet.class.getPackage().getName() ); + // Zest Runtime + protected ZestAPI api; + protected Energy4Java zest; + // Zest Application + protected ApplicationDescriptor applicationModel; + protected Application application; + + @Override + public final void contextInitialized( ServletContextEvent sce ) + { + try { + + ServletContext context = sce.getServletContext(); + + LOGGER.trace( "Assembling Application" ); + zest = new Energy4Java(); + applicationModel = zest.newApplicationModel( this ); + + LOGGER.trace( "Instanciating and activating Application" ); + application = applicationModel.newInstance( zest.api() ); + api = zest.api(); + beforeApplicationActivation( application ); + application.activate(); + afterApplicationActivation( application ); + + LOGGER.trace( "Storing Application in ServletContext" ); + context.setAttribute( ZestServletSupport.APP_IN_CTX, application ); + + } catch ( Exception ex ) { + if ( application != null ) { + try { + beforeApplicationPassivation( application ); + application.passivate(); + afterApplicationPassivation( application ); + } catch ( Exception ex1 ) { + LOGGER.warn( "Application not null and could not passivate it.", ex1 ); + } + } + throw new InvalidApplicationException( "Unexpected error during ServletContext initialization, see previous log for errors.", ex ); + } + } + + protected void beforeApplicationActivation( Application app ) + { + } + + protected void afterApplicationActivation( Application app ) + { + } + + @Override + public final void contextDestroyed( ServletContextEvent sce ) + { + try { + if ( application != null ) { + beforeApplicationPassivation( application ); + application.passivate(); + afterApplicationPassivation( application ); + } + } catch ( Exception ex ) { + LOGGER.warn( "Unable to passivate Zest Application.", ex ); + } + } + + protected void beforeApplicationPassivation( Application app ) + { + } + + protected void afterApplicationPassivation( Application app ) + { + } + +} http://git-wip-us.apache.org/repos/asf/zest-java/blob/ab97249b/libraries/servlet/src/main/java/org/apache/zest/library/servlet/package.html ---------------------------------------------------------------------- diff --git a/libraries/servlet/src/main/java/org/apache/zest/library/servlet/package.html b/libraries/servlet/src/main/java/org/apache/zest/library/servlet/package.html index edc745e..12ad763 100644 --- a/libraries/servlet/src/main/java/org/apache/zest/library/servlet/package.html +++ b/libraries/servlet/src/main/java/org/apache/zest/library/servlet/package.html @@ -24,23 +24,23 @@ limitations under the License. <h3>Logging</h3> <p> - The SLF4J logger used by this library is named "org.qi4j.library.servlet". + The SLF4J logger used by this library is named "org.apache.zest.library.servlet". </p> <h3>Application Bootstrap</h3> <p> - Extends {@link org.qi4j.library.servlet.lifecycle.AbstractQi4jServletBootstrap} to easily bind a Zest⢠- {@link org.qi4j.api.structure.Application} activation/passivation to your webapp lifecycle. + Extends {@link org.apache.zest.library.servlet.lifecycle.AbstractZestServletBootstrap} to easily bind a Zest⢠+ {@link org.apache.zest.api.structure.Application} activation/passivation to your webapp lifecycle. </p> <p> - Use {@link org.qi4j.library.servlet.Qi4jServletSupport#application(javax.servlet.ServletContext)} to get - a handle on the {@link org.qi4j.api.structure.Application} from the {@link javax.servlet.ServletContext}. + Use {@link org.apache.zest.library.servlet.ZestServletSupport#application(javax.servlet.ServletContext)} to get + a handle on the {@link org.apache.zest.api.structure.Application} from the {@link javax.servlet.ServletContext}. </p> <h3>Facilities</h3> <p> - {@link org.qi4j.library.servlet.Qi4jServlet} and {@link org.qi4j.library.servlet.Qi4jFilter} respectively - provide base class for easy access to the {@link org.qi4j.api.structure.Application}} from the + {@link org.apache.zest.library.servlet.ZestServlet} and {@link org.apache.zest.library.servlet.ZestFilter} respectively + provide base class for easy access to the {@link org.apache.zest.api.structure.Application}} from the {@link javax.servlet.ServletContext}. </p> </body> http://git-wip-us.apache.org/repos/asf/zest-java/blob/ab97249b/libraries/servlet/src/test/java/org/apache/zest/library/servlet/ServletTest.java ---------------------------------------------------------------------- diff --git a/libraries/servlet/src/test/java/org/apache/zest/library/servlet/ServletTest.java b/libraries/servlet/src/test/java/org/apache/zest/library/servlet/ServletTest.java index d28a561..8f5858c 100644 --- a/libraries/servlet/src/test/java/org/apache/zest/library/servlet/ServletTest.java +++ b/libraries/servlet/src/test/java/org/apache/zest/library/servlet/ServletTest.java @@ -29,7 +29,7 @@ import org.apache.zest.bootstrap.ApplicationAssembly; import org.apache.zest.bootstrap.ApplicationAssemblyFactory; import org.apache.zest.bootstrap.AssemblyException; import org.apache.zest.bootstrap.ModuleAssembly; -import org.apache.zest.library.servlet.lifecycle.AbstractQi4jServletBootstrap; +import org.apache.zest.library.servlet.lifecycle.AbstractZestServletBootstrap; import org.apache.zest.test.util.FreePortFinder; public class ServletTest @@ -39,7 +39,7 @@ public class ServletTest // START SNIPPET: bootstrap public static class FooServletContextListener - extends AbstractQi4jServletBootstrap + extends AbstractZestServletBootstrap { public ApplicationAssembly assemble( ApplicationAssemblyFactory applicationFactory ) @@ -64,7 +64,7 @@ public class ServletTest // START SNIPPET: usage public static class FooServlet - extends Qi4jServlet + extends ZestServlet { @Override http://git-wip-us.apache.org/repos/asf/zest-java/blob/ab97249b/libraries/shiro-core/build.gradle ---------------------------------------------------------------------- diff --git a/libraries/shiro-core/build.gradle b/libraries/shiro-core/build.gradle index d57ac77..4a3ef83 100644 --- a/libraries/shiro-core/build.gradle +++ b/libraries/shiro-core/build.gradle @@ -23,19 +23,19 @@ jar { manifest { name = "Apache Zest⢠Library - Shiro Core" }} dependencies { - compile project( ":org.qi4j.core:org.qi4j.core.bootstrap" ) + compile project( ":org.apache.zest.core:org.apache.zest.core.bootstrap" ) compile libraries.shiro compile libraries.bouncy_castle compile libraries.slf4j_api - testCompile project( ":org.qi4j.core:org.qi4j.core.testsupport" ) - testCompile project( ":org.qi4j.libraries:org.qi4j.library.shiro-web" ) - testCompile project( ":org.qi4j.libraries:org.qi4j.library.servlet" ) - testCompile project( ":org.qi4j.extensions:org.qi4j.extension.indexing-rdf" ) + testCompile project( ":org.apache.zest.core:org.apache.zest.core.testsupport" ) + testCompile project( ":org.apache.zest.libraries:org.apache.zest.library.shiro-web" ) + testCompile project( ":org.apache.zest.libraries:org.apache.zest.library.servlet" ) + testCompile project( ":org.apache.zest.extensions:org.apache.zest.extension.indexing-rdf" ) testCompile libraries.jetty_webapp testCompile libraries.http_client - testRuntime project( ":org.qi4j.core:org.qi4j.core.runtime" ) + testRuntime project( ":org.apache.zest.core:org.apache.zest.core.runtime" ) testRuntime libraries.logback } http://git-wip-us.apache.org/repos/asf/zest-java/blob/ab97249b/libraries/shiro-core/dev-status.xml ---------------------------------------------------------------------- diff --git a/libraries/shiro-core/dev-status.xml b/libraries/shiro-core/dev-status.xml index cbcd274..a1fe908 100644 --- a/libraries/shiro-core/dev-status.xml +++ b/libraries/shiro-core/dev-status.xml @@ -15,10 +15,10 @@ See the License for the specific language governing permissions and limitations under the License. --> -<module xmlns="http://www.qi4j.org/schemas/2008/dev-status/1" +<module xmlns="http://zest.apache.org/schemas/2008/dev-status/1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://www.qi4j.org/schemas/2008/dev-status/1 - http://www.qi4j.org/schemas/2008/dev-status/1/dev-status.xsd"> + xsi:schemaLocation="http://zest.apache.org/schemas/2008/dev-status/1 + http://zest.apache.org/schemas/2008/dev-status/1/dev-status.xsd"> <status> <!--none,early,beta,stable,mature--> <codebase>stable</codebase> http://git-wip-us.apache.org/repos/asf/zest-java/blob/ab97249b/libraries/shiro-core/src/test/java/org/apache/zest/library/shiro/PasswordDomainTest.java ---------------------------------------------------------------------- diff --git a/libraries/shiro-core/src/test/java/org/apache/zest/library/shiro/PasswordDomainTest.java b/libraries/shiro-core/src/test/java/org/apache/zest/library/shiro/PasswordDomainTest.java index 5f57b63..90f9d87 100644 --- a/libraries/shiro-core/src/test/java/org/apache/zest/library/shiro/PasswordDomainTest.java +++ b/libraries/shiro-core/src/test/java/org/apache/zest/library/shiro/PasswordDomainTest.java @@ -33,13 +33,13 @@ import org.apache.zest.library.shiro.assembly.PasswordDomainAssembler; import org.apache.zest.library.shiro.assembly.StandaloneShiroAssembler; import org.apache.zest.library.shiro.domain.passwords.PasswordSecurable; import org.apache.zest.library.shiro.ini.ShiroIniConfiguration; -import org.apache.zest.test.AbstractQi4jTest; +import org.apache.zest.test.AbstractZestTest; import org.apache.zest.test.EntityTestAssembler; import static org.junit.Assert.*; public class PasswordDomainTest - extends AbstractQi4jTest + extends AbstractZestTest { // START SNIPPET: domain http://git-wip-us.apache.org/repos/asf/zest-java/blob/ab97249b/libraries/shiro-core/src/test/java/org/apache/zest/library/shiro/PermissionsDomainTest.java ---------------------------------------------------------------------- diff --git a/libraries/shiro-core/src/test/java/org/apache/zest/library/shiro/PermissionsDomainTest.java b/libraries/shiro-core/src/test/java/org/apache/zest/library/shiro/PermissionsDomainTest.java index b819f6c..8fcb885 100644 --- a/libraries/shiro-core/src/test/java/org/apache/zest/library/shiro/PermissionsDomainTest.java +++ b/libraries/shiro-core/src/test/java/org/apache/zest/library/shiro/PermissionsDomainTest.java @@ -38,7 +38,7 @@ import org.apache.zest.library.shiro.domain.permissions.Role; import org.apache.zest.library.shiro.domain.permissions.RoleAssignee; import org.apache.zest.library.shiro.domain.permissions.RoleFactory; import org.apache.zest.library.shiro.ini.ShiroIniConfiguration; -import org.apache.zest.test.AbstractQi4jTest; +import org.apache.zest.test.AbstractZestTest; import org.apache.zest.test.EntityTestAssembler; import static org.hamcrest.CoreMatchers.is; @@ -46,7 +46,7 @@ import static org.junit.Assert.assertThat; import static org.junit.Assert.fail; public class PermissionsDomainTest - extends AbstractQi4jTest + extends AbstractZestTest { // START SNIPPET: domain http://git-wip-us.apache.org/repos/asf/zest-java/blob/ab97249b/libraries/shiro-core/src/test/java/org/apache/zest/library/shiro/RealmServiceTest.java ---------------------------------------------------------------------- diff --git a/libraries/shiro-core/src/test/java/org/apache/zest/library/shiro/RealmServiceTest.java b/libraries/shiro-core/src/test/java/org/apache/zest/library/shiro/RealmServiceTest.java index 279a7f7..1de2158 100644 --- a/libraries/shiro-core/src/test/java/org/apache/zest/library/shiro/RealmServiceTest.java +++ b/libraries/shiro-core/src/test/java/org/apache/zest/library/shiro/RealmServiceTest.java @@ -30,13 +30,13 @@ import org.apache.zest.bootstrap.AssemblyException; import org.apache.zest.bootstrap.ModuleAssembly; import org.apache.zest.library.shiro.assembly.StandaloneShiroAssembler; import org.apache.zest.library.shiro.ini.ShiroIniConfiguration; -import org.apache.zest.test.AbstractQi4jTest; +import org.apache.zest.test.AbstractZestTest; import org.apache.zest.test.EntityTestAssembler; import static org.junit.Assert.assertNotNull; public class RealmServiceTest - extends AbstractQi4jTest + extends AbstractZestTest { // START SNIPPET: realm-service http://git-wip-us.apache.org/repos/asf/zest-java/blob/ab97249b/libraries/shiro-core/src/test/java/org/apache/zest/library/shiro/StandaloneShiroTest.java ---------------------------------------------------------------------- diff --git a/libraries/shiro-core/src/test/java/org/apache/zest/library/shiro/StandaloneShiroTest.java b/libraries/shiro-core/src/test/java/org/apache/zest/library/shiro/StandaloneShiroTest.java index b1c7f31..4899ea1 100644 --- a/libraries/shiro-core/src/test/java/org/apache/zest/library/shiro/StandaloneShiroTest.java +++ b/libraries/shiro-core/src/test/java/org/apache/zest/library/shiro/StandaloneShiroTest.java @@ -32,7 +32,7 @@ import org.apache.zest.bootstrap.ModuleAssembly; import org.apache.zest.library.shiro.assembly.StandaloneShiroAssembler; import org.apache.zest.library.shiro.ini.IniSecurityManagerService; import org.apache.zest.library.shiro.ini.ShiroIniConfiguration; -import org.apache.zest.test.AbstractQi4jTest; +import org.apache.zest.test.AbstractZestTest; import org.apache.zest.test.EntityTestAssembler; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -42,7 +42,7 @@ import static org.junit.Assert.assertNotNull; import static org.junit.Assert.fail; public class StandaloneShiroTest - extends AbstractQi4jTest + extends AbstractZestTest { public void documentationSupport_before() http://git-wip-us.apache.org/repos/asf/zest-java/blob/ab97249b/libraries/shiro-web/build.gradle ---------------------------------------------------------------------- diff --git a/libraries/shiro-web/build.gradle b/libraries/shiro-web/build.gradle index ebf7da3..7e2233f 100644 --- a/libraries/shiro-web/build.gradle +++ b/libraries/shiro-web/build.gradle @@ -23,21 +23,21 @@ jar { manifest { name = "Apache Zest⢠Library - Shiro Web" }} dependencies { - compile project( ":org.qi4j.core:org.qi4j.core.bootstrap" ) - compile project( ':org.qi4j.libraries:org.qi4j.library.shiro-core' ) - compile project( ':org.qi4j.libraries:org.qi4j.library.servlet' ) - compile project( ':org.qi4j.libraries:org.qi4j.library.http' ) + compile project( ":org.apache.zest.core:org.apache.zest.core.bootstrap" ) + compile project( ':org.apache.zest.libraries:org.apache.zest.library.shiro-core' ) + compile project( ':org.apache.zest.libraries:org.apache.zest.library.servlet' ) + compile project( ':org.apache.zest.libraries:org.apache.zest.library.http' ) compile libraries.shiro_web compile libraries.servlet_api compile libraries.slf4j_api - testCompile project( ":org.qi4j.core:org.qi4j.core.testsupport" ) - testCompile project( ":org.qi4j.libraries:org.qi4j.library.shiro-web" ) - testCompile project( ":org.qi4j.libraries:org.qi4j.library.servlet" ) - testCompile project( ":org.qi4j.extensions:org.qi4j.extension.indexing-rdf" ) + testCompile project( ":org.apache.zest.core:org.apache.zest.core.testsupport" ) + testCompile project( ":org.apache.zest.libraries:org.apache.zest.library.shiro-web" ) + testCompile project( ":org.apache.zest.libraries:org.apache.zest.library.servlet" ) + testCompile project( ":org.apache.zest.extensions:org.apache.zest.extension.indexing-rdf" ) testCompile libraries.jetty_webapp testCompile libraries.http_client - testRuntime project( ":org.qi4j.core:org.qi4j.core.runtime" ) + testRuntime project( ":org.apache.zest.core:org.apache.zest.core.runtime" ) testRuntime libraries.logback } http://git-wip-us.apache.org/repos/asf/zest-java/blob/ab97249b/libraries/shiro-web/dev-status.xml ---------------------------------------------------------------------- diff --git a/libraries/shiro-web/dev-status.xml b/libraries/shiro-web/dev-status.xml index cbcd274..a1fe908 100644 --- a/libraries/shiro-web/dev-status.xml +++ b/libraries/shiro-web/dev-status.xml @@ -15,10 +15,10 @@ See the License for the specific language governing permissions and limitations under the License. --> -<module xmlns="http://www.qi4j.org/schemas/2008/dev-status/1" +<module xmlns="http://zest.apache.org/schemas/2008/dev-status/1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://www.qi4j.org/schemas/2008/dev-status/1 - http://www.qi4j.org/schemas/2008/dev-status/1/dev-status.xsd"> + xsi:schemaLocation="http://zest.apache.org/schemas/2008/dev-status/1 + http://zest.apache.org/schemas/2008/dev-status/1/dev-status.xsd"> <status> <!--none,early,beta,stable,mature--> <codebase>stable</codebase> http://git-wip-us.apache.org/repos/asf/zest-java/blob/ab97249b/libraries/shiro-web/src/test/java/org/apache/zest/library/shiro/web/WebHttpShiroTest.java ---------------------------------------------------------------------- diff --git a/libraries/shiro-web/src/test/java/org/apache/zest/library/shiro/web/WebHttpShiroTest.java b/libraries/shiro-web/src/test/java/org/apache/zest/library/shiro/web/WebHttpShiroTest.java index 37c41d8..b2134e0 100644 --- a/libraries/shiro-web/src/test/java/org/apache/zest/library/shiro/web/WebHttpShiroTest.java +++ b/libraries/shiro-web/src/test/java/org/apache/zest/library/shiro/web/WebHttpShiroTest.java @@ -22,12 +22,12 @@ import org.apache.zest.library.http.JettyConfiguration; import org.apache.zest.library.http.JettyServiceAssembler; import org.apache.zest.library.shiro.ini.ShiroIniConfiguration; import org.apache.zest.library.shiro.web.assembly.HttpShiroAssembler; -import org.apache.zest.test.AbstractQi4jTest; +import org.apache.zest.test.AbstractZestTest; import org.apache.zest.test.EntityTestAssembler; import org.apache.zest.test.util.FreePortFinder; public class WebHttpShiroTest - extends AbstractQi4jTest + extends AbstractZestTest { private int port; http://git-wip-us.apache.org/repos/asf/zest-java/blob/ab97249b/libraries/shiro-web/src/test/java/org/apache/zest/library/shiro/web/WebRealmServiceTest.java ---------------------------------------------------------------------- diff --git a/libraries/shiro-web/src/test/java/org/apache/zest/library/shiro/web/WebRealmServiceTest.java b/libraries/shiro-web/src/test/java/org/apache/zest/library/shiro/web/WebRealmServiceTest.java index 22512c8..d97509c 100644 --- a/libraries/shiro-web/src/test/java/org/apache/zest/library/shiro/web/WebRealmServiceTest.java +++ b/libraries/shiro-web/src/test/java/org/apache/zest/library/shiro/web/WebRealmServiceTest.java @@ -53,7 +53,7 @@ import org.apache.zest.library.http.JettyConfiguration; import org.apache.zest.library.http.JettyServiceAssembler; import org.apache.zest.library.shiro.ini.ShiroIniConfiguration; import org.apache.zest.library.shiro.web.assembly.HttpShiroAssembler; -import org.apache.zest.test.AbstractQi4jTest; +import org.apache.zest.test.AbstractZestTest; import org.apache.zest.test.EntityTestAssembler; import org.apache.zest.test.util.FreePortFinder; @@ -63,7 +63,7 @@ import static org.apache.zest.library.http.Servlets.addServlets; import static org.apache.zest.library.http.Servlets.serve; public class WebRealmServiceTest - extends AbstractQi4jTest + extends AbstractZestTest { private int port; http://git-wip-us.apache.org/repos/asf/zest-java/blob/ab97249b/libraries/spring/build.gradle ---------------------------------------------------------------------- diff --git a/libraries/spring/build.gradle b/libraries/spring/build.gradle index f5b1613..c199268 100644 --- a/libraries/spring/build.gradle +++ b/libraries/spring/build.gradle @@ -22,12 +22,12 @@ description = "Apache Zest⢠Spring Library allows for tight integration of Spr jar { manifest { name = "Apache Zest⢠Library - Spring" }} dependencies { - compile(project(":org.qi4j.core:org.qi4j.core.bootstrap")) + compile(project(":org.apache.zest.core:org.apache.zest.core.bootstrap")) compile(libraries.spring_core) - testCompile(project(":org.qi4j.core:org.qi4j.core.testsupport")) + testCompile(project(":org.apache.zest.core:org.apache.zest.core.testsupport")) testCompile(libraries.spring_testsupport) - testRuntime(project(":org.qi4j.core:org.qi4j.core.runtime")) + testRuntime(project(":org.apache.zest.core:org.apache.zest.core.runtime")) testRuntime(libraries.logback) } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-java/blob/ab97249b/libraries/spring/dev-status.xml ---------------------------------------------------------------------- diff --git a/libraries/spring/dev-status.xml b/libraries/spring/dev-status.xml index 58fda09..b25d433 100644 --- a/libraries/spring/dev-status.xml +++ b/libraries/spring/dev-status.xml @@ -15,10 +15,10 @@ See the License for the specific language governing permissions and limitations under the License. --> -<module xmlns="http://www.qi4j.org/schemas/2008/dev-status/1" +<module xmlns="http://zest.apache.org/schemas/2008/dev-status/1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://www.qi4j.org/schemas/2008/dev-status/1 - http://www.qi4j.org/schemas/2008/dev-status/1/dev-status.xsd"> + xsi:schemaLocation="http://zest.apache.org/schemas/2008/dev-status/1 + http://zest.apache.org/schemas/2008/dev-status/1/dev-status.xsd"> <status> <!--none,early,beta,stable,mature--> <codebase>beta</codebase> http://git-wip-us.apache.org/repos/asf/zest-java/blob/ab97249b/libraries/spring/src/docs/spring.txt ---------------------------------------------------------------------- diff --git a/libraries/spring/src/docs/spring.txt b/libraries/spring/src/docs/spring.txt index 9c2caa4..f3fe5d8 100644 --- a/libraries/spring/src/docs/spring.txt +++ b/libraries/spring/src/docs/spring.txt @@ -38,7 +38,7 @@ beans will be available as Zest⢠services. The most important things to rememb [snippet,java] ---- -source=libraries/spring/src/test/java/org/apache/zest/library/spring/importer/Qi4jImportServiceTest.java +source=libraries/spring/src/test/java/org/apache/zest/library/spring/importer/ZestImportServiceTest.java tag=import ---- @@ -48,17 +48,17 @@ It is also possible to run a Zest⢠Application as a Spring Bean and export its Steps to export Zest⢠service: 1. Create spring BeanFactory service of Zest services to export. - 2. Create a class that extends Qi4jApplicationBootstrap. + 2. Create a class that extends ZestApplicationBootstrap. 3. Sets the layer and module that register BeanFactory service. 4. Assemble Zest application by implementing #assemble method. 5. Sets the identity of bean factory service. This identity is the spring bean name. 6. Declare Zest bootstrap in spring xml application context. To bootstrap the Zest⢠runtime in Spring, you should have a bootstrap bean that extends the -+org.apache.zest.library.spring.bootstrap.Qi4jApplicationBootstrap+ and implement the ++org.apache.zest.library.spring.bootstrap.ZestApplicationBootstrap+ and implement the +org.springframework.context.ApplicationContextAware+. -A new bean will appear in the application context, called +"qi4jApplication"+ which is only +A new bean will appear in the application context, called +"zestApplication"+ which is only intended for internal use of this library. Example application context; @@ -68,18 +68,18 @@ Example application context; <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns:qi4j="http://www.qi4j.org/schema/qi4j/spring" + xmlns:zest="http://zest.apache.org/schema/zest/spring" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd - http://www.qi4j.org/schema/qi4j/spring http://www.qi4j.org/schema/qi4j/spring/spring-0.5.xsd"> + http://zest.apache.org/schema/zest/spring http://zest.apache.org/schema/zest/spring/spring-0.5.xsd"> - <!-- class that implements Qi4jApplicationBootstrap --> + <!-- class that implements ZestApplicationBootstrap --> - <qi4j:bootstrap class="org.hedhman.niclas.MyZestBootstrapper"/> + <zest:bootstrap class="org.hedhman.niclas.MyZestBootstrapper"/> <bean id="someService" class="org.hedhman.niclas.SomeService"> - <constructor-arg ref="someService"/> <!-- Reference qi4j comment service --> + <constructor-arg ref="someService"/> <!-- Reference zest comment service --> </bean> ---- http://git-wip-us.apache.org/repos/asf/zest-java/blob/ab97249b/libraries/spring/src/main/java/org/apache/zest/library/spring/bootstrap/Constants.java ---------------------------------------------------------------------- diff --git a/libraries/spring/src/main/java/org/apache/zest/library/spring/bootstrap/Constants.java b/libraries/spring/src/main/java/org/apache/zest/library/spring/bootstrap/Constants.java index 6ea19e8..2deb3f9 100644 --- a/libraries/spring/src/main/java/org/apache/zest/library/spring/bootstrap/Constants.java +++ b/libraries/spring/src/main/java/org/apache/zest/library/spring/bootstrap/Constants.java @@ -18,7 +18,7 @@ package org.apache.zest.library.spring.bootstrap; public final class Constants { - public static final String BEAN_ID_QI4J_APPLICATION = "qi4jApplication"; + public static final String BEAN_ID_ZEST_APPLICATION = "zestApplication"; private Constants() { http://git-wip-us.apache.org/repos/asf/zest-java/blob/ab97249b/libraries/spring/src/main/java/org/apache/zest/library/spring/bootstrap/Qi4jApplicationBootstrap.java ---------------------------------------------------------------------- diff --git a/libraries/spring/src/main/java/org/apache/zest/library/spring/bootstrap/Qi4jApplicationBootstrap.java b/libraries/spring/src/main/java/org/apache/zest/library/spring/bootstrap/Qi4jApplicationBootstrap.java deleted file mode 100644 index db4da88..0000000 --- a/libraries/spring/src/main/java/org/apache/zest/library/spring/bootstrap/Qi4jApplicationBootstrap.java +++ /dev/null @@ -1,85 +0,0 @@ -/* Copyright 2008 Edward Yakop. - * - * Licensed 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.zest.library.spring.bootstrap; - -import org.apache.zest.bootstrap.ApplicationAssembly; -import org.apache.zest.bootstrap.AssemblyException; -import org.apache.zest.bootstrap.ModuleAssembly; -import org.springframework.context.ApplicationContextAware; - -/** - * Run a Zest Application as a Spring Bean and export its Services to Spring. - * <p> - * Steps to export Zest service: - * </p> - * <ul> - * <li>Create spring BeanFactory service of qi4j services to export.</li> - * <li>Create a class that extends {@link Qi4jApplicationBootstrap}.</li> - * <li>Sets the layer and module that register BeanFactory service.</li> - * <li>Assemble qi4j application by implementing #assemble method.</li> - * <li>Sets the identity of bean factory service. This identity is the spring - * bean name.</li> - * <li>Declare qi4j bootstrap in spring xml application context. - * <pre><code> - * <?xml version="1.0" encoding="UTF-8"?> - * - * <beans xmlns="http://www.springframework.org/schema/beans" - * xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - * xmlns:qi4j="http://www.qi4j.org/schema/qi4j/spring" - * xsi:schemaLocation=" - * http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd - * http://www.qi4j.org/schema/qi4j/spring http://www.qi4j.org/schema/qi4j/spring/spring-0.5.xsd"> - * - * <!-- class that implements Qi4jApplicationBootstrap --> - * - * <qi4j:bootstrap class="org.qi4j.library.spring.bootstrap.Qi4jTestBootstrap"/> - * - * <bean id="commentServiceHolder" class="org.qi4j.library.spring.bootstrap.CommentServiceHolder"> - * - * <constructor-arg ref="commentService"/> <!-- Reference qi4j comment service --> - * - * </bean> - * </code></pre> - * </li> - * </ul> - * <p> - * <b>Importing Spring beans as services</b><br> - * </p> - * <ol> - * <li>Application bootstrap class must implement interface - * {@link ApplicationContextAware}.</li> - * <li>In the application bootstrap import service to the module using method - * {@link ModuleAssembly#importedServices(Class...)}.</li> - * <li>Set concrete Spring bean as meta-data of the imported service.</li> - * </ol> - * <p> - * Look at org.qi4j.library.spring.bootstrap.Qi4jExportServiceTest for sample - * implementation. - * </p> - */ -public abstract class Qi4jApplicationBootstrap -{ - /** - * Assembles qi4j application. - * - * @param applicationAssembly - * qi4j application assembly. Must not be {@code null}. - * @throws AssemblyException - * Thrown if assemblies fails. - */ - public abstract void assemble( ApplicationAssembly applicationAssembly ) throws AssemblyException; -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/ab97249b/libraries/spring/src/main/java/org/apache/zest/library/spring/bootstrap/ZestApplicationBootstrap.java ---------------------------------------------------------------------- diff --git a/libraries/spring/src/main/java/org/apache/zest/library/spring/bootstrap/ZestApplicationBootstrap.java b/libraries/spring/src/main/java/org/apache/zest/library/spring/bootstrap/ZestApplicationBootstrap.java new file mode 100644 index 0000000..13a1c5b --- /dev/null +++ b/libraries/spring/src/main/java/org/apache/zest/library/spring/bootstrap/ZestApplicationBootstrap.java @@ -0,0 +1,85 @@ +/* Copyright 2008 Edward Yakop. + * + * Licensed 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.zest.library.spring.bootstrap; + +import org.apache.zest.bootstrap.ApplicationAssembly; +import org.apache.zest.bootstrap.AssemblyException; +import org.apache.zest.bootstrap.ModuleAssembly; +import org.springframework.context.ApplicationContextAware; + +/** + * Run a Zest Application as a Spring Bean and export its Services to Spring. + * <p> + * Steps to export Zest service: + * </p> + * <ul> + * <li>Create spring BeanFactory service of Apache Zest services to export.</li> + * <li>Create a class that extends {@link ZestApplicationBootstrap}.</li> + * <li>Sets the layer and module that register BeanFactory service.</li> + * <li>Assemble Zest application by implementing #assemble method.</li> + * <li>Sets the identity of bean factory service. This identity is the spring + * bean name.</li> + * <li>Declare Zest bootstrap in spring xml application context. + * <pre><code> + * <?xml version="1.0" encoding="UTF-8"?> + * + * <beans xmlns="http://www.springframework.org/schema/beans" + * xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + * xmlns:zest="http://zest.apache.org/schema/zest/spring" + * xsi:schemaLocation=" + * http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd + * http://zest.apache.org/schema/zest/spring http://zest.apache.org/schema/zest/spring/spring-0.5.xsd"> + * + * <!-- class that implements ZestApplicationBootstrap --> + * + * <zest:bootstrap class="org.apache.zest.library.spring.bootstrap.ZestTestBootstrap"/> + * + * <bean id="commentServiceHolder" class="org.apache.zest.library.spring.bootstrap.CommentServiceHolder"> + * + * <constructor-arg ref="commentService"/> <!-- Reference Zest comment service --> + * + * </bean> + * </code></pre> + * </li> + * </ul> + * <p> + * <b>Importing Spring beans as services</b><br> + * </p> + * <ol> + * <li>Application bootstrap class must implement interface + * {@link ApplicationContextAware}.</li> + * <li>In the application bootstrap import service to the module using method + * {@link ModuleAssembly#importedServices(Class...)}.</li> + * <li>Set concrete Spring bean as meta-data of the imported service.</li> + * </ol> + * <p> + * Look at org.apache.zest.library.spring.bootstrap.ZestExportServiceTest for sample + * implementation. + * </p> + */ +public abstract class ZestApplicationBootstrap +{ + /** + * Assembles Zest application. + * + * @param applicationAssembly + * Zest application assembly. Must not be {@code null}. + * @throws AssemblyException + * Thrown if assemblies fails. + */ + public abstract void assemble( ApplicationAssembly applicationAssembly ) throws AssemblyException; +} http://git-wip-us.apache.org/repos/asf/zest-java/blob/ab97249b/libraries/spring/src/main/java/org/apache/zest/library/spring/bootstrap/internal/Qi4jNamespaceHandler.java ---------------------------------------------------------------------- diff --git a/libraries/spring/src/main/java/org/apache/zest/library/spring/bootstrap/internal/Qi4jNamespaceHandler.java b/libraries/spring/src/main/java/org/apache/zest/library/spring/bootstrap/internal/Qi4jNamespaceHandler.java deleted file mode 100644 index b72fb4c..0000000 --- a/libraries/spring/src/main/java/org/apache/zest/library/spring/bootstrap/internal/Qi4jNamespaceHandler.java +++ /dev/null @@ -1,31 +0,0 @@ -/* Copyright 2008 Edward Yakop. -* -* Licensed 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.zest.library.spring.bootstrap.internal; - -import org.apache.zest.library.spring.bootstrap.internal.application.Qi4jBootstrapBeanDefinitionParser; -import org.apache.zest.library.spring.bootstrap.internal.service.Qi4jServiceBeanDefinitionParser; -import org.springframework.beans.factory.xml.NamespaceHandlerSupport; - -public final class Qi4jNamespaceHandler extends NamespaceHandlerSupport -{ - @Override - public final void init() - { - registerBeanDefinitionParser( "bootstrap", new Qi4jBootstrapBeanDefinitionParser() ); - registerBeanDefinitionParser( "service", new Qi4jServiceBeanDefinitionParser() ); - } -}
