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: ParserWsdl1Deployer.java 1770 2006-10-12 16:34:49Z fling $
023: */
024: package com.bostechcorp.cbesb.runtime.component.script;
025:
026: import javax.wsdl.extensions.ExtensibilityElement;
027: import javax.wsdl.extensions.ExtensionRegistry;
028:
029: import org.apache.commons.logging.Log;
030: import org.apache.commons.logging.LogFactory;
031:
032: import com.bostechcorp.cbesb.runtime.ccsl.jbi.messaging.CbComponent;
033: import com.bostechcorp.cbesb.runtime.ccsl.jbi.messaging.CbEndpoint;
034: import com.bostechcorp.cbesb.runtime.ccsl.jbi.messaging.Wsdl1Deployer;
035: import com.bostechcorp.cbesb.runtime.component.script.wsdl.ScriptBinding;
036: import com.bostechcorp.cbesb.runtime.component.script.wsdl.ScriptConfig;
037: import com.bostechcorp.cbesb.runtime.component.script.wsdl.ScriptExtension;
038:
039: /**
040: * The WDSL deployer classes for Script Component.
041: *
042: * @author elu
043: *
044: */
045: public class ScriptWsdl1Deployer extends Wsdl1Deployer {
046:
047: protected final transient Log logger = LogFactory
048: .getLog(getClass());
049:
050: public ScriptWsdl1Deployer(CbComponent component) {
051: super (component);
052: }
053:
054: protected CbEndpoint createEndpoint(
055: ExtensibilityElement[] portElement,
056: ExtensibilityElement[] bindingElement) {
057:
058: logger.debug("createEndpoint portElement=" + portElement);
059:
060: ScriptEndpoint endpoint = new ScriptEndpoint();
061:
062: if (portElement[0] instanceof ScriptConfig) {
063: ScriptConfig config = (ScriptConfig) portElement[0];
064: logger.debug("ScriptConfig portElement=" + config);
065: endpoint.setRole(config.getRole());
066: endpoint.setDefaultMep(config.getDefaultMep());
067: endpoint.setDefaultOperation(config.getDefaultOperation());
068:
069: if (config.getTriggerTime() != null
070: && !config.getTriggerTime().equals("")) {
071: endpoint.setMode(ScriptEndpoint.MODE_POLL);
072: endpoint.setPollInterval(Integer.parseInt(config
073: .getTriggerTime()));
074: } else {
075: endpoint.setMode(ScriptEndpoint.MODE_SCHEDULE);
076: endpoint.setScheduleFile(config.getSchedule());
077: endpoint.setSchedulerService(config
078: .getSchedulerService());
079: endpoint.setSchedulerEndpoint(config
080: .getSchedulerEndpoint());
081: }
082:
083: endpoint.setTriggerTime(config.getTriggerTime());
084: endpoint.setType(config.getType());
085: endpoint.setScriptClass(config.getScriptClass());
086:
087: }
088: return endpoint;
089: }
090:
091: /*
092: * (non-Javadoc)
093: *
094: * @see org.apache.servicemix.common.wsdl.AbstractWsdlDeployer#filterPortElement(javax.wsdl.extensions.ExtensibilityElement)
095: */
096: protected boolean filterPortElement(ExtensibilityElement element) {
097: return element instanceof ScriptConfig;
098: }
099:
100: /*
101: * (non-Javadoc)
102: *
103: * @see org.apache.servicemix.common.wsdl.AbstractWsdlDeployer#filterBindingElement(javax.wsdl.extensions.ExtensibilityElement)
104: */
105: protected boolean filterBindingElement(ExtensibilityElement element) {
106: return element instanceof ScriptBinding;
107: }
108:
109: /*
110: * (non-Javadoc)
111: *
112: * @see org.apache.servicemix.common.wsdl.AbstractWsdlDeployer#registerExtensions(javax.wsdl.extensions.ExtensionRegistry)
113: */
114: protected void registerExtensions(ExtensionRegistry registry) {
115: super.registerExtensions(registry);
116: ScriptExtension.register(registry);
117: }
118:
119: }
|