Author: ropalka
Date: 2011-12-16 09:26:13 -0500 (Fri, 16 Dec 2011)
New Revision: 15406
Added:
common/trunk/src/main/java/org/jboss/ws/common/injection/ReferenceResolver.java
Removed:
common/trunk/src/main/java/org/jboss/ws/common/injection/finders/EJBFieldFinder.java
common/trunk/src/main/java/org/jboss/ws/common/injection/finders/EJBMethodFinder.java
common/trunk/src/main/java/org/jboss/ws/common/injection/finders/InjectionFieldFinder.java
common/trunk/src/main/java/org/jboss/ws/common/injection/finders/InjectionMethodFinder.java
Modified:
common/trunk/src/main/java/org/jboss/ws/common/deployment/ArchiveDeploymentImpl.java
common/trunk/src/main/java/org/jboss/ws/common/deployment/DefaultHttpEndpoint.java
common/trunk/src/main/java/org/jboss/ws/common/deployment/DefaultJMSEndpoint.java
common/trunk/src/main/java/org/jboss/ws/common/injection/InjectionHelper.java
common/trunk/src/main/java/org/jboss/ws/common/injection/resolvers/AbstractReferenceResolver.java
common/trunk/src/main/java/org/jboss/ws/common/invocation/InvocationHandlerJAXWS.java
common/trunk/src/main/java/org/jboss/ws/common/management/DefaultEndpointRegistryFactory.java
common/trunk/src/main/java/org/jboss/ws/common/management/Message.properties
Log:
[JBWS-3393] removing all deprecated stuff
Modified:
common/trunk/src/main/java/org/jboss/ws/common/deployment/ArchiveDeploymentImpl.java
===================================================================
---
common/trunk/src/main/java/org/jboss/ws/common/deployment/ArchiveDeploymentImpl.java 2011-12-16
14:22:47 UTC (rev 15405)
+++
common/trunk/src/main/java/org/jboss/ws/common/deployment/ArchiveDeploymentImpl.java 2011-12-16
14:26:13 UTC (rev 15406)
@@ -21,8 +21,6 @@
*/
package org.jboss.ws.common.deployment;
-import java.io.IOException;
-import java.net.URL;
import java.util.List;
import org.jboss.wsf.spi.deployment.ArchiveDeployment;
@@ -77,12 +75,6 @@
return name;
}
- @Deprecated
- public URL getMetaDataFileURL(String resourcePath) throws IOException
- {
- return getResourceResolver().resolve(resourcePath);
- }
-
public List<UnifiedVirtualFile> getMetadataFiles()
{
return metadataFiles;
Modified:
common/trunk/src/main/java/org/jboss/ws/common/deployment/DefaultHttpEndpoint.java
===================================================================
---
common/trunk/src/main/java/org/jboss/ws/common/deployment/DefaultHttpEndpoint.java 2011-12-16
14:22:47 UTC (rev 15405)
+++
common/trunk/src/main/java/org/jboss/ws/common/deployment/DefaultHttpEndpoint.java 2011-12-16
14:26:13 UTC (rev 15406)
@@ -21,9 +21,6 @@
*/
package org.jboss.ws.common.deployment;
-import javax.naming.Context;
-import javax.naming.NamingException;
-
import org.jboss.wsf.spi.deployment.HttpEndpoint;
import org.jboss.wsf.spi.management.EndpointMetrics;
@@ -64,20 +61,4 @@
this.urlPattern = urlPattern;
}
- public Context getJNDIContext()
- {
- Context retVal = null;
-
- try
- {
- retVal = getInvocationHandler().getJNDIContext(this);
- }
- catch (NamingException e)
- {
- // JNDI not available neither in JSE environment nor in SAR archives
- }
-
- return retVal;
- }
-
}
Modified:
common/trunk/src/main/java/org/jboss/ws/common/deployment/DefaultJMSEndpoint.java
===================================================================
---
common/trunk/src/main/java/org/jboss/ws/common/deployment/DefaultJMSEndpoint.java 2011-12-16
14:22:47 UTC (rev 15405)
+++
common/trunk/src/main/java/org/jboss/ws/common/deployment/DefaultJMSEndpoint.java 2011-12-16
14:26:13 UTC (rev 15406)
@@ -96,11 +96,6 @@
{
return null;
}
- @Override
- public Context getJNDIContext()
- {
- return null;
- }
@Override
public void setEndpointMetrics(EndpointMetrics metrics)
Modified: common/trunk/src/main/java/org/jboss/ws/common/injection/InjectionHelper.java
===================================================================
---
common/trunk/src/main/java/org/jboss/ws/common/injection/InjectionHelper.java 2011-12-16
14:22:47 UTC (rev 15405)
+++
common/trunk/src/main/java/org/jboss/ws/common/injection/InjectionHelper.java 2011-12-16
14:26:13 UTC (rev 15406)
@@ -26,26 +26,15 @@
import java.util.Collection;
import java.util.ResourceBundle;
-import javax.annotation.Resource;
-import javax.ejb.EJB;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
import javax.xml.ws.WebServiceContext;
import org.jboss.logging.Logger;
import org.jboss.ws.api.util.BundleUtils;
-import org.jboss.ws.common.injection.finders.EJBFieldFinder;
-import org.jboss.ws.common.injection.finders.EJBMethodFinder;
-import org.jboss.ws.common.injection.finders.InjectionFieldFinder;
-import org.jboss.ws.common.injection.finders.InjectionMethodFinder;
import org.jboss.ws.common.injection.finders.PostConstructMethodFinder;
import org.jboss.ws.common.injection.finders.PreDestroyMethodFinder;
import org.jboss.ws.common.injection.finders.ResourceFieldFinder;
import org.jboss.ws.common.injection.finders.ResourceMethodFinder;
import org.jboss.ws.common.reflection.ClassProcessor;
-import org.jboss.wsf.spi.metadata.injection.InjectionMetaData;
-import org.jboss.wsf.spi.metadata.injection.InjectionsMetaData;
/**
* An injection helper class for <b>javax.*</b> annotations.
@@ -60,10 +49,6 @@
private static final ClassProcessor<Method> POST_CONSTRUCT_METHOD_FINDER = new
PostConstructMethodFinder();
private static final ClassProcessor<Method> PRE_DESTROY_METHOD_FINDER = new
PreDestroyMethodFinder();
- private static final ClassProcessor<Method> RESOURCE_METHOD_FINDER = new
ResourceMethodFinder(WebServiceContext.class, false);
- private static final ClassProcessor<Field> RESOURCE_FIELD_FINDER = new
ResourceFieldFinder(WebServiceContext.class, false);
- private static final ClassProcessor<Method> EJB_METHOD_FINDER = new
EJBMethodFinder();
- private static final ClassProcessor<Field> EJB_FIELD_FINDER = new
EJBFieldFinder();
private static final ClassProcessor<Method> WEB_SERVICE_CONTEXT_METHOD_FINDER =
new ResourceMethodFinder(WebServiceContext.class, true);
private static final ClassProcessor<Field> WEB_SERVICE_CONTEXT_FIELD_FINDER =
new ResourceFieldFinder(WebServiceContext.class, true);
@@ -76,47 +61,6 @@
}
/**
- * The resource annotations mark resources that are needed by the application. These
annotations may be applied
- * to an application component class, or to fields or methods of the component class.
When the annotation is
- * applied to a field or method, the container will inject an instance of the
requested resource into the
- * application component when the component is initialized. If the annotation is
applied to the component class,
- * the annotation declares a resource that the application will look up at runtime.
- *
- * This method handles the following injection types:
- * <ul>
- * <li>Descriptor specified injections</li>
- * <li>@Resource annotated methods and fields</li>
- * <li>@EJB annotated methods and fields</li>
- * </ul>
- *
- * @param instance to inject resources on
- * @param injections injection metadata
- * @see org.jboss.wsf.spi.metadata.injection.InjectionsMetaData
- * @see javax.annotation.Resource
- * @see javax.ejb.EJB
- */
- public static void injectResources(final Object instance, final InjectionsMetaData
injections, final Context ctx)
- {
- if (instance == null)
- throw new IllegalArgumentException(BundleUtils.getMessage(bundle,
"OBJECT_INSTANCE_CANNOT_BE_NULL"));
-
- if (injections == null)
- return;
-
- if (ctx == null)
- return;
-
- // inject descriptor driven annotations
- injectDescriptorAnnotatedAccessibleObjects(instance, injections, ctx);
-
- // inject @Resource annotated methods and fields
- injectResourceAnnotatedAccessibleObjects(instance, injections, ctx);
-
- // inject @EJB annotated methods and fields
- injectEJBAnnotatedAccessibleObjects(instance, injections);
- }
-
- /**
* Injects @Resource annotated accessible objects referencing WebServiceContext.
*
* @param instance to operate on
@@ -220,205 +164,6 @@
}
/**
- * Performs descriptor driven injections.
- *
- * @param instance to operate on
- * @param injections injections metadata
- * @param ctx JNDI context
- */
- private static void injectDescriptorAnnotatedAccessibleObjects(final Object instance,
final InjectionsMetaData injections, final Context ctx)
- {
- final Collection<InjectionMetaData> injectionMDs =
injections.getInjectionsMetaData(instance.getClass());
-
- for (InjectionMetaData injectionMD : injectionMDs)
- {
-
- final Method method = getMethod(injectionMD, instance.getClass());
- if (method != null)
- {
- try
- {
- inject(instance, method, injectionMD.getEnvEntryName(), ctx);
- }
- catch (Exception e)
- {
- final String message = "Cannot inject method (descriptor driven
injection): " + injectionMD;
- InjectionException.rethrow(message, e);
- }
- }
- else
- {
- final Field field = getField(injectionMD, instance.getClass());
- if (field != null)
- {
- try
- {
- inject(instance, field, injectionMD.getEnvEntryName(), ctx);
- }
- catch (Exception e)
- {
- final String message = "Cannot inject field (descriptor driven
injection): " + injectionMD;
- InjectionException.rethrow(message, e);
- }
- }
- else
- {
- final String message = "Cannot find injection target for: " +
injectionMD;
- throw new InjectionException(message);
- }
- }
- }
- }
-
- /**
- * Injects @Resource annotated accessible objects.
- *
- * @param instance to operate on
- * @param injections injections meta data
- * @param ctx JNDI context
- * @see org.jboss.ws.common.injection.finders.ResourceFieldFinder
- * @see org.jboss.ws.common.injection.finders.ResourceMethodFinder
- * @see javax.annotation.Resource
- */
- private static void injectResourceAnnotatedAccessibleObjects(final Object instance,
final InjectionsMetaData injections, final Context ctx)
- {
- final Collection<Field> resourceAnnotatedFields =
RESOURCE_FIELD_FINDER.process(instance.getClass());
- final Collection<Method> resourceAnnotatedMethods =
RESOURCE_METHOD_FINDER.process(instance.getClass());
-
- // Inject @Resource annotated fields
- for (Field field : resourceAnnotatedFields)
- {
- try
- {
- final String jndiName =
injections.getResolver(Resource.class).resolve(field);
- inject(instance, field, jndiName, ctx);
- }
- catch (Exception e)
- {
- final String message = "Cannot inject field annotated with @Resource
annotation: " + field;
- InjectionException.rethrow(message, e);
- }
- }
-
- // Inject @Resource annotated methods
- for(Method method : resourceAnnotatedMethods)
- {
- try
- {
- final String jndiName =
injections.getResolver(Resource.class).resolve(method);
- inject(instance, method, jndiName, ctx);
- }
- catch (Exception e)
- {
- final String message = "Cannot inject method annotated with @Resource
annotation: " + method;
- InjectionException.rethrow(message, e);
- }
- }
- }
-
- /**
- * Injects @EJB annotated accessible objects.
- *
- * @param instance to operate on
- * @param injections injections meta data
- * @param ctx JNDI context
- * @see org.jboss.ws.common.injection.finders.EJBFieldFinder
- * @see org.jboss.ws.common.injection.finders.EJBMethodFinder
- * @see javax.ejb.EJB
- */
- private static void injectEJBAnnotatedAccessibleObjects(final Object instance, final
InjectionsMetaData injections)
- {
- final Collection<Field> ejbAnnotatedFields =
EJB_FIELD_FINDER.process(instance.getClass());
- final Collection<Method> ejbAnnotatedMethods =
EJB_METHOD_FINDER.process(instance.getClass());
- final Context ctx = InjectionHelper.getDefaultContext();
-
- // Inject @EJB annotated fields
- for (Field field : ejbAnnotatedFields)
- {
- try
- {
- final String jndiName = injections.getResolver(EJB.class).resolve(field);
- inject(instance, field, jndiName, ctx);
- }
- catch (Exception e)
- {
- final String message = "Cannot inject field annotated with @EJB
annotation: " + field;
- InjectionException.rethrow(message, e);
- }
- }
-
- // Inject @EJB annotated methods
- for(Method method : ejbAnnotatedMethods)
- {
- try
- {
- final String jndiName = injections.getResolver(EJB.class).resolve(method);
- inject(instance, method, jndiName, ctx);
- }
- catch (Exception e)
- {
- final String message = "Cannot inject method annotated with @EJB
annotation: " + method;
- InjectionException.rethrow(message, e);
- }
- }
- }
-
- /**
- * Injects method.
- *
- * @param instance to invoke method on
- * @param method to invoke
- * @param resourceName resource name
- * @param cxt JNDI context
- */
- private static void inject(final Object instance, final Method method, final String
jndiName, final Context ctx)
- {
- final Object value = lookup(jndiName, ctx);
- if (LOG.isTraceEnabled())
- LOG.trace("Injecting method: " + method);
- invokeMethod(instance, method, new Object[] {value});
- }
-
- /**
- * Injects field.
- *
- * @param field to set
- * @param instance to modify field on
- * @param resourceName resource name
- * @param cxt JNDI context
- */
- private static void inject(final Object instance, final Field field, final String
jndiName, final Context ctx)
- {
- final Object value = lookup(jndiName, ctx);
- if (LOG.isTraceEnabled())
- LOG.trace("Injecting field: " + field);
- setField(instance, field, value);
- }
-
- /**
- * Lookups object in JNDI namespace.
- *
- * @param jndiName jndi name
- * @param ctx context to use
- * @return Object if found
- */
- private static Object lookup(final String jndiName, final Context ctx)
- {
- Object value = null;
- try
- {
- value = ctx.lookup(jndiName);
- }
- catch (NamingException ne)
- {
- final String message = "Resource '" + jndiName + "' not
found";
- InjectionException.rethrow(message, ne);
- }
-
- return value;
- }
-
- /**
* Invokes method on object with specified arguments.
*
* @param instance to invoke method on
@@ -470,56 +215,4 @@
}
}
- /**
- * Returns method that matches the descriptor injection metadata or null if not
found.
- *
- * @param injectionMD descriptor injection metadata
- * @param clazz to process
- * @return method that matches the criteria or null if not found
- * @see org.jboss.ws.common.injection.finders.InjectionMethodFinder
- */
- private static Method getMethod(final InjectionMetaData injectionMD, final
Class<?> clazz)
- {
- final Collection<Method> result = new
InjectionMethodFinder(injectionMD).process(clazz);
-
- return result.isEmpty() ? null : result.iterator().next();
- }
-
- /**
- * Returns field that matches the descriptor injection metadata or null if not found.
- *
- * @param injectionMD descriptor injection metadata
- * @param clazz to process
- * @return field that matches the criteria or null if not found
- * @see org.jboss.ws.common.injection.finders.InjectionFieldFinder
- */
- private static Field getField(final InjectionMetaData injectionMD, final
Class<?> clazz)
- {
- final Collection<Field> result = new
InjectionFieldFinder(injectionMD).process(clazz);
-
- return result.isEmpty() ? null : result.iterator().next();
- }
-
- /**
- * Returns default JNDI context.
- *
- * @return default JNDI context
- */
- private static Context getDefaultContext()
- {
- Context ctx = null;
-
- try
- {
- ctx = new InitialContext();
- }
- catch (NamingException ne)
- {
- final String message = "Cannot create default JNDI context";
- InjectionException.rethrow(message, ne);
- }
-
- return ctx;
- }
-
}
Added: common/trunk/src/main/java/org/jboss/ws/common/injection/ReferenceResolver.java
===================================================================
--- common/trunk/src/main/java/org/jboss/ws/common/injection/ReferenceResolver.java
(rev 0)
+++
common/trunk/src/main/java/org/jboss/ws/common/injection/ReferenceResolver.java 2011-12-16
14:26:13 UTC (rev 15406)
@@ -0,0 +1,50 @@
+/*
+ * 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.ws.common.injection;
+
+import java.lang.reflect.AccessibleObject;
+
+/**
+ * JNDI reference resolver.
+ *
+ * @author <a href="mailto:richard.opalka@jboss.org">Richard
Opalka</a>
+ */
+public interface ReferenceResolver
+{
+
+ /**
+ * Resolves JNDI name.
+ *
+ * @param accessibleObject object
+ * @return JNDI name.
+ */
+ String resolve(AccessibleObject accessibleObject);
+
+ /**
+ * Returns <b>true</b> if can resolve, <b>false</b>
otherwise.
+ *
+ * @param accessibleObject object
+ * @return true if can resolve, false otherwise
+ */
+ boolean canResolve(AccessibleObject accessibleObject);
+
+}
Deleted:
common/trunk/src/main/java/org/jboss/ws/common/injection/finders/EJBFieldFinder.java
===================================================================
---
common/trunk/src/main/java/org/jboss/ws/common/injection/finders/EJBFieldFinder.java 2011-12-16
14:22:47 UTC (rev 15405)
+++
common/trunk/src/main/java/org/jboss/ws/common/injection/finders/EJBFieldFinder.java 2011-12-16
14:26:13 UTC (rev 15406)
@@ -1,60 +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.ws.common.injection.finders;
-
-import java.lang.reflect.Field;
-
-import javax.ejb.EJB;
-
-import org.jboss.ws.common.reflection.AnnotatedFieldFinder;
-
-/**
- * Field based EJB injection.
- *
- * @author <a href="mailto:richard.opalka@jboss.org">Richard
Opalka</a>
- */
-public final class EJBFieldFinder
-extends AnnotatedFieldFinder<EJB>
-{
-
- /**
- * Constructor.
- */
- public EJBFieldFinder()
- {
- super(EJB.class);
- }
-
- @Override
- public void validate(Field field)
- {
- super.validate(field);
-
- // Ensure all method preconditions
- Class<EJB> annotation = getAnnotation();
- ReflectionUtils.assertNotVoidType(field, annotation);
- ReflectionUtils.assertNotStatic(field, annotation);
- ReflectionUtils.assertNotFinal(field, annotation);
- ReflectionUtils.assertNotPrimitiveType(field, annotation);
- }
-
-}
Deleted:
common/trunk/src/main/java/org/jboss/ws/common/injection/finders/EJBMethodFinder.java
===================================================================
---
common/trunk/src/main/java/org/jboss/ws/common/injection/finders/EJBMethodFinder.java 2011-12-16
14:22:47 UTC (rev 15405)
+++
common/trunk/src/main/java/org/jboss/ws/common/injection/finders/EJBMethodFinder.java 2011-12-16
14:26:13 UTC (rev 15406)
@@ -1,62 +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.ws.common.injection.finders;
-
-import java.lang.reflect.Method;
-
-import javax.ejb.EJB;
-
-import org.jboss.ws.common.reflection.AnnotatedMethodFinder;
-
-/**
- * Setter based EJB injection.
- *
- * @author <a href="mailto:richard.opalka@jboss.org">Richard
Opalka</a>
- */
-public final class EJBMethodFinder
-extends AnnotatedMethodFinder<EJB>
-{
-
- /**
- * Constructor.
- */
- public EJBMethodFinder()
- {
- super(EJB.class);
- }
-
- @Override
- public void validate(Method method)
- {
- super.validate(method);
-
- // Ensure all method preconditions
- Class<EJB> annotation = getAnnotation();
- ReflectionUtils.assertVoidReturnType(method, annotation);
- ReflectionUtils.assertOneParameter(method, annotation);
- ReflectionUtils.assertNoPrimitiveParameters(method, annotation);
- ReflectionUtils.assertValidSetterName(method, annotation);
- ReflectionUtils.assertNoCheckedExceptionsAreThrown(method, annotation);
- ReflectionUtils.assertNotStatic(method, annotation);
- }
-
-}
Deleted:
common/trunk/src/main/java/org/jboss/ws/common/injection/finders/InjectionFieldFinder.java
===================================================================
---
common/trunk/src/main/java/org/jboss/ws/common/injection/finders/InjectionFieldFinder.java 2011-12-16
14:22:47 UTC (rev 15405)
+++
common/trunk/src/main/java/org/jboss/ws/common/injection/finders/InjectionFieldFinder.java 2011-12-16
14:26:13 UTC (rev 15406)
@@ -1,104 +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.ws.common.injection.finders;
-
-import java.lang.reflect.Field;
-import java.util.Collection;
-import java.util.ResourceBundle;
-
-import org.jboss.ws.api.util.BundleUtils;
-import org.jboss.ws.common.injection.InjectionException;
-import org.jboss.ws.common.reflection.FieldFinder;
-import org.jboss.wsf.spi.metadata.injection.InjectionMetaData;
-
-/**
- * Lookups field that matches descriptor specified injection metadata.
- *
- * @author <a href="mailto:richard.opalka@jboss.org">Richard
Opalka</a>
- */
-public final class InjectionFieldFinder
-extends FieldFinder
-{
- private static final ResourceBundle bundle =
BundleUtils.getBundle(InjectionFieldFinder.class);
-
- /**
- * Descriptor injection metadata.
- */
- private final InjectionMetaData injectionMD;
-
- /**
- * Constructor.
- *
- * @param injectionMD descriptor injection metadata
- */
- public InjectionFieldFinder(final InjectionMetaData injectionMD)
- {
- if (injectionMD == null)
- throw new IllegalArgumentException(BundleUtils.getMessage(bundle,
"INJECTION_METADATA_CANNOT_BE_NULL"));
-
- this.injectionMD = injectionMD;
- }
-
- @Override
- public boolean matches(final Field field)
- {
- if (field.getName().equals(injectionMD.getTargetName()))
- {
- if (injectionMD.getValueClass() != null)
- {
- final Class<?> expectedClass = injectionMD.getValueClass();
- final Class<?> fieldClass = field.getType();
-
- return expectedClass.equals(fieldClass);
- }
- else
- {
- return true;
- }
- }
-
- return false;
- }
-
- @Override
- public void validate(final Collection<Field> fields)
- {
- super.validate(fields);
-
- if (fields.size() > 2)
- {
- throw new InjectionException(BundleUtils.getMessage(bundle,
"MORE_THAN_ONE_FIELD_FOUND_MATCHING_THE_CRITERIA", injectionMD));
- }
- }
-
- @Override
- public void validate(final Field field)
- {
- super.validate(field);
-
- ReflectionUtils.assertNotVoidType(field);
- ReflectionUtils.assertNotStatic(field);
- ReflectionUtils.assertNotFinal(field);
- ReflectionUtils.assertNotPrimitiveType(field);
- }
-
-}
Deleted:
common/trunk/src/main/java/org/jboss/ws/common/injection/finders/InjectionMethodFinder.java
===================================================================
---
common/trunk/src/main/java/org/jboss/ws/common/injection/finders/InjectionMethodFinder.java 2011-12-16
14:22:47 UTC (rev 15405)
+++
common/trunk/src/main/java/org/jboss/ws/common/injection/finders/InjectionMethodFinder.java 2011-12-16
14:26:13 UTC (rev 15406)
@@ -1,114 +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.ws.common.injection.finders;
-
-import java.lang.reflect.Method;
-import java.util.Collection;
-import java.util.ResourceBundle;
-
-import org.jboss.ws.api.util.BundleUtils;
-import org.jboss.ws.common.injection.InjectionException;
-import org.jboss.ws.common.reflection.MethodFinder;
-import org.jboss.wsf.spi.metadata.injection.InjectionMetaData;
-
-/**
- * Lookups method that matches descriptor specified injection metadata.
- *
- * @author <a href="mailto:richard.opalka@jboss.org">Richard
Opalka</a>
- */
-public final class InjectionMethodFinder
-extends MethodFinder
-{
- private static final ResourceBundle bundle =
BundleUtils.getBundle(InjectionMethodFinder.class);
-
- /**
- * Descriptor injection metadata.
- */
- private final InjectionMetaData injectionMD;
-
- /**
- * Constructor.
- *
- * @param injectionMD descriptor injection metadata
- */
- public InjectionMethodFinder(final InjectionMetaData injectionMD)
- {
- if (injectionMD == null)
- throw new IllegalArgumentException(BundleUtils.getMessage(bundle,
"INJECTION_METADATA_CANNOT_BE_NULL"));
-
- this.injectionMD = injectionMD;
- }
-
- @Override
- public boolean matches(final Method method)
- {
- final String targetName = injectionMD.getTargetName();
- final String methodName = "set" + targetName.substring(0,
1).toUpperCase() + targetName.substring(1);
- if (method.getName().equals(methodName))
- {
- if (injectionMD.getValueClass() != null)
- {
- if (method.getParameterTypes().length == 1)
- {
- final Class<?> expectedClass = injectionMD.getValueClass();
- final Class<?> parameterClass = method.getParameterTypes()[0];
-
- return expectedClass.equals(parameterClass);
- }
- }
- else
- {
- if (method.getParameterTypes().length == 1)
- {
- return true;
- }
- }
- }
-
- return false;
- }
-
- @Override
- public void validate(final Collection<Method> methods)
- {
- super.validate(methods);
-
- if (methods.size() > 2)
- {
- throw new InjectionException(BundleUtils.getMessage(bundle,
"MORE_THAN_ONE_METHOD_FOUND_MATCHING_THE_CRITERIA", injectionMD));
- }
- }
-
- @Override
- public void validate(final Method method)
- {
- super.validate(method);
-
- ReflectionUtils.assertVoidReturnType(method);
- ReflectionUtils.assertOneParameter(method);
- ReflectionUtils.assertNoPrimitiveParameters(method);
- ReflectionUtils.assertValidSetterName(method);
- ReflectionUtils.assertNoCheckedExceptionsAreThrown(method);
- ReflectionUtils.assertNotStatic(method);
- }
-
-}
Modified:
common/trunk/src/main/java/org/jboss/ws/common/injection/resolvers/AbstractReferenceResolver.java
===================================================================
---
common/trunk/src/main/java/org/jboss/ws/common/injection/resolvers/AbstractReferenceResolver.java 2011-12-16
14:22:47 UTC (rev 15405)
+++
common/trunk/src/main/java/org/jboss/ws/common/injection/resolvers/AbstractReferenceResolver.java 2011-12-16
14:26:13 UTC (rev 15406)
@@ -28,7 +28,7 @@
import java.util.ResourceBundle;
import org.jboss.ws.api.util.BundleUtils;
-import org.jboss.wsf.spi.metadata.injection.ReferenceResolver;
+import org.jboss.ws.common.injection.ReferenceResolver;
/**
* This class adds support for notion of annotated fields and methods.
Modified:
common/trunk/src/main/java/org/jboss/ws/common/invocation/InvocationHandlerJAXWS.java
===================================================================
---
common/trunk/src/main/java/org/jboss/ws/common/invocation/InvocationHandlerJAXWS.java 2011-12-16
14:22:47 UTC (rev 15405)
+++
common/trunk/src/main/java/org/jboss/ws/common/invocation/InvocationHandlerJAXWS.java 2011-12-16
14:26:13 UTC (rev 15406)
@@ -30,7 +30,6 @@
import org.jboss.wsf.spi.deployment.Reference;
import org.jboss.wsf.spi.invocation.Invocation;
import org.jboss.wsf.spi.invocation.InvocationContext;
-import org.jboss.wsf.spi.metadata.injection.InjectionsMetaData;
/**
* Handles invocations on JAXWS endpoints.
@@ -42,14 +41,6 @@
{
/**
- * Constructor.
- */
- public InvocationHandlerJAXWS()
- {
- super();
- }
-
- /**
* Injects resources on target bean and calls post construct method.
* Finally it registers target bean for predestroy phase.
*
@@ -59,7 +50,6 @@
@Override
public void onEndpointInstantiated(final Endpoint endpoint, final Invocation
invocation)
{
- final InjectionsMetaData injectionsMD =
endpoint.getAttachment(InjectionsMetaData.class);
final Object _targetBean = this.getTargetBean(invocation);
// TODO: refactor injection to AS IL
final Reference reference =
endpoint.getInstanceProvider().getInstance(_targetBean.getClass().getName());
@@ -69,9 +59,6 @@
if (!reference.isInitialized())
{
- this.log.debug("Injecting resources on JAXWS JSE endpoint: " +
targetBean);
- InjectionHelper.injectResources(targetBean, injectionsMD,
endpoint.getJNDIContext());
-
this.log.debug("Calling postConstruct method on JAXWS JSE endpoint: "
+ targetBean);
InjectionHelper.callPostConstructMethod(targetBean);
reference.setInitialized();
Modified:
common/trunk/src/main/java/org/jboss/ws/common/management/DefaultEndpointRegistryFactory.java
===================================================================
---
common/trunk/src/main/java/org/jboss/ws/common/management/DefaultEndpointRegistryFactory.java 2011-12-16
14:22:47 UTC (rev 15405)
+++
common/trunk/src/main/java/org/jboss/ws/common/management/DefaultEndpointRegistryFactory.java 2011-12-16
14:26:13 UTC (rev 15406)
@@ -21,15 +21,6 @@
*/
package org.jboss.ws.common.management;
-import org.jboss.logging.Logger;
-import java.util.ResourceBundle;
-import org.jboss.ws.api.util.BundleUtils;
-import org.jboss.wsf.spi.SPIProvider;
-import org.jboss.wsf.spi.SPIProviderResolver;
-import org.jboss.wsf.spi.WSFException;
-import org.jboss.wsf.spi.classloading.ClassLoaderProvider;
-import org.jboss.wsf.spi.ioc.IoCContainerProxy;
-import org.jboss.wsf.spi.ioc.IoCContainerProxyFactory;
import org.jboss.wsf.spi.management.EndpointRegistry;
import org.jboss.wsf.spi.management.EndpointRegistryFactory;
@@ -41,59 +32,12 @@
*/
public final class DefaultEndpointRegistryFactory extends EndpointRegistryFactory
{
- private static final ResourceBundle bundle =
BundleUtils.getBundle(DefaultEndpointRegistryFactory.class);
- private Logger log = Logger.getLogger(DefaultEndpointRegistryFactory.class);
- /** The bean name in the kernel registry. */
- private static final String BEAN_NAME = "WSEndpointRegistry";
- private static final String SERVICE_NAME = "jboss.ws.registry";
- private static final EndpointRegistry fallbackRegistry = new
DefaultEndpointRegistry();;
+ private static final EndpointRegistry ENDPOINT_REGISTRY = new
DefaultEndpointRegistry();;
- /**
- * Constructor.
- */
- public DefaultEndpointRegistryFactory()
- {
- super();
- }
-
- /**
- * Returns endpoint registry registered in MC kernel.
- *
- * @return endpoint registry
- */
public EndpointRegistry getEndpointRegistry()
{
- try
- {
- final ClassLoader cl =
ClassLoaderProvider.getDefaultProvider().getServerIntegrationClassLoader();
- final SPIProvider spiProvider =
SPIProviderResolver.getInstance(cl).getProvider();
- final IoCContainerProxyFactory iocContainerFactory =
spiProvider.getSPI(IoCContainerProxyFactory.class, cl);
- final IoCContainerProxy iocContainer = iocContainerFactory.getContainer();
-
- EndpointRegistry registry = null;
- try
- {
- //try MSC service name
- registry = iocContainer.getBean(DefaultEndpointRegistryFactory.SERVICE_NAME,
EndpointRegistry.class);
- }
- catch (Exception e)
- {
- log.debug("Can't get endpoint registry: ", e);
- //ignore
- }
- if (registry == null)
- {
- //try MC bean name
- registry = iocContainer.getBean(DefaultEndpointRegistryFactory.BEAN_NAME,
EndpointRegistry.class);
- }
- return registry;
- }
- catch (Exception e)
- {
- log.warn(BundleUtils.getMessage(bundle,
"UNABLE_TO_GET_WSENDPOINTREGISTRY"));
- return fallbackRegistry; // JSE environment
- }
+ return ENDPOINT_REGISTRY;
}
}
Modified: common/trunk/src/main/java/org/jboss/ws/common/management/Message.properties
===================================================================
---
common/trunk/src/main/java/org/jboss/ws/common/management/Message.properties 2011-12-16
14:22:47 UTC (rev 15405)
+++
common/trunk/src/main/java/org/jboss/ws/common/management/Message.properties 2011-12-16
14:26:13 UTC (rev 15406)
@@ -1,6 +1,5 @@
CANNOT_REGISTER_ENDPOINT_WITH_JMX_SERVER=Cannot register endpoint with JMX server
CANNOT_UNREGISTER_RECORD_PROCESSOR_WITH_JMX_SERVER=Cannot unregister record processor
with JMX server
-UNABLE_TO_GET_WSENDPOINTREGISTRY=Unable to get WSEndpointRegistry from IoC, using default
one
COULD_NOT_GET_ADDRESS_FOR_HOST=Could not get address for host: {0}
FOUND_MULTIPLE_CONNECTORS=Found multiple connectors for protocol={0} and secure={1},
using first port found {2}
CANNOT_REGISTER_ENDPOINT_WITH_JMX_SERVER=Cannot register endpoint with JMX server