From imperius-commits-return-144-apmail-incubator-imperius-commits-archive=incubator.apache.org@incubator.apache.org Sat Jan 12 18:12:49 2008 Return-Path: Delivered-To: apmail-incubator-imperius-commits-archive@locus.apache.org Received: (qmail 57057 invoked from network); 12 Jan 2008 18:12:49 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 12 Jan 2008 18:12:49 -0000 Received: (qmail 76811 invoked by uid 500); 12 Jan 2008 18:12:38 -0000 Delivered-To: apmail-incubator-imperius-commits-archive@incubator.apache.org Received: (qmail 76795 invoked by uid 500); 12 Jan 2008 18:12:38 -0000 Mailing-List: contact imperius-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: imperius-dev@incubator.apache.org Delivered-To: mailing list imperius-commits@incubator.apache.org Delivered-To: moderator for imperius-commits@incubator.apache.org Received: (qmail 30712 invoked by uid 99); 11 Jan 2008 19:00:04 -0000 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r611261 [43/43] - in /incubator/imperius/trunk: ./ imperius-javaspl/ imperius-javaspl/src/main/java/org/apache/imperius/javaspl/ imperius-splcore/ imperius-splcore/src/main/antlr/org/apache/imperius/spl/parser/compiler/ imperius-splcore/src... Date: Fri, 11 Jan 2008 18:57:14 -0000 To: imperius-commits@incubator.apache.org From: kevan@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080111185849.205001A988E@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Modified: incubator/imperius/trunk/javaspl-samples/src/main/java/org/apache/imperius/javaspl/samples/userdefinedmethods/CommandLineExecution.java URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/javaspl-samples/src/main/java/org/apache/imperius/javaspl/samples/userdefinedmethods/CommandLineExecution.java?rev=611261&r1=611260&r2=611261&view=diff ============================================================================== --- incubator/imperius/trunk/javaspl-samples/src/main/java/org/apache/imperius/javaspl/samples/userdefinedmethods/CommandLineExecution.java (original) +++ incubator/imperius/trunk/javaspl-samples/src/main/java/org/apache/imperius/javaspl/samples/userdefinedmethods/CommandLineExecution.java Fri Jan 11 10:56:30 2008 @@ -1,95 +1,95 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/**/ - -/** - * @author Prashant Baliga - * - */ - -package org.apache.imperius.javaspl.samples.userdefinedmethods; - -import java.io.IOException; -import java.util.List; -import java.util.logging.Logger; - -import org.apache.imperius.spl.external.Expression; -import org.apache.imperius.spl.external.TypeConstants; -import org.apache.imperius.spl.parser.exceptions.SPLException; -import org.apache.imperius.spl.parser.util.TypeInfo; -import org.apache.imperius.util.SPLLogger; - - - -public class CommandLineExecution implements Expression -{ - - private List inputParams =null; - private static Logger logger = SPLLogger.getSPLLogger().getLogger(); - - - public CommandLineExecution(List input, boolean boo) - { - System.out.println(" creating sendMail action"); - this.inputParams=input; - } - public Object evaluate() throws SPLException - { - - Expression commandExpression=(Expression)this.inputParams.get(0); - Object command=commandExpression.evaluate(); - System.out.println("command :"+command); - - Runtime runtime=Runtime.getRuntime(); - try{ - runtime.exec((String)command); - System.out.println("command execution completed :"+command); - System.out.println(""); - - - } - catch(IOException e){ - logger.severe(Thread.currentThread().getName()+" "+e.getMessage()); - e.printStackTrace(); - } - - return new Boolean(true); - } - - - - - public String getReferenceTypeName() throws SPLException { - // TODO Auto-generated method stub - return null; - } - - public TypeInfo getType() throws SPLException { - // TODO Auto-generated method stub - return new TypeInfo(TypeConstants.booleanType,null,false); - } - - public boolean isArray() { - // TODO Auto-generated method stub - return false; - } - - public boolean validate() throws SPLException { - // TODO Auto-generated method stub - return true; - } - - - -} +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/**/ + +/** + * @author Prashant Baliga + * + */ + +package org.apache.imperius.javaspl.samples.userdefinedmethods; + +import java.io.IOException; +import java.util.List; +import java.util.logging.Logger; + +import org.apache.imperius.spl.external.Expression; +import org.apache.imperius.spl.external.TypeConstants; +import org.apache.imperius.spl.parser.exceptions.SPLException; +import org.apache.imperius.spl.parser.util.TypeInfo; +import org.apache.imperius.util.SPLLogger; + + + +public class CommandLineExecution implements Expression +{ + + private List inputParams =null; + private static Logger logger = SPLLogger.getSPLLogger().getLogger(); + + + public CommandLineExecution(List input, boolean boo) + { + System.out.println(" creating sendMail action"); + this.inputParams=input; + } + public Object evaluate() throws SPLException + { + + Expression commandExpression=(Expression)this.inputParams.get(0); + Object command=commandExpression.evaluate(); + System.out.println("command :"+command); + + Runtime runtime=Runtime.getRuntime(); + try{ + runtime.exec((String)command); + System.out.println("command execution completed :"+command); + System.out.println(""); + + + } + catch(IOException e){ + logger.severe(Thread.currentThread().getName()+" "+e.getMessage()); + e.printStackTrace(); + } + + return new Boolean(true); + } + + + + + public String getReferenceTypeName() throws SPLException { + // TODO Auto-generated method stub + return null; + } + + public TypeInfo getType() throws SPLException { + // TODO Auto-generated method stub + return new TypeInfo(TypeConstants.booleanType,null,false); + } + + public boolean isArray() { + // TODO Auto-generated method stub + return false; + } + + public boolean validate() throws SPLException { + // TODO Auto-generated method stub + return true; + } + + + +} Propchange: incubator/imperius/trunk/javaspl-samples/src/main/java/org/apache/imperius/javaspl/samples/userdefinedmethods/CommandLineExecution.java ------------------------------------------------------------------------------ svn:eol-style = native Modified: incubator/imperius/trunk/javaspl-samples/src/main/java/org/apache/imperius/javaspl/samples/userdefinedmethods/SendMail.java URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/javaspl-samples/src/main/java/org/apache/imperius/javaspl/samples/userdefinedmethods/SendMail.java?rev=611261&r1=611260&r2=611261&view=diff ============================================================================== --- incubator/imperius/trunk/javaspl-samples/src/main/java/org/apache/imperius/javaspl/samples/userdefinedmethods/SendMail.java (original) +++ incubator/imperius/trunk/javaspl-samples/src/main/java/org/apache/imperius/javaspl/samples/userdefinedmethods/SendMail.java Fri Jan 11 10:56:30 2008 @@ -1,190 +1,190 @@ -/* - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -/**/ - -/** - * @author Prashant Baliga - * - */ - -package org.apache.imperius.javaspl.samples.userdefinedmethods; - -import java.util.List; -import java.util.Properties; -import java.util.logging.Logger; -import javax.mail.Authenticator; -import javax.mail.Message; -import javax.mail.MessagingException; -import javax.mail.PasswordAuthentication; -import javax.mail.Session; -import javax.mail.Transport; -import javax.mail.internet.InternetAddress; -import javax.mail.internet.MimeMessage; - -import org.apache.imperius.spl.external.Expression; -import org.apache.imperius.spl.external.TypeConstants; -import org.apache.imperius.spl.parser.exceptions.SPLException; -import org.apache.imperius.spl.parser.util.TypeInfo; -import org.apache.imperius.util.SPLLogger; - - - -public class SendMail implements Expression -{ - - private List inputParams =null; - private static Logger logger = SPLLogger.getSPLLogger().getLogger(); - - - public SendMail(List input, boolean boo) - { - //System.out.println(" creating sendMail action"); - this.inputParams=input; - } - public Object evaluate() throws SPLException - { - - Expression fromExpression=(Expression)this.inputParams.get(0); - Object from=fromExpression.evaluate(); - System.out.println("from :"+from); - - - Expression toExpression=(Expression)this.inputParams.get(1); - Object to=toExpression.evaluate(); - System.out.println("to :"+to); - - - Expression subjectExpression=(Expression)this.inputParams.get(2); - Object subject=subjectExpression.evaluate(); - System.out.println("subject :"+subject); - - - Expression messageExpression=(Expression)this.inputParams.get(3); - Object message=messageExpression.evaluate(); - System.out.println("message :"+message); - - try { - //System.out.println("trying to send mail"); - - //System.out.println("trying to create service object "); - - boolean ret=postMail((String)from,(String)to,(String)subject,(String)message); - System.out.println("Sent mail, return value='" + ret + "'"); - System.out.println(""); - } catch (Exception e) { - System.out.println("send mail exception block"); - logger.severe(Thread.currentThread().getName()+" "+e.getMessage()); - - e.printStackTrace(); - System.out.println(e.toString()); - } - - // TODO Auto-generated method stub - return new Boolean(true); - } - - - public boolean postMail( String from,String recipients, String subject, - String message) throws MessagingException - { - //System.out.println("post mail"); - String JAVAX_MAIL_PROTOCOL = "smtp"; - String SMTP_HOST_NAME = "relay.de.ibm.com"; -// String SMTP_AUTH_USER = "anonymous"; -// String SMTP_AUTH_PWD = "anonymous"; - String SMTP_AUTH_ENABLED = "false"; -// int SEVERITY = 50; -// int NO_ACTION_SEVERITY = 50; - - boolean debug = false; -// Set the host smtp address - Properties props = new Properties(); - props.put( "mail.transport.protocol", JAVAX_MAIL_PROTOCOL); - props.put("mail.smtp.host", SMTP_HOST_NAME); - Session session = null; - //System.out.println("post mail1"); - if(SMTP_AUTH_ENABLED.equals("true")) - { - props.put("mail.smtp.auth", "true"); - Authenticator auth = new SMTPAuthenticator(); - session = Session.getDefaultInstance(props, auth); - //System.out.println("post mail2"); - } - else - session = Session.getDefaultInstance(props); - //System.out.println("post mail3"); - session.setDebug(debug); - -// create a message - Message msg = new MimeMessage(session); - //System.out.println("post mail4"); - msg.setFrom(new InternetAddress(from)); - //System.out.println("post mail5"); - msg.setRecipients(Message.RecipientType.TO, InternetAddress.parse( recipients )); - //System.out.println("post mail6"); - -// Setting the Subject and Content Type - msg.setSubject(subject); - msg.setContent(message, "text/plain"); - //System.out.println("post mail7"); - try{ - //System.out.println("post mail8"); - Transport.send(msg); - //System.out.println("post mail9"); - }catch(Exception e) - { - e.printStackTrace(); - - } - - //System.out.println("messsage sent"); - return true; - } - - - public String getReferenceTypeName() throws SPLException { - // TODO Auto-generated method stub - return null; - } - - public TypeInfo getType() throws SPLException { - // TODO Auto-generated method stub - return new TypeInfo(TypeConstants.booleanType,null,false); - } - - public boolean isArray() { - // TODO Auto-generated method stub - return false; - } - - public boolean validate() throws SPLException { - // TODO Auto-generated method stub - return true; - } - - - - private class SMTPAuthenticator extends javax.mail.Authenticator - { - public PasswordAuthentication getPasswordAuthentication() - { - String SMTP_AUTH_USER = "anonymous"; - String SMTP_AUTH_PWD = "anonymous"; - - String username = SMTP_AUTH_USER; - String password = SMTP_AUTH_PWD; - return new PasswordAuthentication(username, password); - } - } -} +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/**/ + +/** + * @author Prashant Baliga + * + */ + +package org.apache.imperius.javaspl.samples.userdefinedmethods; + +import java.util.List; +import java.util.Properties; +import java.util.logging.Logger; +import javax.mail.Authenticator; +import javax.mail.Message; +import javax.mail.MessagingException; +import javax.mail.PasswordAuthentication; +import javax.mail.Session; +import javax.mail.Transport; +import javax.mail.internet.InternetAddress; +import javax.mail.internet.MimeMessage; + +import org.apache.imperius.spl.external.Expression; +import org.apache.imperius.spl.external.TypeConstants; +import org.apache.imperius.spl.parser.exceptions.SPLException; +import org.apache.imperius.spl.parser.util.TypeInfo; +import org.apache.imperius.util.SPLLogger; + + + +public class SendMail implements Expression +{ + + private List inputParams =null; + private static Logger logger = SPLLogger.getSPLLogger().getLogger(); + + + public SendMail(List input, boolean boo) + { + //System.out.println(" creating sendMail action"); + this.inputParams=input; + } + public Object evaluate() throws SPLException + { + + Expression fromExpression=(Expression)this.inputParams.get(0); + Object from=fromExpression.evaluate(); + System.out.println("from :"+from); + + + Expression toExpression=(Expression)this.inputParams.get(1); + Object to=toExpression.evaluate(); + System.out.println("to :"+to); + + + Expression subjectExpression=(Expression)this.inputParams.get(2); + Object subject=subjectExpression.evaluate(); + System.out.println("subject :"+subject); + + + Expression messageExpression=(Expression)this.inputParams.get(3); + Object message=messageExpression.evaluate(); + System.out.println("message :"+message); + + try { + //System.out.println("trying to send mail"); + + //System.out.println("trying to create service object "); + + boolean ret=postMail((String)from,(String)to,(String)subject,(String)message); + System.out.println("Sent mail, return value='" + ret + "'"); + System.out.println(""); + } catch (Exception e) { + System.out.println("send mail exception block"); + logger.severe(Thread.currentThread().getName()+" "+e.getMessage()); + + e.printStackTrace(); + System.out.println(e.toString()); + } + + // TODO Auto-generated method stub + return new Boolean(true); + } + + + public boolean postMail( String from,String recipients, String subject, + String message) throws MessagingException + { + //System.out.println("post mail"); + String JAVAX_MAIL_PROTOCOL = "smtp"; + String SMTP_HOST_NAME = "relay.de.ibm.com"; +// String SMTP_AUTH_USER = "anonymous"; +// String SMTP_AUTH_PWD = "anonymous"; + String SMTP_AUTH_ENABLED = "false"; +// int SEVERITY = 50; +// int NO_ACTION_SEVERITY = 50; + + boolean debug = false; +// Set the host smtp address + Properties props = new Properties(); + props.put( "mail.transport.protocol", JAVAX_MAIL_PROTOCOL); + props.put("mail.smtp.host", SMTP_HOST_NAME); + Session session = null; + //System.out.println("post mail1"); + if(SMTP_AUTH_ENABLED.equals("true")) + { + props.put("mail.smtp.auth", "true"); + Authenticator auth = new SMTPAuthenticator(); + session = Session.getDefaultInstance(props, auth); + //System.out.println("post mail2"); + } + else + session = Session.getDefaultInstance(props); + //System.out.println("post mail3"); + session.setDebug(debug); + +// create a message + Message msg = new MimeMessage(session); + //System.out.println("post mail4"); + msg.setFrom(new InternetAddress(from)); + //System.out.println("post mail5"); + msg.setRecipients(Message.RecipientType.TO, InternetAddress.parse( recipients )); + //System.out.println("post mail6"); + +// Setting the Subject and Content Type + msg.setSubject(subject); + msg.setContent(message, "text/plain"); + //System.out.println("post mail7"); + try{ + //System.out.println("post mail8"); + Transport.send(msg); + //System.out.println("post mail9"); + }catch(Exception e) + { + e.printStackTrace(); + + } + + //System.out.println("messsage sent"); + return true; + } + + + public String getReferenceTypeName() throws SPLException { + // TODO Auto-generated method stub + return null; + } + + public TypeInfo getType() throws SPLException { + // TODO Auto-generated method stub + return new TypeInfo(TypeConstants.booleanType,null,false); + } + + public boolean isArray() { + // TODO Auto-generated method stub + return false; + } + + public boolean validate() throws SPLException { + // TODO Auto-generated method stub + return true; + } + + + + private class SMTPAuthenticator extends javax.mail.Authenticator + { + public PasswordAuthentication getPasswordAuthentication() + { + String SMTP_AUTH_USER = "anonymous"; + String SMTP_AUTH_PWD = "anonymous"; + + String username = SMTP_AUTH_USER; + String password = SMTP_AUTH_PWD; + return new PasswordAuthentication(username, password); + } + } +} Propchange: incubator/imperius/trunk/javaspl-samples/src/main/java/org/apache/imperius/javaspl/samples/userdefinedmethods/SendMail.java ------------------------------------------------------------------------------ svn:eol-style = native Modified: incubator/imperius/trunk/pom.xml URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/pom.xml?rev=611261&r1=611260&r2=611261&view=diff ============================================================================== --- incubator/imperius/trunk/pom.xml (original) +++ incubator/imperius/trunk/pom.xml Fri Jan 11 10:56:30 2008 @@ -1,55 +1,55 @@ - - - 4.0.0 - imperius - build-all - 1.0.0-SNAPSHOT - Apache imperius - http://ws.apache.org/imperius - - 2.0.4 - - pom - - - 1.0.0-SNAPSHOT - - - imperius-splcore - imperius-javaspl - javaspl-samples - - - - install - src - - - src - - **/*.properties - - - - resources - resources - - - - - + + + 4.0.0 + imperius + build-all + 1.0.0-SNAPSHOT + Apache imperius + http://ws.apache.org/imperius + + 2.0.4 + + pom + + + 1.0.0-SNAPSHOT + + + imperius-splcore + imperius-javaspl + javaspl-samples + + + + install + src + + + src + + **/*.properties + + + + resources + resources + + + + + Propchange: incubator/imperius/trunk/pom.xml ------------------------------------------------------------------------------ svn:eol-style = native