001: /*
002: * ChainBuilder ESB
003: * Visual Enterprise Integration
004: *
005: * Copyright (C) 2006 Bostech Corporation
006: *
007: * This program is free software; you can redistribute it and/or modify it
008: * under the terms of the GNU General Public License as published by the
009: * Free Software Foundation; either version 2 of the License, or (at your option)
010: * any later version.
011: *
012: * This program is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
014: * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
015: * for more details.
016: *
017: * You should have received a copy of the GNU General Public License along with
018: * this program; if not, write to the Free Software Foundation, Inc.,
019: * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
020: *
021: *
022: * $Id: FTPComponent.java 7086 2007-04-25 09:12:44Z lzheng $
023: */
024: package com.bostechcorp.cbesb.common.sa.component;
025:
026: import java.util.List;
027:
028: import javax.wsdl.WSDLException;
029:
030: import com.bostechcorp.cbesb.common.i18n.Message;
031: import com.bostechcorp.cbesb.common.i18n.Messages;
032: import com.bostechcorp.cbesb.common.sa.service.EndPoint;
033: import com.bostechcorp.cbesb.common.sa.service.PropertiesKey;
034: import com.bostechcorp.cbesb.common.util.generators.wsdl.generators.AbstractWsdlGenaretor;
035: import com.bostechcorp.cbesb.common.util.generators.wsdl.generators.FtpWsdlGenerator;
036:
037: public class FTPComponent extends CanScheduleComponent {
038:
039: //private final String ns="xmlns:ftp='http://cbesb.bostechcorp.com/wsdl/ftp/1.0'";
040:
041: public FTPComponent() {
042: super ();
043:
044: }
045:
046: public String getComponentName() {
047: return "ChainBuilderESB-BC-FTP";
048: }
049:
050: @Override
051: public void validateBase(List<String> list) {
052: super .validateBase(list);
053: for (int i = 0; i < getEndPointList().size(); i++) {
054: EndPoint endPoint = getEndPointList().get(i);
055: if (endPoint.getName() == null
056: || "".equals(endPoint.getName())) {
057: list.add(new Message(
058: Messages.FLOWEDITOR_MISSING_ENDPOINTNAME,
059: getName()).getMessage());
060: }
061: if (endPoint.isConumer()) {
062: if (endPoint.getSettings().getProperty(
063: PropertiesKey.FTP_WSDL_READ_FTPHOST) == null
064: || ""
065: .equals(endPoint
066: .getSettings()
067: .getProperty(
068: PropertiesKey.FTP_WSDL_READ_FTPHOST))) {
069: list.add(new Message(
070: Messages.FTPCOMPONENT_MISSING_FTPHOST,
071: getName()).getMessage());
072: }
073: if (endPoint.getSettings().getProperty(
074: PropertiesKey.FTP_WSDL_READ_TRANSFERDIR) == null
075: || ""
076: .equals(endPoint
077: .getSettings()
078: .getProperty(
079: PropertiesKey.FTP_WSDL_READ_TRANSFERDIR))) {
080: list.add(new Message(
081: Messages.FTPCOMPONENT_MISSING_TRANSFERDIR,
082: getName()).getMessage());
083: }
084: if (endPoint.getSettings().getProperty(
085: PropertiesKey.FTP_WSDL_READ_SOURCEDIR) == null
086: || ""
087: .equals(endPoint
088: .getSettings()
089: .getProperty(
090: PropertiesKey.FTP_WSDL_READ_SOURCEDIR))) {
091: list.add(new Message(
092: Messages.COMPONENT_MISSING_SOURCEDIR,
093: getName()).getMessage());
094: }
095: if (endPoint.getSettings().getProperty(
096: PropertiesKey.FTP_WSDL_READ_STAGEDIRECTORY) == null
097: || ""
098: .equals(endPoint
099: .getSettings()
100: .getProperty(
101: PropertiesKey.FTP_WSDL_READ_STAGEDIRECTORY))) {
102: list.add(new Message(
103: Messages.COMPONENT_MISSING_STAGEDIR,
104: getName()).getMessage());
105: }
106: if ("in-out".equals(endPoint.getSettings().getProperty(
107: PropertiesKey.FTP_WSDL_READ_DEFAULTMEP))) {
108: if (endPoint.getSettings().getProperty(
109: PropertiesKey.FTP_WSDL_READ_REPLY_DIR) == null
110: || ""
111: .equals(endPoint
112: .getSettings()
113: .getProperty(
114: PropertiesKey.FTP_WSDL_READ_REPLY_DIR))) {
115: list.add(new Message(
116: Messages.COMPONENT_MISSING_REPLYDIR,
117: getName()).getMessage());
118: }
119: if (endPoint
120: .getSettings()
121: .getProperty(
122: PropertiesKey.FTP_WSDL_READ_REPLY_FILEPATTERN) == null
123: || ""
124: .equals(endPoint
125: .getSettings()
126: .getProperty(
127: PropertiesKey.FTP_WSDL_READ_REPLY_FILEPATTERN))) {
128: list
129: .add(new Message(
130: Messages.COMPONENT_MISSING_REPLYFILEPATTERN,
131: getName()).getMessage());
132: }
133: }
134: }
135:
136: }
137: }
138:
139: @Override
140: protected AbstractWsdlGenaretor getWsdlGenerator(String path,
141: String saName, EndPoint ep) throws WSDLException {
142: boolean useSchedule = false;
143: if (standardSchedules.size() > 0
144: || autoRetrySchedules.size() > 0) {
145: useSchedule = true;
146: }
147: return new FtpWsdlGenerator(path, saName, getName(), this
148: .getComponentType(), ep, useSchedule);
149: }
150:
151: }
|