Return-Path: Delivered-To: apmail-ws-tuscany-commits-archive@locus.apache.org Received: (qmail 14168 invoked from network); 10 Jun 2007 08:31:01 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 10 Jun 2007 08:31:01 -0000 Received: (qmail 22475 invoked by uid 500); 10 Jun 2007 08:31:05 -0000 Delivered-To: apmail-ws-tuscany-commits-archive@ws.apache.org Received: (qmail 22395 invoked by uid 500); 10 Jun 2007 08:31:05 -0000 Mailing-List: contact tuscany-commits-help@ws.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: tuscany-dev@ws.apache.org Delivered-To: mailing list tuscany-commits@ws.apache.org Received: (qmail 22386 invoked by uid 99); 10 Jun 2007 08:31:04 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 10 Jun 2007 01:31:04 -0700 X-ASF-Spam-Status: No, hits=-99.5 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 10 Jun 2007 01:31:00 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id 13CCF1A981A; Sun, 10 Jun 2007 01:30:40 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r545855 - in /incubator/tuscany/java/das/samples/sample-ajax-das: readme.htm src/main/java/org/apache/tuscany/samples/das/DASQueryProcessor.java src/main/webapp/jsp/default.css src/main/webapp/jsp/main.css Date: Sun, 10 Jun 2007 08:30:39 -0000 To: tuscany-commits@ws.apache.org From: adrianocrestani@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20070610083040.13CCF1A981A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: adrianocrestani Date: Sun Jun 10 01:30:39 2007 New Revision: 545855 URL: http://svn.apache.org/viewvc?view=rev&rev=545855 Log: - added Apache License header to files: samples/sample-ajax-das/readme.htm, sample-ajax-das/src/main/java/org/apache/tuscany/samples/das/DASQueryProcessor.java, sample-ajax-das/src/main/webapp/jsp/main.css, sample-ajax-das/src/main/webapp/jsp/default.css Modified: incubator/tuscany/java/das/samples/sample-ajax-das/readme.htm incubator/tuscany/java/das/samples/sample-ajax-das/src/main/java/org/apache/tuscany/samples/das/DASQueryProcessor.java incubator/tuscany/java/das/samples/sample-ajax-das/src/main/webapp/jsp/default.css incubator/tuscany/java/das/samples/sample-ajax-das/src/main/webapp/jsp/main.css Modified: incubator/tuscany/java/das/samples/sample-ajax-das/readme.htm URL: http://svn.apache.org/viewvc/incubator/tuscany/java/das/samples/sample-ajax-das/readme.htm?view=diff&rev=545855&r1=545854&r2=545855 ============================================================================== --- incubator/tuscany/java/das/samples/sample-ajax-das/readme.htm (original) +++ incubator/tuscany/java/das/samples/sample-ajax-das/readme.htm Sun Jun 10 01:30:39 2007 @@ -1,3 +1,29 @@ + COMMAND is NULL"); } - + if(queryOrcommand.startsWith("query:")){ String qry = queryOrcommand.substring(6); if(qry == null || qry.trim().length() == 0){ @@ -85,7 +104,7 @@ return props; } } - + if(queryOrcommand.startsWith("command:")){ String cmd = queryOrcommand.substring(8); if(cmd == null || cmd.trim().length() == 0){ @@ -97,8 +116,8 @@ return props; } } - - + + return null; } @@ -120,9 +139,9 @@ if(root.getList("CUSTOMER") != null && root.getList("CUSTOMER").size() >0){ elemNames.add("CUSTOMER"); } - + return formatResult(root, elemNames); - + } /* Get DAS config */ @@ -131,29 +150,29 @@ } /* Instantiate DAS*/ - private void getDAS(){ - das = DAS.FACTORY.createDAS(getConfig(configFile)); + private void getDAS(){ + das = DAS.FACTORY.createDAS(getConfig(configFile)); } - + /*For any query starting with query: or command: */ private DataObject runCommand(String qry, String qryOrCommand)throws Exception{ - DataObject root = null; + DataObject root = null; //adhoc queries if(qryOrCommand.startsWith("query")){//query can come single or batch, when batch, it will be {}{} if(!qry.startsWith("{")){ - read = das.createCommand(qry); - root = read.executeQuery(); + read = das.createCommand(qry); + root = read.executeQuery(); } else{ Vector batch = formQueries(qry);//separate {}{} in different queries - + if(batch != null){ for(int i=0; i formQueries(String qry){ Vector batch = new Vector(); @@ -185,7 +204,7 @@ } return batch; } - + public static String formatResult(DataObject root, Vector elementNames){ String xmlStr = ""; XMLHelper helper = XMLHelper.INSTANCE; @@ -195,50 +214,50 @@ for(int i=0; i"; int idx = xmlStr.indexOf("\n"; String add1Str = "\n"; String add2Str = ""; String addEndStr = " "; - + xmlStr = add0Str+add1Str+add2Str+xmlStr+"\n"+addEndStr; return xmlStr; } - + //below has improper serialization due to SDO bugs /*From DataGraph get contents related to element */ /*private String xmlizeContent(DataGraph graph) throws Exception{ @@ -249,7 +268,7 @@ out.flush(); //oos.close(); out.close(); - + //there are UTF-8 chars which are not ISO-8859-1 ones and xsl transformation does not happen due to that //so filter unwanted. byte[] graphBytes = out.toByteArray(); @@ -261,25 +280,25 @@ graphChars[j] = (char)curChar; j++; } - + String finalStr = new String(graphChars); - + //remove any junk before first < - finalStr = finalStr.substring(finalStr.indexOf("<"), finalStr.indexOf("")+16); + finalStr = finalStr.substring(finalStr.indexOf("<"), finalStr.indexOf("")+16); String xmlSerializationContent = filterJunk(finalStr);//further remove extra characters appearing System.out.println("xmlSerializationContent:"+xmlSerializationContent); - String xmlContent = XmlUtil.getXmlContents(xmlSerializationContent, "", ""); + String xmlContent = XmlUtil.getXmlContents(xmlSerializationContent, "", ""); System.out.println("xmlContent:"+xmlContent); - return xmlContent; + return xmlContent; } - + //for some reason control chars are appearing, need to filter those //this is ugly solution, need to know why from SDO DataGraph these //chars are coming in the first place. private String filterJunk(String inStr){ char[] myCharArr = inStr.toCharArray(); StringBuffer strBuf = new StringBuffer(); - + for(int i=0; i=33 && myCharArr[i]<=125) || Character.isWhitespace(myCharArr[i])){ @@ -288,18 +307,18 @@ } return strBuf.toString(); }*/ - + /* Start CRUD example */ public DataObject getAllCompanies(String qry) { read = das.getCommand(qry); DataObject root = read.executeQuery(); return root; } - + public DataObject getAllCompaniesAndDepartments(String qry) { read = das.getCommand(qry); DataObject root = read.executeQuery(); - return root; + return root; } public DataObject getAddDepartmentToFirstCompany(String qry) { @@ -310,14 +329,14 @@ DataObject newDepartment = root.createDataObject("DEPARTMENT"); newDepartment.setString("NAME", "Default Name"); List deptList = firstCompany.getList("departments"); - + deptList.add(newDepartment); das.applyChanges(root); - + root = read.executeQuery(); return root; } - + public DataObject getDeleteDepartmentFromFirstCompany(String qry) { Command read = das.getCommand("AllCompaniesAndDepartments"); DataObject root = read.executeQuery(); @@ -326,18 +345,18 @@ List departments = firstCompany.getList("departments"); DataObject departmentToDelete = (DataObject)departments.get(departments.size()-1); departmentToDelete.delete(); - das.applyChanges(root); - root = read.executeQuery(); + das.applyChanges(root); + root = read.executeQuery(); return root; - } - + } + public DataObject getUpdateCompanyDepartmentNames(String qry) { Command read = das.getCommand("AllCompaniesAndDepartments"); DataObject root = read.executeQuery(); DataObject firstCompany = root.getDataObject("COMPANY[1]"); Iterator i = firstCompany.getList("departments").iterator(); - + DataObject department; while (i.hasNext()) { department = (DataObject) i.next(); @@ -346,18 +365,18 @@ break; } das.applyChanges(root); - - root = read.executeQuery(); + + root = read.executeQuery(); return root; } - + /* @return random new department name */ private String getRandomDepartmentName() { int number = generator.nextInt(1000) + 1; return "Dept-" + number; } /*End CRUD example */ - + /*Start OCC example */ public String getOcc() throws Exception{ getDAS(); @@ -373,19 +392,19 @@ // Build apply changes command try { - das.applyChanges(root); + das.applyChanges(root); } catch (OptimisticConcurrencyException ex) { if (!ex.getMessage().equals("An update collision occurred")) { throw ex; } else{ - return ex.getMessage(); + return ex.getMessage(); } } return "Success"; } /* End OCC example */ - + /* Start Result Set Shape example*/ public String getRss(String stmt) throws Exception{ getDAS(); @@ -394,7 +413,7 @@ DataObject root = read.executeQuery(); Vector elemNames = new Vector(); elemNames.add("CUSTOMER"); - return formatResult(root, elemNames); + return formatResult(root, elemNames); } /* End Result Set Shape example*/ @@ -413,17 +432,17 @@ read = das.getCommand("testArbitraryConverter"); //Read DataObject root = read.executeQuery(); - + if(stmt.equals("stmt0")){//Select * from CUSTOMER where ID = 1; Vector elemNames = new Vector(); elemNames.add("CUSTOMER"); return this.formatResult(root, elemNames); } - + if(stmt.equals("stmt1")){//Check First Customer's LastName is 1957.09.27 return myformat.format(root.getDate("CUSTOMER[1]/LASTNAME")); } - + if(stmt.equals("stmt2")||stmt.equals("stmt3")){//Set First Customer's LastName to 1966.12.20 OR //Check First Customer's LastName is 1966.12.20 root.setDate("CUSTOMER[1]/LASTNAME", tbday); @@ -432,20 +451,20 @@ root = read.executeQuery(); return myformat.format(root.getDate("CUSTOMER[1]/LASTNAME")); } - + return null; } /* Converter example end**/ - + /*For test*/ public static void main(String[] args){ DASQueryProcessor qryProc = new DASQueryProcessor(); try{ - qryProc.execute("command:AllCompaniesAndDepartments", "DasConfig.xml"); + qryProc.execute("command:AllCompaniesAndDepartments", "DasConfig.xml"); }catch(Exception e){ e.printStackTrace(); } - + } - + } Modified: incubator/tuscany/java/das/samples/sample-ajax-das/src/main/webapp/jsp/default.css URL: http://svn.apache.org/viewvc/incubator/tuscany/java/das/samples/sample-ajax-das/src/main/webapp/jsp/default.css?view=diff&rev=545855&r1=545854&r2=545855 ============================================================================== --- incubator/tuscany/java/das/samples/sample-ajax-das/src/main/webapp/jsp/default.css (original) +++ incubator/tuscany/java/das/samples/sample-ajax-das/src/main/webapp/jsp/default.css Sun Jun 10 01:30:39 2007 @@ -1,3 +1,22 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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. + */ + BODY {BACKGROUND-COLOR: #FFFFFF; COLOR: #333366; FONT-FAMILY: 'Times New Roman'} H1 {COLOR: #6666CC; FONT-FAMILY: 'Times New Roman'; TEXT-TRANSFORM: capitalize } H2 {COLOR: #6666CC; FONT-FAMILY: 'Times New Roman'; TEXT-TRANSFORM: capitalize } Modified: incubator/tuscany/java/das/samples/sample-ajax-das/src/main/webapp/jsp/main.css URL: http://svn.apache.org/viewvc/incubator/tuscany/java/das/samples/sample-ajax-das/src/main/webapp/jsp/main.css?view=diff&rev=545855&r1=545854&r2=545855 ============================================================================== --- incubator/tuscany/java/das/samples/sample-ajax-das/src/main/webapp/jsp/main.css (original) +++ incubator/tuscany/java/das/samples/sample-ajax-das/src/main/webapp/jsp/main.css Sun Jun 10 01:30:39 2007 @@ -1,3 +1,22 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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. + */ + body { margin: 0px; --------------------------------------------------------------------- To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org For additional commands, e-mail: tuscany-commits-help@ws.apache.org