Update of /cvsroot/xdoclet/xdoclet/modules/web/src/xdoclet/modules/web
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20856

Modified Files:
        ServiceEndpointSubTask.java 
Log Message:
Fix dodgy EOLs



Index: ServiceEndpointSubTask.java
===================================================================
RCS file: 
/cvsroot/xdoclet/xdoclet/modules/web/src/xdoclet/modules/web/ServiceEndpointSubTask.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** ServiceEndpointSubTask.java 6 Aug 2004 12:59:06 -0000       1.1
--- ServiceEndpointSubTask.java 21 Aug 2004 12:51:01 -0000      1.2
***************
*** 1 ****
! /*
 * Copyright (c) 2001, 2002 The XDoclet team
 * All rights reserved.
 */
package xdoclet.modules.web;

import org.apache.commons.logging.Log;

import xjavadoc.XClass;
import xjavadoc.XTag;

import xdoclet.TemplateSubTask;
import xdoclet.XDocletException;
import xdoclet.XDocletMessages;

import xdoclet.tagshandler.PackageTagsHandler;

import xdoclet.util.LogUtil;
import xdoclet.util.Translator;

/**
 * Generates service endpoint interfaces for JAXPRC beans.
 *
 * @author               Christoph G. Jung ([EMAIL PROTECTED])
 * @created              22.12.03
 * @ant.element          display-name="Service-Endpoint Interface" 
name="service-endpoint"
 *      parent="xdoclet.modules.web.WebDocletTask"
 * @version              $Revision$
 * @xdoclet.merge-file   file="service-endpoint-custom.xdt" relates-to="{0}.java" 
description="A text file containing
 *      custom template and/or java code to include in the service-endpoint interface."
 */
public class ServiceEndpointSubTask extends TemplateSubTask
{
    public static String DEFAULT_SERVICE_ENDPOINT_CLASS_PATTERN = "{0}";
    public static String SERVICE_ENDPOINT = "service-endpoint";
    public static String WEB_SERVLET = "web.servlet";

    protected static String DEFAULT_TEMPLATE_FILE = "resources/service-endpoint.xdt";

    /**
     * A configuration parameter for specifying the service-endpoint interface name 
pattern. By default the value is
     * used for deciding the service-endpoint interface name. {0} in the value mean 
current class's symbolic name which
     * for an EJBean is the EJB name.
     *
     * @see   #getServiceEndpointClassPattern()
     */
    protected String serviceEndpointClassPattern;

    /**
     * Describe what the ServiceEndpointSubTask constructor does
     */
    public ServiceEndpointSubTask()
    {
        setTemplateURL(getClass().getResource(DEFAULT_TEMPLATE_FILE));
        setDestinationFile(getServiceEndpointClassPattern() + ".java");
    }

    /**
     * Returns the configuration parameter for specifying the service-endpoint 
interface name pattern. By default the
     * value is used for deciding the service-endpoint interface name. {0} in the 
value mean current class's symbolic
     * name which for an EJBean is the EJB name. If nothing explicitly specified by 
user then "{0}" is used by default.
     *
     * @return   The ServiceEndpointClassPattern value
     * @see      #remoteClassPattern
     */
    public String getServiceEndpointClassPattern()
    {
        if (serviceEndpointClassPattern != null) {
            return serviceEndpointClassPattern;
        }
        else {
            return DEFAULT_SERVICE_ENDPOINT_CLASS_PATTERN;
        }
    }

    /**
     * The pattern by which the interfaces are named. {0} designates the EJB name.
     *
     * @param newPattern   The new Pattern value
     * @ant.not-required   No, defaults to {0}
     */
    public void setPattern(String newPattern)
    {
        serviceEndpointClassPattern = newPattern;
    }

    /**
     * Called to validate configuration parameters.
     *
     * @exception XDocletException
     */
    public void validateOptions() throws XDocletException
    {
        super.validateOptions();

        if (getServiceEndpointClassPattern() == null || 
getServiceEndpointClassPattern().trim().equals("")) {
            throw new XDocletException(Translator.getString(XDocletMessages.class, 
XDocletMessages.PARAMETER_MISSING_OR_EMPTY, new String[]{"pattern"}));
        }

        if (getServiceEndpointClassPattern().indexOf("{0}") == -1) {
            throw new 
XDocletException(Translator.getString(XDocletModulesWebMessages.class, 
XDocletModulesWebMessages.PATTERN_HAS_NO_PLACEHOLDER));
        }
    }


    /**
     * Gets the GeneratedFileName attribute of the ServiceEndpointInterfaceSubTask 
object
     *
     * @param clazz                 Describe what the parameter does
     * @return                      The GeneratedFileName value
     * @exception XDocletException
     */
    protected String getGeneratedFileName(XClass clazz) throws XDocletException
    {
        return 
PackageTagsHandler.packageNameAsPathFor(WebTagsHandler.serviceEndpoint(clazz)) + 
".java";
    }


    /**
     * Describe what the method does
     *
     * @param clazz                 Describe what the parameter does
     * @return                      Describe the return value
     * @exception XDocletException
     */
    protected boolean matchesGenerationRules(XClass clazz) throws XDocletException
    {
        if (super.matchesGenerationRules(clazz) == false) {
            return false;
        }

        XTag interfaceTag = clazz.getDoc().getTag(WEB_SERVLET);

        Log log = LogUtil.getLog(ServiceEndpointSubTask.class, 
"matchesGenerationRules");

        if (interfaceTag == null) {
            log.debug("Reject file " + clazz.getQualifiedName() + " because of not 
being a servlet");
            return false;
        }

        return true;
    }

    /**
     * Describe what the method does
     *
     * @exception XDocletException
     */
    protected void engineStarted() throws XDocletException
    {
        System.out.println(Translator.getString(XDocletModulesWebMessages.class, 
XDocletModulesWebMessages.GENERATING_SERVICE_ENDPOINT_FOR,
            new String[]{getCurrentClass().getQualifiedName()}));
    }
}

\ No newline at end of file
--- 1,154 ----
! /*
!  * Copyright (c) 2001, 2002 The XDoclet team
!  * All rights reserved.
!  */
! package xdoclet.modules.web;
! 
! import org.apache.commons.logging.Log;
! 
! import xjavadoc.XClass;
! import xjavadoc.XTag;
! 
! import xdoclet.TemplateSubTask;
! import xdoclet.XDocletException;
! import xdoclet.XDocletMessages;
! 
! import xdoclet.tagshandler.PackageTagsHandler;
! 
! import xdoclet.util.LogUtil;
! import xdoclet.util.Translator;
! 
! /**
!  * Generates service endpoint interfaces for JAXPRC beans.
!  *
!  * @author               Christoph G. Jung ([EMAIL PROTECTED])
!  * @created              22.12.03
!  * @ant.element          display-name="Service-Endpoint Interface" 
name="service-endpoint"
!  *      parent="xdoclet.modules.web.WebDocletTask"
!  * @version              $Revision$
!  * @xdoclet.merge-file   file="service-endpoint-custom.xdt" relates-to="{0}.java" 
description="A text file containing
!  *      custom template and/or java code to include in the service-endpoint 
interface."
!  */
! public class ServiceEndpointSubTask extends TemplateSubTask
! {
!     public static String DEFAULT_SERVICE_ENDPOINT_CLASS_PATTERN = "{0}";
!     public static String SERVICE_ENDPOINT = "service-endpoint";
!     public static String WEB_SERVLET = "web.servlet";
! 
!     protected static String DEFAULT_TEMPLATE_FILE = "resources/service-endpoint.xdt";
! 
!     /**
!      * A configuration parameter for specifying the service-endpoint interface name 
pattern. By default the value is
!      * used for deciding the service-endpoint interface name. {0} in the value mean 
current class's symbolic name which
!      * for an EJBean is the EJB name.
!      *
!      * @see   #getServiceEndpointClassPattern()
!      */
!     protected String serviceEndpointClassPattern;
! 
!     /**
!      * Describe what the ServiceEndpointSubTask constructor does
!      */
!     public ServiceEndpointSubTask()
!     {
!         setTemplateURL(getClass().getResource(DEFAULT_TEMPLATE_FILE));
!         setDestinationFile(getServiceEndpointClassPattern() + ".java");
!     }
! 
!     /**
!      * Returns the configuration parameter for specifying the service-endpoint 
interface name pattern. By default the
!      * value is used for deciding the service-endpoint interface name. {0} in the 
value mean current class's symbolic
!      * name which for an EJBean is the EJB name. If nothing explicitly specified by 
user then "{0}" is used by default.
!      *
!      * @return   The ServiceEndpointClassPattern value
!      * @see      #remoteClassPattern
!      */
!     public String getServiceEndpointClassPattern()
!     {
!         if (serviceEndpointClassPattern != null) {
!             return serviceEndpointClassPattern;
!         }
!         else {
!             return DEFAULT_SERVICE_ENDPOINT_CLASS_PATTERN;
!         }
!     }
! 
!     /**
!      * The pattern by which the interfaces are named. {0} designates the EJB name.
!      *
!      * @param newPattern   The new Pattern value
!      * @ant.not-required   No, defaults to {0}
!      */
!     public void setPattern(String newPattern)
!     {
!         serviceEndpointClassPattern = newPattern;
!     }
! 
!     /**
!      * Called to validate configuration parameters.
!      *
!      * @exception XDocletException
!      */
!     public void validateOptions() throws XDocletException
!     {
!         super.validateOptions();
! 
!         if (getServiceEndpointClassPattern() == null || 
getServiceEndpointClassPattern().trim().equals("")) {
!             throw new XDocletException(Translator.getString(XDocletMessages.class, 
XDocletMessages.PARAMETER_MISSING_OR_EMPTY, new String[]{"pattern"}));
!         }
! 
!         if (getServiceEndpointClassPattern().indexOf("{0}") == -1) {
!             throw new 
XDocletException(Translator.getString(XDocletModulesWebMessages.class, 
XDocletModulesWebMessages.PATTERN_HAS_NO_PLACEHOLDER));
!         }
!     }
! 
! 
!     /**
!      * Gets the GeneratedFileName attribute of the ServiceEndpointInterfaceSubTask 
object
!      *
!      * @param clazz                 Describe what the parameter does
!      * @return                      The GeneratedFileName value
!      * @exception XDocletException
!      */
!     protected String getGeneratedFileName(XClass clazz) throws XDocletException
!     {
!         return 
PackageTagsHandler.packageNameAsPathFor(WebTagsHandler.serviceEndpoint(clazz)) + 
".java";
!     }
! 
! 
!     /**
!      * Describe what the method does
!      *
!      * @param clazz                 Describe what the parameter does
!      * @return                      Describe the return value
!      * @exception XDocletException
!      */
!     protected boolean matchesGenerationRules(XClass clazz) throws XDocletException
!     {
!         if (super.matchesGenerationRules(clazz) == false) {
!             return false;
!         }
! 
!         XTag interfaceTag = clazz.getDoc().getTag(WEB_SERVLET);
! 
!         Log log = LogUtil.getLog(ServiceEndpointSubTask.class, 
"matchesGenerationRules");
! 
!         if (interfaceTag == null) {
!             log.debug("Reject file " + clazz.getQualifiedName() + " because of not 
being a servlet");
!             return false;
!         }
! 
!         return true;
!     }
! 
!     /**
!      * Describe what the method does
!      *
!      * @exception XDocletException
!      */
!     protected void engineStarted() throws XDocletException
!     {
!         System.out.println(Translator.getString(XDocletModulesWebMessages.class, 
XDocletModulesWebMessages.GENERATING_SERVICE_ENDPOINT_FOR,
!             new String[]{getCurrentClass().getQualifiedName()}));
!     }
! }



-------------------------------------------------------
SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media
100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33
Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.
http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285
_______________________________________________
xdoclet-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-devel

Reply via email to