From jbossws-commits at lists.jboss.org Mon Jul 27 08:30:32 2009 Content-Type: multipart/mixed; boundary="===============6980035317148520463==" MIME-Version: 1.0 From: jbossws-commits at lists.jboss.org To: jbossws-commits at lists.jboss.org Subject: [jbossws-commits] JBossWS SVN: r10391 - common/branches/ropalka/src/main/java/org/jboss/wsf/common/integration. Date: Mon, 27 Jul 2009 08:30:32 -0400 Message-ID: <200907271230.n6RCUWUT028401@svn01.web.mwc.hst.phx2.redhat.com> --===============6980035317148520463== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: richard.opalka(a)jboss.com Date: 2009-07-27 08:30:32 -0400 (Mon, 27 Jul 2009) New Revision: 10391 Added: common/branches/ropalka/src/main/java/org/jboss/wsf/common/integration/W= SConstants.java common/branches/ropalka/src/main/java/org/jboss/wsf/common/integration/W= SHelper.java Removed: common/branches/ropalka/src/main/java/org/jboss/wsf/common/integration/C= onstants.java Log: [JBWS-2332] refactoring Deleted: common/branches/ropalka/src/main/java/org/jboss/wsf/common/integra= tion/Constants.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- common/branches/ropalka/src/main/java/org/jboss/wsf/common/integration/= Constants.java 2009-07-27 09:36:28 UTC (rev 10390) +++ common/branches/ropalka/src/main/java/org/jboss/wsf/common/integration/= Constants.java 2009-07-27 12:30:32 UTC (rev 10391) @@ -1,49 +0,0 @@ -/* - * JBoss, Home of Professional Open Source. - * Copyright 2009, Red Hat Middleware LLC, and individual contributors - * as indicated by the @author tags. See the copyright.txt file in the - * distribution for a full listing of individual contributors. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ -package org.jboss.wsf.common.integration; - -/** - * Cross WS stack and JBoss AS integrations constants. - * - * @author Richard Opalka - */ -public final class Constants -{ - = - /** - * Stack specific context parameters configuration property. - */ - public static final String STACK_CONTEXT_PARAMS =3D Constants.class.get= Name() + ".StackContextParams"; - /** - * Stack specific transport class configuration property. - */ - public static final String STACK_TRANSPORT_CLASS =3D Constants.class.ge= tName() + ".StackTransportClass"; - = - /** - * Forbidden constructor. - */ - private Constants() - { - super(); - } - -} Added: common/branches/ropalka/src/main/java/org/jboss/wsf/common/integrati= on/WSConstants.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- common/branches/ropalka/src/main/java/org/jboss/wsf/common/integration/= WSConstants.java (rev 0) +++ common/branches/ropalka/src/main/java/org/jboss/wsf/common/integration/= WSConstants.java 2009-07-27 12:30:32 UTC (rev 10391) @@ -0,0 +1,49 @@ +/* + * JBoss, Home of Professional Open Source. + * Copyright 2009, Red Hat Middleware LLC, and individual contributors + * as indicated by the @author tags. See the copyright.txt file in the + * distribution for a full listing of individual contributors. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ +package org.jboss.wsf.common.integration; + +/** + * Cross WS stack and JBoss AS integration constants. + * + * @author Richard Opalka + */ +public final class WSConstants +{ + = + /** + * Stack specific context parameters configuration property. + */ + public static final String STACK_CONTEXT_PARAMS =3D "stack.context.para= meters"; + /** + * Stack specific transport class configuration property. + */ + public static final String STACK_TRANSPORT_CLASS =3D "stack.transport.c= lass"; + = + /** + * Forbidden constructor. + */ + private WSConstants() + { + super(); + } + +} Added: common/branches/ropalka/src/main/java/org/jboss/wsf/common/integrati= on/WSHelper.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- common/branches/ropalka/src/main/java/org/jboss/wsf/common/integration/= WSHelper.java (rev 0) +++ common/branches/ropalka/src/main/java/org/jboss/wsf/common/integration/= WSHelper.java 2009-07-27 12:30:32 UTC (rev 10391) @@ -0,0 +1,193 @@ +/* + * JBoss, Home of Professional Open Source. + * Copyright 2009, Red Hat Middleware LLC, and individual contributors + * as indicated by the @author tags. See the copyright.txt file in the + * distribution for a full listing of individual contributors. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ +package org.jboss.wsf.common.integration; + +import org.jboss.logging.Logger; +import org.jboss.wsf.spi.deployment.Deployment; +import org.jboss.wsf.spi.deployment.Deployment.DeploymentType; + +/** + * Cross WS stack and JBoss AS integration helper. + * + * @author Richard Opalka + */ +public final class WSHelper +{ + = + /** Logger. */ + private static final Logger LOG =3D Logger.getLogger( WSHelper.class ); + + /** + * Forbidden constructor. + */ + private WSHelper() + { + super(); + } + + /** + * Returns required attachment value from webservice deployment. + * = + * @param expected value + * @param dep webservice deployment + * @param key attachment key + * @return required attachment = + * @throws IllegalStateException if attachment value is null + */ + public static A getRequiredAttachment( final Deployment dep, final = Class< A > key ) + { + final A value =3D dep.getAttachment( key ); + if ( value =3D=3D null ) + { + WSHelper.LOG.error( "Cannot find attachment in webservice deploym= ent: " + key ); + throw new IllegalStateException(); + } + = + return value; + } + = + /** + * Returns optional attachment value from webservice deployment or null= if not bound. + * = + * @param expected value + * @param dep webservice deployment + * @param key attachment key + * @return optional attachment value or null = + */ + public static A getOptionalAttachment( final Deployment dep, final = Class< A > key ) + { + return dep.getAttachment( key ); + } + + /** + * Returns true if webservice deployment have attachment value associat= ed with the key. + * = + * @param dep webservice deployment + * @param key attachment key + * @return true if contains attachment, false otherwise + */ + public static boolean hasAttachment( final Deployment dep, final Class<= ? > key ) + { + return WSHelper.getOptionalAttachment( dep, key ) !=3D null; + } + + /** + * Returns true if deployment represents JAXRPC EJB deployment. + * + * @param dep webservice deployment + * @return true if JAXRPC EJB deployment, false otherwise + */ + public static boolean isJaxrpcEjbDeployment( final Deployment dep ) + { + return DeploymentType.JAXRPC_EJB21.equals( dep.getType() ); + } + + /** + * Returns true if deployment represents JAXRPC JSE deployment. + * + * @param dep webservice deployment + * @return true if JAXRPC JSE deployment, false otherwise + */ + public static boolean isJaxrpcJseDeployment( final Deployment dep ) + { + return DeploymentType.JAXRPC_JSE.equals( dep.getType() ); + } + + /** + * Returns true if deployment represents JAXWS EJB deployment. + * + * @param dep webservice deployment + * @return true if JAXWS EJB deployment, false otherwise + */ + public static boolean isJaxwsEjbDeployment( final Deployment dep ) + { + return DeploymentType.JAXWS_EJB3.equals( dep.getType() ); + } + + /** + * Returns true if deployment represents JAXWS JSE deployment. + * + * @param dep webservice deployment + * @return true if JAXWS JSE deployment, false otherwise + */ + public static boolean isJaxwsJseDeployment( final Deployment dep ) + { + return DeploymentType.JAXWS_JSE.equals( dep.getType() ); + } + + /** + * Returns true if deployment represents either JAXWS JSE or JAXRPC JSE= deployment. + * + * @param dep webservice deployment + * @return true if either JAXWS JSE or JAXRPC JSE deployment, false oth= erwise. + */ + public static boolean isJseDeployment( final Deployment dep ) + { + final boolean isJaxwsJse =3D WSHelper.isJaxwsJseDeployment( dep ); + final boolean isJaxrpcJse =3D WSHelper.isJaxrpcJseDeployment( dep ); + + return isJaxwsJse || isJaxrpcJse; + } + + /** + * Returns true if deployment represents either JAXWS EJB or JAXRPC EJB= deployment. + * + * @param dep webservice deployment + * @return true if either JAXWS EJB or JAXRPC EJB deployment, false oth= erwise + */ + public static boolean isEjbDeployment( final Deployment dep ) + { + final boolean isJaxwsEjb =3D WSHelper.isJaxwsEjbDeployment( dep ); + final boolean isJaxrpcEjb =3D WSHelper.isJaxrpcEjbDeployment( dep ); + + return isJaxwsEjb || isJaxrpcEjb; + } + + /** + * Returns true if deployment represents either JAXWS EJB or JAXWS JSE = deployment. + * + * @param dep webservice deployment + * @return true if either JAXWS EJB or JAXWS JSE deployment, false othe= rwise + */ + public static boolean isJaxwsDeployment( final Deployment dep ) + { + final boolean isJaxwsEjb =3D WSHelper.isJaxwsEjbDeployment( dep ); + final boolean isJaxwsJse =3D WSHelper.isJaxwsJseDeployment( dep ); + + return isJaxwsEjb || isJaxwsJse; + } + + /** + * Returns true if deployment represents either JAXRPC EJB or JAXRPC JS= E deployment. + * + * @param dep webservice deployment + * @return true if either JAXRPC EJB or JAXRPC JSE deployment, false ot= herwise + */ + public static boolean isJaxrpcDeployment( final Deployment dep ) + { + final boolean isJaxrpcEjb =3D WSHelper.isJaxrpcEjbDeployment( dep ); + final boolean isJaxrpcJse =3D WSHelper.isJaxrpcJseDeployment( dep ); + + return isJaxrpcEjb || isJaxrpcJse; + } + +} --===============6980035317148520463==--