Return-Path: X-Original-To: apmail-zest-commits-archive@minotaur.apache.org Delivered-To: apmail-zest-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 09EE61830B for ; Mon, 15 Jun 2015 00:37:42 +0000 (UTC) Received: (qmail 53844 invoked by uid 500); 15 Jun 2015 00:37:41 -0000 Delivered-To: apmail-zest-commits-archive@zest.apache.org Received: (qmail 53824 invoked by uid 500); 15 Jun 2015 00:37:41 -0000 Mailing-List: contact commits-help@zest.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@zest.apache.org Delivered-To: mailing list commits@zest.apache.org Received: (qmail 53761 invoked by uid 99); 15 Jun 2015 00:37:41 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 15 Jun 2015 00:37:41 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id A7A8AE03C8; Mon, 15 Jun 2015 00:37:41 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: niclas@apache.org To: commits@zest.apache.org Date: Mon, 15 Jun 2015 00:37:45 -0000 Message-Id: In-Reply-To: <85de5f28c09d4f0b933b1e8bb61668d6@git.apache.org> References: <85de5f28c09d4f0b933b1e8bb61668d6@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [5/5] zest-qi4j git commit: Removing CXF Library, as it is very dated and we have no interest in maintain XML based technologies. Removing CXF Library, as it is very dated and we have no interest in maintain XML based technologies. Project: http://git-wip-us.apache.org/repos/asf/zest-qi4j/repo Commit: http://git-wip-us.apache.org/repos/asf/zest-qi4j/commit/72e375eb Tree: http://git-wip-us.apache.org/repos/asf/zest-qi4j/tree/72e375eb Diff: http://git-wip-us.apache.org/repos/asf/zest-qi4j/diff/72e375eb Branch: refs/heads/develop Commit: 72e375eb65338302725c60370861c10d987d511e Parents: d31b13c Author: Niclas Hedhman Authored: Mon Jun 15 08:37:16 2015 +0800 Committer: Niclas Hedhman Committed: Mon Jun 15 08:37:16 2015 +0800 ---------------------------------------------------------------------- libraries.gradle | 12 - libraries/cxf/build.gradle | 27 -- libraries/cxf/dev-status.xml | 19 - libraries/cxf/src/docs/cxf.txt | 13 - .../java/org/qi4j/library/cxf/CxfAssembler.java | 33 -- .../java/org/qi4j/library/cxf/JaxWsCreator.java | 26 - .../library/cxf/JaxWsServerFactoryInfo.java | 48 -- .../java/org/qi4j/library/cxf/JaxWsService.java | 128 ----- .../org/qi4j/library/cxf/NamespaceUtil.java | 55 --- .../org/qi4j/library/cxf/Qi4jTypeCreator.java | 63 --- .../qi4j/library/cxf/ValueCompositeCxfType.java | 483 ------------------- .../main/java/org/qi4j/library/cxf/package.html | 9 - .../java/org/qi4j/library/cxf/HelloClient.java | 43 -- .../java/org/qi4j/library/cxf/HelloMain.java | 42 -- .../java/org/qi4j/library/cxf/HelloWorld.java | 28 -- .../org/qi4j/library/cxf/HelloWorldImpl.java | 54 --- .../java/org/qi4j/library/cxf/Subscription.java | 34 -- .../test/java/org/qi4j/library/cxf/User.java | 34 -- .../org/qi4j/library/cxf/divs/DivPoint.java | 51 -- .../org/qi4j/library/cxf/divs/DivStream.java | 40 -- .../org/qi4j/library/cxf/divs/Dividends.java | 26 - .../qi4j/library/cxf/divs/DividendsMain.java | 65 --- .../qi4j/library/cxf/divs/DividendsTest.java | 139 ------ .../library/cxf/divs/ProjectedDividends.java | 117 ----- .../cxf/divs/ProjectedDividendsService.java | 25 - settings.gradle | 1 - tutorials/composites/build.gradle | 2 +- 27 files changed, 1 insertion(+), 1616 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/72e375eb/libraries.gradle ---------------------------------------------------------------------- diff --git a/libraries.gradle b/libraries.gradle index b9e8d50..3186bb8 100644 --- a/libraries.gradle +++ b/libraries.gradle @@ -26,7 +26,6 @@ def commonsCodecVersion = '1.8' def commonsDbcpVersion = '1.4' // Should be moved to org.apache.tomcat:tomcat-jdbc:8.0.8 def commonsIoVersion = '2.4' def commonsLangVersion = '2.6' -def cxfVersion = '2.5.6' // 2.7.11 Unable to resolve dependencies! - 3.0.0 exists def derbyVersion = '10.10.2.0' def dnsJavaVersion = '2.1.6' def ehcacheVersion = '2.8.3' @@ -83,7 +82,6 @@ def voldemortVersion = '1.3.0' def wicketVersion = '1.5.8' // 6.15.0 Samples fails to compile! def wicketStatelessVersion = '1.5.0' def woodstoxVersion = '4.4.0' -def wsdl4jVersion = '1.6.3' def yammerMetricsVersion = '2.2.0' def antVersion = '1.9.4' @@ -244,16 +242,6 @@ rootProject.ext { commons_io: "commons-io:commons-io:$commonsIoVersion", commons_lang: "commons-lang:commons-lang:$commonsLangVersion", servlet_api: "javax.servlet:javax.servlet-api:$servletVersion", - cxf_api: 'org.apache.cxf:cxf-api:' + cxfVersion, - cxf_util: "org.apache.cxf:cxf-common-utilities:$cxfVersion", - cxf_rt_core: "org.apache.cxf:cxf-rt-core:$cxfVersion", - cxf_rt_soap: "org.apache.cxf:cxf-rt-bindings-soap:$cxfVersion", - cxf_rt_jaxws: "org.apache.cxf:cxf-rt-frontend-jaxws:$cxfVersion", - cxf_rt_aegis: "org.apache.cxf:cxf-rt-databinding-aegis:$cxfVersion", - cxf_rt_local: "org.apache.cxf:cxf-rt-transports-local:$cxfVersion", - cxf_rt_http: "org.apache.cxf:cxf-rt-transports-http:$cxfVersion", - cxf_rt_http_jetty: "org.apache.cxf:cxf-rt-transports-http-jetty:$cxfVersion", - wsdl4j: 'wsdl4j:wsdl4j:' + wsdl4jVersion, http_client: "org.apache.httpcomponents:httpclient:$httpClientVersion", woodstox: "org.codehaus.woodstox:woodstox-core-asl:$woodstoxVersion", restlet_xml: "org.restlet.jee:org.restlet.ext.xml:$restletVersion", http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/72e375eb/libraries/cxf/build.gradle ---------------------------------------------------------------------- diff --git a/libraries/cxf/build.gradle b/libraries/cxf/build.gradle deleted file mode 100644 index 603396b..0000000 --- a/libraries/cxf/build.gradle +++ /dev/null @@ -1,27 +0,0 @@ -description = "Qi4j CXF Library integrates Apache CXF with Qi4j." - -jar { manifest { name = "Qi4j Library - CXF" }} - -dependencies { - compile(project(":org.qi4j.core:org.qi4j.core.bootstrap")) - compile(libraries.cxf_api) - compile(libraries.cxf_util) - compile(libraries.cxf_rt_core) - compile(libraries.cxf_rt_soap) - compile(libraries.cxf_rt_jaxws) - compile(libraries.cxf_rt_aegis) - compile(libraries.cxf_rt_local) - compile(libraries.wsdl4j) - compile(libraries.woodstox) -// compile('org.apache.ws.commons.schema:XmlSchema:' + xmlSchemaVersion) - - runtime(libraries.cxf_rt_http) - runtime(libraries.cxf_rt_http_jetty) - - testCompile(project(":org.qi4j.core:org.qi4j.core.testsupport")) - testCompile(libraries.http_client) - testCompile(libraries.xmlunit) - - testRuntime(project(":org.qi4j.core:org.qi4j.core.runtime")) - testRuntime(libraries.logback) -} http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/72e375eb/libraries/cxf/dev-status.xml ---------------------------------------------------------------------- diff --git a/libraries/cxf/dev-status.xml b/libraries/cxf/dev-status.xml deleted file mode 100644 index 654d3aa..0000000 --- a/libraries/cxf/dev-status.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - beta - - - none - - - some - - - ALv2 - - \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/72e375eb/libraries/cxf/src/docs/cxf.txt ---------------------------------------------------------------------- diff --git a/libraries/cxf/src/docs/cxf.txt b/libraries/cxf/src/docs/cxf.txt deleted file mode 100644 index 58570ba..0000000 --- a/libraries/cxf/src/docs/cxf.txt +++ /dev/null @@ -1,13 +0,0 @@ -[[library-cxf, CXF Library]] -= CXF WebService = - -[devstatus] --------------- -source=libraries/cxf/dev-status.xml --------------- - -CXF WebService Library - -NOTE: This Library has no documentation yet. Learn how to contribute in <>. - -include::../../build/docs/buildinfo/artifact.txt[] http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/72e375eb/libraries/cxf/src/main/java/org/qi4j/library/cxf/CxfAssembler.java ---------------------------------------------------------------------- diff --git a/libraries/cxf/src/main/java/org/qi4j/library/cxf/CxfAssembler.java b/libraries/cxf/src/main/java/org/qi4j/library/cxf/CxfAssembler.java deleted file mode 100644 index 23dd83f..0000000 --- a/libraries/cxf/src/main/java/org/qi4j/library/cxf/CxfAssembler.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2010 Niclas Hedhman. - * - * 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.qi4j.library.cxf; - -import org.qi4j.bootstrap.Assemblers; -import org.qi4j.bootstrap.AssemblyException; -import org.qi4j.bootstrap.ModuleAssembly; - -public class CxfAssembler - extends Assemblers.Visibility -{ - @Override - public void assemble( ModuleAssembly module ) - throws AssemblyException - { - module.objects( Qi4jTypeCreator.class, ValueCompositeCxfType.class ).visibleIn( visibility() ); - } -} http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/72e375eb/libraries/cxf/src/main/java/org/qi4j/library/cxf/JaxWsCreator.java ---------------------------------------------------------------------- diff --git a/libraries/cxf/src/main/java/org/qi4j/library/cxf/JaxWsCreator.java b/libraries/cxf/src/main/java/org/qi4j/library/cxf/JaxWsCreator.java deleted file mode 100644 index 46d0a07..0000000 --- a/libraries/cxf/src/main/java/org/qi4j/library/cxf/JaxWsCreator.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright 2010 Niclas Hedhman. - * - * 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.qi4j.library.cxf; - -import org.apache.cxf.jaxws.JaxWsServerFactoryBean; - -public interface JaxWsCreator -{ - void initialize( JaxWsServerFactoryBean svrFactory ); -} http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/72e375eb/libraries/cxf/src/main/java/org/qi4j/library/cxf/JaxWsServerFactoryInfo.java ---------------------------------------------------------------------- diff --git a/libraries/cxf/src/main/java/org/qi4j/library/cxf/JaxWsServerFactoryInfo.java b/libraries/cxf/src/main/java/org/qi4j/library/cxf/JaxWsServerFactoryInfo.java deleted file mode 100644 index 62ee0d8..0000000 --- a/libraries/cxf/src/main/java/org/qi4j/library/cxf/JaxWsServerFactoryInfo.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 2010 Niclas Hedhman. - * - * 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.qi4j.library.cxf; - -/** - * The JaxWsServerFactoryInfo is a metaInfo type to set to services that wants to be exposed as - * WebServices. Additionally, the service must have a {@code Visibility} set to {@code application} - * otherwise the Apache CXF extension will not be able to detect the presence of the service (assuming it is in a - * higher layer). - */ -public final class JaxWsServerFactoryInfo -{ - - private final JaxWsCreator initializer; - private final String address; - - public JaxWsServerFactoryInfo( JaxWsCreator initializer, String address ) - { - this.initializer = initializer; - this.address = address; - } - - public String address() - { - return address; - } - - public JaxWsCreator initializer() - { - return initializer; - } -} http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/72e375eb/libraries/cxf/src/main/java/org/qi4j/library/cxf/JaxWsService.java ---------------------------------------------------------------------- diff --git a/libraries/cxf/src/main/java/org/qi4j/library/cxf/JaxWsService.java b/libraries/cxf/src/main/java/org/qi4j/library/cxf/JaxWsService.java deleted file mode 100644 index a66949a..0000000 --- a/libraries/cxf/src/main/java/org/qi4j/library/cxf/JaxWsService.java +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Copyright 2010 Niclas Hedhman. - * - * 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.qi4j.library.cxf; - -import org.apache.cxf.aegis.AegisContext; -import org.apache.cxf.aegis.databinding.AegisDatabinding; -import org.apache.cxf.aegis.type.AbstractTypeCreator; -import org.apache.cxf.aegis.type.TypeCreationOptions; -import org.apache.cxf.aegis.type.TypeMapping; -import org.apache.cxf.interceptor.LoggingInInterceptor; -import org.apache.cxf.interceptor.LoggingOutInterceptor; -import org.apache.cxf.jaxws.JaxWsServerFactoryBean; -import org.qi4j.api.activation.ActivatorAdapter; -import org.qi4j.api.activation.Activators; -import org.qi4j.api.injection.scope.Structure; -import org.qi4j.api.injection.scope.Uses; -import org.qi4j.api.mixin.Mixins; -import org.qi4j.api.object.ObjectFactory; -import org.qi4j.api.service.ServiceComposite; -import org.qi4j.api.service.ServiceDescriptor; -import org.qi4j.api.service.ServiceReference; -import org.qi4j.api.structure.Module; - -import static org.qi4j.functional.Iterables.first; - -@Mixins( JaxWsService.JaxWsMixin.class ) -@Activators( JaxWsService.Activator.class ) -public interface JaxWsService extends ServiceComposite -{ - - - void initializeJaxWsFactory(); - - public static class Activator - extends ActivatorAdapter> - { - - @Override - public void afterActivation( ServiceReference activated ) - throws Exception - { - activated.get().initializeJaxWsFactory(); - } - - } - - public abstract static class JaxWsMixin - implements JaxWsService - { - @Structure - private Module module; - - @Structure - private ObjectFactory obf; - - @Uses - ServiceDescriptor descriptor; - - @Override - public void initializeJaxWsFactory() - { - final JaxWsServerFactoryInfo info = descriptor.metaInfo( JaxWsServerFactoryInfo.class ); - AegisDatabinding dataBinding = new AegisDatabinding(); - createQi4jTypeCreator( dataBinding ); - JaxWsServerFactoryBean svrFactory = new JaxWsServerFactoryBean(); - svrFactory.setDataBinding( dataBinding ); - svrFactory.setServiceClass( first( descriptor.types() ) ); - svrFactory.setServiceBean( findThisService() ); - if( info != null ) - { - svrFactory.setAddress( info.address() ); - JaxWsCreator creator = info.initializer(); - if( creator != null ) - { - creator.initialize( svrFactory ); - } - } - else - { - svrFactory.setAddress( "http://localhost:9300/" + identity().get() ); - svrFactory.getInInterceptors().add( new LoggingInInterceptor() ); - svrFactory.getOutInterceptors().add( new LoggingOutInterceptor() ); - } - svrFactory.create(); - } - - private void createQi4jTypeCreator( AegisDatabinding dataBinding ) - { - Qi4jTypeCreator qi4jTypeCreator = obf.newObject( Qi4jTypeCreator.class ); - - AegisContext aegisContext = dataBinding.getAegisContext(); - TypeMapping typeMapping = aegisContext.getTypeMapping(); - AbstractTypeCreator defaultCreator = (AbstractTypeCreator) typeMapping.getTypeCreator(); - TypeCreationOptions configuration = defaultCreator.getConfiguration(); - qi4jTypeCreator.setConfiguration( configuration ); - qi4jTypeCreator.setNextCreator( defaultCreator ); - qi4jTypeCreator.setTypeMapping( typeMapping ); - } - - private Object findThisService() - { - ServiceReference reference = module.findService( first( descriptor.types()) ); - if( reference == null ) - { - System.err.println( "Internal Error?? JaxWsService.findThisService()" ); - return null; // Should not be possible. - } - return reference.get(); - } - - } -} http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/72e375eb/libraries/cxf/src/main/java/org/qi4j/library/cxf/NamespaceUtil.java ---------------------------------------------------------------------- diff --git a/libraries/cxf/src/main/java/org/qi4j/library/cxf/NamespaceUtil.java b/libraries/cxf/src/main/java/org/qi4j/library/cxf/NamespaceUtil.java deleted file mode 100644 index 0d4e1c8..0000000 --- a/libraries/cxf/src/main/java/org/qi4j/library/cxf/NamespaceUtil.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2010 Niclas Hedhman. - * - * 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.qi4j.library.cxf; - -import java.lang.reflect.ParameterizedType; -import java.lang.reflect.Type; -import javax.xml.namespace.QName; - -/** - * - */ -public final class NamespaceUtil -{ - - private NamespaceUtil() - { - } - - public static QName convertJavaTypeToQName( Type type ) - { - if( type instanceof Class ) - { - Class valueType = (Class) type; - String packageName = valueType.getPackage().getName(); - String className = valueType.getSimpleName(); - QName typeQName = new QName( "urn:qi4j:type:value:" + packageName, className ); - return typeQName; - } - else if( type instanceof ParameterizedType ) - { - return convertJavaTypeToQName( ( (ParameterizedType) type ).getRawType() ); - } - else - { - throw new UnsupportedOperationException( - "Types that are not Class nor ParameterizedType are not yet supported:" + type ); - } - } -} http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/72e375eb/libraries/cxf/src/main/java/org/qi4j/library/cxf/Qi4jTypeCreator.java ---------------------------------------------------------------------- diff --git a/libraries/cxf/src/main/java/org/qi4j/library/cxf/Qi4jTypeCreator.java b/libraries/cxf/src/main/java/org/qi4j/library/cxf/Qi4jTypeCreator.java deleted file mode 100644 index 9c71d59..0000000 --- a/libraries/cxf/src/main/java/org/qi4j/library/cxf/Qi4jTypeCreator.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright 2010 Niclas Hedhman. - * - * 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.qi4j.library.cxf; - -import java.beans.PropertyDescriptor; -import java.lang.reflect.Method; -import org.apache.cxf.aegis.type.AbstractTypeCreator; -import org.apache.cxf.aegis.type.AegisType; -import org.apache.cxf.aegis.type.TypeClassInfo; -import org.qi4j.api.injection.scope.Structure; -import org.qi4j.api.structure.Module; -import org.qi4j.api.util.Classes; -import org.qi4j.api.value.ValueComposite; - -public class Qi4jTypeCreator extends AbstractTypeCreator -{ - @Structure - private Module module; - - @Override - public TypeClassInfo createClassInfo( PropertyDescriptor pd ) - { - return null; - } - - @Override - public AegisType createCollectionType( TypeClassInfo info ) - { - return null; - } - - @Override - public AegisType createDefaultType( TypeClassInfo info ) - { - if( ValueComposite.class.isAssignableFrom( Classes.RAW_CLASS.map( info.getType() ) ) ) - { - return module.newObject( ValueCompositeCxfType.class, info.getType(), getTypeMapping() ); - } - return nextCreator.createDefaultType( info ); - } - - @Override - public TypeClassInfo createClassInfo( Method m, int index ) - { - return null; - } -} http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/72e375eb/libraries/cxf/src/main/java/org/qi4j/library/cxf/ValueCompositeCxfType.java ---------------------------------------------------------------------- diff --git a/libraries/cxf/src/main/java/org/qi4j/library/cxf/ValueCompositeCxfType.java b/libraries/cxf/src/main/java/org/qi4j/library/cxf/ValueCompositeCxfType.java deleted file mode 100644 index bd1fb58..0000000 --- a/libraries/cxf/src/main/java/org/qi4j/library/cxf/ValueCompositeCxfType.java +++ /dev/null @@ -1,483 +0,0 @@ -/* - * Copyright (c) 2010, Niclas Hehdman. 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.qi4j.library.cxf; - -import java.lang.reflect.ParameterizedType; -import java.lang.reflect.Type; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import javax.xml.namespace.QName; -import org.apache.cxf.aegis.Context; -import org.apache.cxf.aegis.DatabindingException; -import org.apache.cxf.aegis.type.AegisType; -import org.apache.cxf.aegis.type.TypeMapping; -import org.apache.cxf.aegis.type.collection.CollectionType; -import org.apache.cxf.aegis.type.collection.MapType; -import org.apache.cxf.aegis.xml.MessageReader; -import org.apache.cxf.aegis.xml.MessageWriter; -import org.apache.cxf.common.xmlschema.XmlSchemaUtils; -import org.apache.ws.commons.schema.XmlSchema; -import org.apache.ws.commons.schema.XmlSchemaAttribute; -import org.apache.ws.commons.schema.XmlSchemaComplexType; -import org.apache.ws.commons.schema.XmlSchemaElement; -import org.apache.ws.commons.schema.XmlSchemaSequence; -import org.qi4j.api.Qi4j; -import org.qi4j.api.association.Association; -import org.qi4j.api.association.AssociationDescriptor; -import org.qi4j.api.association.AssociationStateHolder; -import org.qi4j.api.association.ManyAssociation; -import org.qi4j.api.association.NamedAssociation; -import org.qi4j.api.common.Optional; -import org.qi4j.api.common.QualifiedName; -import org.qi4j.api.composite.StateDescriptor; -import org.qi4j.api.entity.EntityReference; -import org.qi4j.api.entity.Identity; -import org.qi4j.api.injection.scope.Structure; -import org.qi4j.api.injection.scope.Uses; -import org.qi4j.api.property.Property; -import org.qi4j.api.property.PropertyDescriptor; -import org.qi4j.api.structure.Module; -import org.qi4j.api.util.Classes; -import org.qi4j.api.value.NoSuchValueException; -import org.qi4j.api.value.ValueBuilder; -import org.qi4j.api.value.ValueComposite; -import org.qi4j.api.value.ValueDescriptor; -import org.qi4j.functional.Function; -import org.qi4j.functional.Iterables; -import org.qi4j.spi.Qi4jSPI; - -import static org.qi4j.functional.Iterables.first; - -public class ValueCompositeCxfType - extends AegisType -{ - @Structure - private Module module; - - @Structure - Qi4jSPI spi; - - public ValueCompositeCxfType( @Uses Type type, @Uses TypeMapping typeMapping ) - { - setTypeMapping( typeMapping ); - setTypeClass( type ); - setSchemaType( NamespaceUtil.convertJavaTypeToQName( type ) ); - } - - @Override - public Object readObject( final MessageReader reader, final Context context ) - throws DatabindingException - { - QName qname = getSchemaType(); - final String className = ( qname.getNamespaceURI() + "." + qname.getLocalPart() ).substring( 20 ); - - // Read attributes - ValueDescriptor descriptor = module.valueDescriptor( className ); - StateDescriptor stateDescriptor = descriptor.state(); - final Map values = new HashMap<>(); - while( reader.hasMoreElementReaders() ) - { - MessageReader childReader = reader.getNextElementReader(); - QName childName = childReader.getName(); - QualifiedName childQualifiedName = QualifiedName.fromClass( (Class) typeClass, - childName.getLocalPart() ); - PropertyDescriptor propertyDescriptor = stateDescriptor.findPropertyModelByQualifiedName( - childQualifiedName ); - Type propertyType = propertyDescriptor.type(); - AegisType type = getTypeMapping().getType( propertyType ); - Object value = type.readObject( childReader, context ); - values.put( childQualifiedName, value ); - } - - ValueBuilder builder = module.newValueBuilderWithState( - (Class) typeClass, - new Function() - { - @Override - public Object map( PropertyDescriptor descriptor1 ) - { - return values.get( descriptor1.qualifiedName() ); - } - }, - new Function() - { - @Override - public EntityReference map( AssociationDescriptor descriptor ) - { - Object value = values.get( descriptor.qualifiedName() ); - if( value == null ) - { - return null; - } - return EntityReference.parseEntityReference( value.toString() ); - } - }, - new Function>() - { - @Override - public Iterable map( AssociationDescriptor descriptor ) - { - Object value = values.get( descriptor.qualifiedName() ); - if( value == null ) - { - return Iterables.empty(); - } - String[] ids = value.toString().split( "," ); - List references = new ArrayList<>( ids.length ); - for( String id : ids ) - { - references.add( EntityReference.parseEntityReference( id ) ); - } - return references; - } - }, - new Function>() - { - @Override - public Map map( AssociationDescriptor descriptor ) - { - Object value = values.get( descriptor.qualifiedName() ); - if( value == null ) - { - return Collections.emptyMap(); - } - String[] namedRefs = value.toString().split( "," ); - Map references = new HashMap<>( namedRefs.length ); - for( String namedRef : namedRefs ) - { - String[] splitted = namedRef.split( ":" ); - references.put( splitted[0], EntityReference.parseEntityReference( splitted[1] ) ); - } - return references; - } - } ); - - return builder.newInstance(); - } - - @Override - public void writeObject( Object object, final MessageWriter writer, final Context context ) - throws DatabindingException - { - ValueComposite composite = (ValueComposite) object; - writer.writeXsiType( NamespaceUtil.convertJavaTypeToQName( - first( Qi4j.FUNCTION_DESCRIPTOR_FOR.map( composite ).types() ) ) ); - AssociationStateHolder state = spi.stateOf( composite ); - for( Property property : state.properties() ) - { - Object value = property.get(); - AegisType type = null; - if( value instanceof ValueComposite ) - { - ValueComposite compositeValue = (ValueComposite) value; - type = getTypeMapping().getType( NamespaceUtil.convertJavaTypeToQName( - first( Qi4j.FUNCTION_DESCRIPTOR_FOR.map( compositeValue ).types() ) ) ); - } - else if( value != null ) - { - type = getOrCreateNonQi4jType( value ); - } - - QName childName = new QName( "", spi.propertyDescriptorFor( property ).qualifiedName().name() ); - MessageWriter cwriter = writer.getElementWriter( childName ); - if( type != null ) - { - type.writeObject( value, cwriter, context ); - } - else - { -// cwriter.writeXsiNil(); - } - cwriter.close(); - } - - AegisType type = getTypeMapping().getType( NamespaceUtil.convertJavaTypeToQName( String.class ) ); - for( Association association : state.allAssociations() ) - { - QName childName = new QName( "", spi.associationDescriptorFor( association ).qualifiedName().name() ); - MessageWriter cwriter = writer.getElementWriter( childName ); - - if( association.get() != null ) - { - type.writeObject( ( (Identity) association.get() ).identity().get(), cwriter, context ); - } - cwriter.close(); - } - - for( ManyAssociation association : state.allManyAssociations() ) - { - QName childName = new QName( "", spi.associationDescriptorFor( association ).qualifiedName().name() ); - MessageWriter cwriter = writer.getElementWriter( childName ); - - String ids = null; - for( Object entity : association ) - { - String id = EntityReference.entityReferenceFor( entity ).identity(); - if( ids != null ) - { - ids += ","; - } - ids += id; - } - if( ids == null ) - { - ids = ""; - } - type.writeObject( ids, cwriter, context ); - cwriter.close(); - } - - for( NamedAssociation association : state.allNamedAssociations() ) - { - QName childName = new QName( "", spi.associationDescriptorFor( association ).qualifiedName().name() ); - MessageWriter cwriter = writer.getElementWriter( childName ); - - String ids = null; - for( String name : association ) - { - String id = EntityReference.entityReferenceFor( association.get( name ) ).identity(); - if( ids != null ) - { - ids += ","; - } - ids += name + ":" + id; - } - if( ids == null ) - { - ids = ""; - } - type.writeObject( ids, cwriter, context ); - cwriter.close(); - } - } - - private AegisType getOrCreateNonQi4jType( Object value ) - { - AegisType type; - TypeMapping mapping = getTypeMapping(); - Class javaType = value.getClass(); - type = mapping.getType( javaType ); - if( type == null ) - { - // This might be wrong and instead the ultimate top parent should be used. This works, since - // we know that we are the top parent. - type = getTypeMapping().getTypeCreator().createType( javaType ); - mapping.register( type ); - } - return type; - } - - @Override - public void writeSchema( XmlSchema root ) - { - XmlSchemaComplexType complex = new XmlSchemaComplexType( root, true ); - complex.setName( getSchemaType().getLocalPart() ); - root.getItems().add( complex ); - - XmlSchemaSequence sequence = new XmlSchemaSequence(); // No clue why this? - complex.setParticle( sequence ); // No idea what this is for - - ValueDescriptor descriptor = module.valueDescriptor( getTypeClass().getName() ); - - for( PropertyDescriptor p : descriptor.state().properties() ) - { - if( isValueComposite( p.type() ) ) - { - XmlSchemaElement element = new XmlSchemaElement( root, false ); - element.setName( p.qualifiedName().name() ); - element.setNillable( p.metaInfo( Optional.class ) != null ); // see below - sequence.getItems().add( element ); - AegisType nested = getOrCreateAegisType( p.type(), root ); - element.setSchemaTypeName( nested.getSchemaType() ); - } - else if( isCollectionOrMap( p ) ) - { - XmlSchemaElement element = new XmlSchemaElement( root, false ); - element.setName( p.qualifiedName().name() ); - element.setNillable( p.metaInfo( Optional.class ) != null ); // see below - sequence.getItems().add( element ); - AegisType nested = getOrCreateAegisType( p.type(), root ); - element.setSchemaTypeName( nested.getSchemaType() ); - } - else - { - XmlSchemaAttribute attribute = new XmlSchemaAttribute( root, false ); - complex.getAttributes().add( attribute ); - attribute.setName( p.qualifiedName().name() ); - AegisType nested = getTypeMapping().getType( p.type() ); - attribute.setSchemaTypeName( nested.getSchemaType() ); - } - QName name = NamespaceUtil.convertJavaTypeToQName( p.type() ); - String ns = name.getNamespaceURI(); - if( !ns.equals( root.getTargetNamespace() ) ) - { - XmlSchemaUtils.addImportIfNeeded( root, ns ); - } - } - } - - private AegisType getOrCreateAegisType( Type type, XmlSchema root ) - { - AegisType nested = getTypeMapping().getType( type ); - if( nested == null ) - { - nested = createType( type, root ); - nested.writeSchema( root ); - } - return nested; - } - - private AegisType createType( Type type, XmlSchema root ) - { - if( isCollection( type ) ) - { - AegisType componentType = getOrCreateAegisType( getCollectionComponentType( type ), root ); - CollectionType resultType = new CollectionType( componentType ); - QName schemaType = new QName( "http://www.w3.org/2001/XMLSchema", "list" ); - resultType.setSchemaType( schemaType ); - return resultType; - } - else if( isMap( type ) ) - { - AegisType keyType = getOrCreateAegisType( getMapKeyComponentType( type ), root ); - AegisType valueType = getOrCreateAegisType( getMapValueComponentType( type ), root ); - QName schemaType = new QName( Classes.toURI( Classes.RAW_CLASS.map( type ) ), "map" ); - return new MapType( schemaType, keyType, valueType ); - } - else if( isValueComposite( type ) ) - { - ValueCompositeCxfType aegisType = module.newObject( ValueCompositeCxfType.class, getTypeMapping(), type ); - getTypeMapping().register( aegisType ); - return aegisType; - } - else - { - throw new NoSuchValueException( type.toString(), module.name() ); - } - } - - private boolean isCollectionOrMap( final PropertyDescriptor p ) - { - Type type = p.type(); - return isCollectionOrMap( type ); - } - - private boolean isCollection( Type type ) - { - if( isCollectionClass( type ) ) - { - return true; - } - if( type instanceof ParameterizedType ) - { - ParameterizedType param = (ParameterizedType) type; - Type rawType = param.getRawType(); - if( isCollectionClass( rawType ) ) - { - return true; - } - } - return false; - } - - private boolean isMap( Type type ) - { - if( isMapClass( type ) ) - { - return true; - } - if( type instanceof ParameterizedType ) - { - ParameterizedType param = (ParameterizedType) type; - Type rawType = param.getRawType(); - if( isCollectionClass( rawType ) ) - { - return true; - } - } - return false; - } - - private boolean isCollectionOrMap( Type type ) - { - return isMap( type ) || isCollection( type ); - } - - @SuppressWarnings( "raw" ) - private boolean isCollectionClass( Type type ) - { - if( type instanceof Class ) - { - Class clazz = (Class) type; - return Collection.class.isAssignableFrom( clazz ); - } - return false; - } - - @SuppressWarnings( "raw" ) - private boolean isMapClass( Type type ) - { - if( type instanceof Class ) - { - Class clazz = (Class) type; - return Map.class.isAssignableFrom( clazz ); - } - return false; - } - - private Type getCollectionComponentType( Type p ) - { - return getActualTypeArgument( p, 0 ); - } - - private Type getMapKeyComponentType( Type p ) - { - return getActualTypeArgument( p, 0 ); - } - - private Type getMapValueComponentType( Type p ) - { - return getActualTypeArgument( p, 1 ); - } - - private Type getActualTypeArgument( Type p, int index ) - { - if( p instanceof ParameterizedType ) - { - ParameterizedType type = (ParameterizedType) p; - return type.getActualTypeArguments()[index]; - } - return null; - } - - @SuppressWarnings( "raw" ) - private boolean isValueComposite( Type type ) - { - Class clazz = Classes.RAW_CLASS.map( type ); - ValueDescriptor descriptor = module.valueDescriptor( clazz.getName() ); - return descriptor != null; - } - - @Override - public boolean isComplex() - { - return true; - } -} http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/72e375eb/libraries/cxf/src/main/java/org/qi4j/library/cxf/package.html ---------------------------------------------------------------------- diff --git a/libraries/cxf/src/main/java/org/qi4j/library/cxf/package.html b/libraries/cxf/src/main/java/org/qi4j/library/cxf/package.html deleted file mode 100644 index 56ced64..0000000 --- a/libraries/cxf/src/main/java/org/qi4j/library/cxf/package.html +++ /dev/null @@ -1,9 +0,0 @@ - - -

CXF Library.

-

- The CXF Library defines Value-to-Soap type converter and also simplifies the set up of CXF in a Qi4j - environment. -

- - \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/72e375eb/libraries/cxf/src/test/java/org/qi4j/library/cxf/HelloClient.java ---------------------------------------------------------------------- diff --git a/libraries/cxf/src/test/java/org/qi4j/library/cxf/HelloClient.java b/libraries/cxf/src/test/java/org/qi4j/library/cxf/HelloClient.java deleted file mode 100644 index a0f27b3..0000000 --- a/libraries/cxf/src/test/java/org/qi4j/library/cxf/HelloClient.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2010 Niclas Hedhman. - * - * 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.qi4j.library.cxf; - -import org.apache.cxf.interceptor.LoggingInInterceptor; -import org.apache.cxf.interceptor.LoggingOutInterceptor; -import org.apache.cxf.jaxws.JaxWsProxyFactoryBean; - -public final class HelloClient -{ - private HelloClient() - { - } - - public static void main( String[] args ) - { - JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean(); - factory.getInInterceptors().add( new LoggingInInterceptor() ); - factory.getOutInterceptors().add( new LoggingOutInterceptor() ); - factory.setServiceClass( HelloWorld.class ); - factory.setAddress( "http://localhost:9001/helloWorld" ); - HelloWorld client = (HelloWorld) factory.create(); - - String reply = client.sayHi( "World" ); - System.out.println( "Server said: " + reply ); - } -} http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/72e375eb/libraries/cxf/src/test/java/org/qi4j/library/cxf/HelloMain.java ---------------------------------------------------------------------- diff --git a/libraries/cxf/src/test/java/org/qi4j/library/cxf/HelloMain.java b/libraries/cxf/src/test/java/org/qi4j/library/cxf/HelloMain.java deleted file mode 100644 index d3e883b..0000000 --- a/libraries/cxf/src/test/java/org/qi4j/library/cxf/HelloMain.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2010 Niclas Hedhman. - * - * 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.qi4j.library.cxf; - -import org.apache.cxf.interceptor.LoggingInInterceptor; -import org.apache.cxf.interceptor.LoggingOutInterceptor; -import org.apache.cxf.jaxws.JaxWsServerFactoryBean; - -public final class HelloMain -{ - private HelloMain() - { - } - - public static void main( String[] args ) - { - HelloWorldImpl implementor = new HelloWorldImpl(); - JaxWsServerFactoryBean svrFactory = new JaxWsServerFactoryBean(); - svrFactory.setServiceClass( HelloWorld.class ); - svrFactory.setAddress( "http://localhost:9001/helloWorld" ); - svrFactory.setServiceBean( implementor ); - svrFactory.getInInterceptors().add( new LoggingInInterceptor() ); - svrFactory.getOutInterceptors().add( new LoggingOutInterceptor() ); - svrFactory.create(); - } -} http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/72e375eb/libraries/cxf/src/test/java/org/qi4j/library/cxf/HelloWorld.java ---------------------------------------------------------------------- diff --git a/libraries/cxf/src/test/java/org/qi4j/library/cxf/HelloWorld.java b/libraries/cxf/src/test/java/org/qi4j/library/cxf/HelloWorld.java deleted file mode 100644 index 521df29..0000000 --- a/libraries/cxf/src/test/java/org/qi4j/library/cxf/HelloWorld.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright 2010 Niclas Hedhman. - * - * 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.qi4j.library.cxf; - -import javax.jws.WebParam; -import javax.jws.WebService; - -@WebService -public interface HelloWorld -{ - String sayHi( @WebParam( name = "text" ) String text ); -} http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/72e375eb/libraries/cxf/src/test/java/org/qi4j/library/cxf/HelloWorldImpl.java ---------------------------------------------------------------------- diff --git a/libraries/cxf/src/test/java/org/qi4j/library/cxf/HelloWorldImpl.java b/libraries/cxf/src/test/java/org/qi4j/library/cxf/HelloWorldImpl.java deleted file mode 100644 index ba236a5..0000000 --- a/libraries/cxf/src/test/java/org/qi4j/library/cxf/HelloWorldImpl.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright 2010 Niclas Hedhman. - * - * 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.qi4j.library.cxf; - -import java.util.LinkedHashMap; -import java.util.Map; -import javax.jws.WebService; - -@WebService( endpointInterface = "org.qi4j.library.cxf.HelloWorld", - serviceName = "HelloWorld" ) -public class HelloWorldImpl implements HelloWorld -{ - private final Map users; - - public HelloWorldImpl() - { - users = new LinkedHashMap<>(); - } - - public String sayHi( String text ) - { - System.out.println( "sayHi called" ); - return "Hello " + text; - } - - public String sayHiToUser( User user ) - { - System.out.println( "sayHiToUser called" ); - users.put( users.size() + 1, user ); - return "Hello " + user.getName(); - } - - public Map getUsers() - { - System.out.println( "getUsers called" ); - return users; - } -} http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/72e375eb/libraries/cxf/src/test/java/org/qi4j/library/cxf/Subscription.java ---------------------------------------------------------------------- diff --git a/libraries/cxf/src/test/java/org/qi4j/library/cxf/Subscription.java b/libraries/cxf/src/test/java/org/qi4j/library/cxf/Subscription.java deleted file mode 100644 index cdd7e99..0000000 --- a/libraries/cxf/src/test/java/org/qi4j/library/cxf/Subscription.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2010 Niclas Hedhman. - * - * 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.qi4j.library.cxf; - -public class Subscription -{ - private String key; - - public String getKey() - { - return key; - } - - public void setKey( String key ) - { - this.key = key; - } -} http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/72e375eb/libraries/cxf/src/test/java/org/qi4j/library/cxf/User.java ---------------------------------------------------------------------- diff --git a/libraries/cxf/src/test/java/org/qi4j/library/cxf/User.java b/libraries/cxf/src/test/java/org/qi4j/library/cxf/User.java deleted file mode 100644 index ff3c6d1..0000000 --- a/libraries/cxf/src/test/java/org/qi4j/library/cxf/User.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2010 Niclas Hedhman. - * - * 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.qi4j.library.cxf; - -public class User -{ - private String name; - - public void setName( String name ) - { - this.name = name; - } - - public String getName() - { - return name; - } -} http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/72e375eb/libraries/cxf/src/test/java/org/qi4j/library/cxf/divs/DivPoint.java ---------------------------------------------------------------------- diff --git a/libraries/cxf/src/test/java/org/qi4j/library/cxf/divs/DivPoint.java b/libraries/cxf/src/test/java/org/qi4j/library/cxf/divs/DivPoint.java deleted file mode 100644 index 147f490..0000000 --- a/libraries/cxf/src/test/java/org/qi4j/library/cxf/divs/DivPoint.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2010 Niclas Hedhman. - * - * 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.qi4j.library.cxf.divs; - -import org.qi4j.api.property.Property; -import org.qi4j.api.value.ValueComposite; - -public interface DivPoint extends ValueComposite -{ - Property dt(); - - Property val(); - - Property valCcy(); - - Property divType(); - - Property recType(); - - Property net(); - - Property netCcy(); - - Property recDate(); - - Property paydate(); - - Property divTypeCD(); - - Property comment(); - - Property updateTS(); - - Property lastUpdater(); -} http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/72e375eb/libraries/cxf/src/test/java/org/qi4j/library/cxf/divs/DivStream.java ---------------------------------------------------------------------- diff --git a/libraries/cxf/src/test/java/org/qi4j/library/cxf/divs/DivStream.java b/libraries/cxf/src/test/java/org/qi4j/library/cxf/divs/DivStream.java deleted file mode 100644 index 221ec4d..0000000 --- a/libraries/cxf/src/test/java/org/qi4j/library/cxf/divs/DivStream.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright 2010 Niclas Hedhman. - * - * 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.qi4j.library.cxf.divs; - -import java.util.List; -import org.qi4j.api.property.Property; -import org.qi4j.api.value.ValueComposite; - -public interface DivStream extends ValueComposite -{ - Property mdSymbol(); - - Property streamName(); - - Property consolidate(); - - Property issueId(); - - Property systemUpdateTS(); - - Property userUpdateTS(); - - Property> divPoints(); -} http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/72e375eb/libraries/cxf/src/test/java/org/qi4j/library/cxf/divs/Dividends.java ---------------------------------------------------------------------- diff --git a/libraries/cxf/src/test/java/org/qi4j/library/cxf/divs/Dividends.java b/libraries/cxf/src/test/java/org/qi4j/library/cxf/divs/Dividends.java deleted file mode 100644 index 9eb8a88..0000000 --- a/libraries/cxf/src/test/java/org/qi4j/library/cxf/divs/Dividends.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright 2010 Niclas Hedhman. - * - * 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.qi4j.library.cxf.divs; - -import org.qi4j.api.property.Property; - -public interface Dividends -{ - Property divStream(); -} http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/72e375eb/libraries/cxf/src/test/java/org/qi4j/library/cxf/divs/DividendsMain.java ---------------------------------------------------------------------- diff --git a/libraries/cxf/src/test/java/org/qi4j/library/cxf/divs/DividendsMain.java b/libraries/cxf/src/test/java/org/qi4j/library/cxf/divs/DividendsMain.java deleted file mode 100644 index 4e2458f..0000000 --- a/libraries/cxf/src/test/java/org/qi4j/library/cxf/divs/DividendsMain.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright 2010 Niclas Hedhman. - * - * 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.qi4j.library.cxf.divs; - -import org.qi4j.api.structure.Application; -import org.qi4j.bootstrap.AssemblyException; -import org.qi4j.bootstrap.ModuleAssembly; -import org.qi4j.bootstrap.SingletonAssembler; -import org.qi4j.library.cxf.CxfAssembler; - -public final class DividendsMain -{ - private DividendsMain() - { - } - - public static void main( String[] args ) - throws Exception - { - SingletonAssembler assembler = new SingletonAssembler() - { - - public void assemble( ModuleAssembly module ) - throws AssemblyException - { - module.services( ProjectedDividendsService.class ).instantiateOnStartup(); - module.values( DivStream.class, DivPoint.class ); - new CxfAssembler().assemble( module ); - } - }; - final Application application = assembler.application(); - Runtime.getRuntime().addShutdownHook( new Thread() - { - @Override - public void run() - { - try - { - application.passivate(); - } - catch( Exception e ) - { - System.err.println( "Problem shutting down Qi4j" ); - e.printStackTrace(); - } - } - } ); - } -} http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/72e375eb/libraries/cxf/src/test/java/org/qi4j/library/cxf/divs/DividendsTest.java ---------------------------------------------------------------------- diff --git a/libraries/cxf/src/test/java/org/qi4j/library/cxf/divs/DividendsTest.java b/libraries/cxf/src/test/java/org/qi4j/library/cxf/divs/DividendsTest.java deleted file mode 100644 index 19e4c42..0000000 --- a/libraries/cxf/src/test/java/org/qi4j/library/cxf/divs/DividendsTest.java +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Copyright 2010 Niclas Hedhman. - * - * 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.qi4j.library.cxf.divs; - -import java.io.BufferedReader; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.util.Date; -import org.apache.http.HttpEntity; -import org.apache.http.HttpResponse; -import org.apache.http.client.HttpClient; -import org.apache.http.client.methods.HttpPost; -import org.apache.http.entity.StringEntity; -import org.apache.http.impl.client.DefaultHttpClient; -import org.junit.Test; - -import static org.junit.Assert.assertEquals; - -import org.custommonkey.xmlunit.XMLAssert; - -public class DividendsTest -{ - private static final String EXPECTED = - "" + - "" + - "" + - "" + - "bt.l/PRIVATE_niclas" + - "" + - "PC10YZNZC100" + - "" + - "" + - "" + new Date( 2010, 10, 10 ).toString() + "" + - "" + - "USD" + - "A" + - "0.708" + - "
2010-02-12
" + - "0.637200003862381" + - "USD" + - "2017-09-19" + - "2014-06-16" + - "REG" + - "Silly comment" + - "niclas" + - "
" + - "" + - "" + new Date( 2010, 10, 10 ).toString() + "" + - "" + - "USD" + - "A" + - "3.068" + - "
2020-02-22
" + - "2.7612000703811646" + - "USD" + - "2027-09-10" + - "2024-06-26" + - "REG" + - "Silly comment" + - "niclas" + - "
" + - "
" + - "" + new Date( 2010, 10, 10 ).toString() + "" + - "PRIVATE_niclas" + - "" + new Date( 2010, 10, 10 ).toString() + "" + - "N" + - "bt.l" + - "
" + - "
" + - "
" + - "
" + - "
" + - "
"; - - @Test - public void whenRequestQi4jValueExpectCorrectResult() - throws Exception - { - DividendsMain.main( new String[ 0 ] ); // Start server; - - HttpClient httpclient = new DefaultHttpClient(); - HttpPost httpPost = new HttpPost( "http://localhost:9300/ProjectedDividendsService" ); - httpPost.setHeader( "SOAPAction", "\"DSDataRequest\"" ); - httpPost.setHeader( "Content-Type", "text/xml;charset=UTF-8" ); - HttpEntity data = new StringEntity( - "\n" + - " \n" + - " \n" + - " \n" + - " \n" + - " ?\n" + - " \n" + - " ?\n" + - " \n" + - " \n" + - " \n" + - " ?\n" + - " \n" + - " \n" + - " \n" + - "" ); - httpPost.setEntity( data ); - HttpResponse response = httpclient.execute( httpPost ); - HttpEntity entity = response.getEntity(); - String result = ""; - if( entity != null ) - { - InputStream instream = entity.getContent(); - InputStreamReader isr = new InputStreamReader( instream ); - BufferedReader br = new BufferedReader( isr ); - String line = br.readLine(); - while( line != null ) - { - result = result + line; - line = br.readLine(); - } - } - XMLAssert.assertXMLEqual( EXPECTED, result ); - } -} http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/72e375eb/libraries/cxf/src/test/java/org/qi4j/library/cxf/divs/ProjectedDividends.java ---------------------------------------------------------------------- diff --git a/libraries/cxf/src/test/java/org/qi4j/library/cxf/divs/ProjectedDividends.java b/libraries/cxf/src/test/java/org/qi4j/library/cxf/divs/ProjectedDividends.java deleted file mode 100644 index 6736b69..0000000 --- a/libraries/cxf/src/test/java/org/qi4j/library/cxf/divs/ProjectedDividends.java +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright 2010 Niclas Hedhman. - * - * 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.qi4j.library.cxf.divs; - -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import javax.jws.WebMethod; -import javax.jws.WebParam; -import javax.jws.WebResult; -import javax.jws.WebService; -import org.qi4j.api.injection.scope.Structure; -import org.qi4j.api.mixin.Mixins; -import org.qi4j.api.value.ValueBuilder; -import org.qi4j.api.value.ValueBuilderFactory; -import org.qi4j.library.cxf.Subscription; - -@WebService -@Mixins( ProjectedDividends.ProjectedDividendsMixin.class ) -public interface ProjectedDividends -{ - @WebMethod( action = "DSDataRequest", operationName = "DSData" ) - @WebResult( name = "Snapshot" ) - Map getSnapshot( - @WebParam( name = "RequestType" ) String requestType, - @WebParam( name = "DataService" ) String dataService, - @WebParam( name = "Subscription" ) Subscription subscription - ); - - public class ProjectedDividendsMixin - implements ProjectedDividends - { - private static final double NINETY_PERCENT = 0.9; - private static final float BASE_OFFSET = 0.236f; - - @Structure - private ValueBuilderFactory vbf; - - private int counter; - - public Map getSnapshot( String requestType, String dataService, Subscription subscription ) - { - HashMap result = new HashMap(); - result.put( "bt.l/PRIVATE_niclas", createDivStream() ); - return result; - } - - private DivStream createDivStream() - { - ValueBuilder builder = vbf.newValueBuilder( DivStream.class ); - DivStream prototype = builder.prototype(); - List divPoints = new ArrayList(); - for( int i = 0; i < 2; i++ ) - { - divPoints.add( createDivPoint() ); - } - prototype.divPoints().set( divPoints ); - prototype.consolidate().set( "N" ); - prototype.streamName().set( "PRIVATE_niclas" ); - prototype.systemUpdateTS().set( new Date( 2010, 10, 10 ).toString() ); - prototype.userUpdateTS().set( new Date( 2010, 10, 10 ).toString() ); - prototype.issueId().set( "PC10YZNZC100" ); - prototype.mdSymbol().set( "bt.l" ); - return builder.newInstance(); - } - - private DivPoint createDivPoint() - { - ValueBuilder builder = vbf.newValueBuilder( DivPoint.class ); - DivPoint prototype = builder.prototype(); - prototype.comment().set( "Silly comment " ); - prototype.dt().set( createRandomDate() ); - float amount = randomAmount(); - prototype.val().set( "" + amount ); - prototype.valCcy().set( "USD" ); - prototype.divType().set( "REG" ); - prototype.recType().set( "A" ); - prototype.net().set( "" + ( amount * NINETY_PERCENT ) ); - prototype.netCcy().set( "USD" ); - prototype.recDate().set( createRandomDate() ); - prototype.paydate().set( createRandomDate() ); - prototype.divTypeCD().set( "" ); - prototype.comment().set( "Silly comment" ); - prototype.updateTS().set( new Date( 2010, 10, 10 ).toString() ); - prototype.lastUpdater().set( "niclas" ); - return builder.newInstance(); - } - - private float randomAmount() - { - return BASE_OFFSET * counter++; - } - - private String createRandomDate() - { - return "20" + ( counter++ + 10 ) + "-0" + ( ( counter++ % 10 ) + 1 ) + "-" + ( ( counter++ % 19 ) + 10 ); - } - } -} http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/72e375eb/libraries/cxf/src/test/java/org/qi4j/library/cxf/divs/ProjectedDividendsService.java ---------------------------------------------------------------------- diff --git a/libraries/cxf/src/test/java/org/qi4j/library/cxf/divs/ProjectedDividendsService.java b/libraries/cxf/src/test/java/org/qi4j/library/cxf/divs/ProjectedDividendsService.java deleted file mode 100644 index 700ecb8..0000000 --- a/libraries/cxf/src/test/java/org/qi4j/library/cxf/divs/ProjectedDividendsService.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright 2010 Niclas Hedhman. - * - * 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.qi4j.library.cxf.divs; - -import org.qi4j.library.cxf.JaxWsService; - -public interface ProjectedDividendsService extends ProjectedDividends, JaxWsService -{ -} http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/72e375eb/settings.gradle ---------------------------------------------------------------------- diff --git a/settings.gradle b/settings.gradle index 8ab6e91..1ce0e33 100644 --- a/settings.gradle +++ b/settings.gradle @@ -28,7 +28,6 @@ include "core:functional", 'libraries:circuitbreaker', 'libraries:constraints', 'libraries:conversion', - 'libraries:cxf', 'libraries:eventsourcing', 'libraries:eventsourcing-jdbm', 'libraries:eventsourcing-rest', http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/72e375eb/tutorials/composites/build.gradle ---------------------------------------------------------------------- diff --git a/tutorials/composites/build.gradle b/tutorials/composites/build.gradle index a2106e5..6b59407 100644 --- a/tutorials/composites/build.gradle +++ b/tutorials/composites/build.gradle @@ -6,7 +6,7 @@ dependencies { compile(project(":org.qi4j.core:org.qi4j.core.bootstrap")) compile(project(":org.qi4j.libraries:org.qi4j.library.constraints")) compile(project(":org.qi4j.libraries:org.qi4j.library.rdf")) - compile(project(":org.qi4j.libraries:org.qi4j.library.lang-jruby")) + compile(project(":org.qi4j.libraries:org.qi4j.library.lang-groovy")) testCompile(project(":org.qi4j.core:org.qi4j.core.testsupport")) testRuntime(project(":org.qi4j.core:org.qi4j.core.runtime"))