diff options
Diffstat (limited to 'sandbox/kgoodson/jagg-webapp/src')
10 files changed, 905 insertions, 0 deletions
diff --git a/sandbox/kgoodson/jagg-webapp/src/main/java/services/PlanView.java b/sandbox/kgoodson/jagg-webapp/src/main/java/services/PlanView.java new file mode 100644 index 0000000000..ffb68270da --- /dev/null +++ b/sandbox/kgoodson/jagg-webapp/src/main/java/services/PlanView.java @@ -0,0 +1,38 @@ +/* + * 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. + */ + +package services; + +import org.oasisopen.sca.annotation.Remotable; + +import com.example.ipo.jaxb.Plan; + + + + + +@Remotable +public interface PlanView { + + Plan get(); + Plan getLite(); // don't go off to issue site - use cached properties + void postNewWorkItem(String msChoice, String jira); + void postNewMilestone(String newMSName); + +}
\ No newline at end of file diff --git a/sandbox/kgoodson/jagg-webapp/src/main/java/services/PlanViewImpl.java b/sandbox/kgoodson/jagg-webapp/src/main/java/services/PlanViewImpl.java new file mode 100644 index 0000000000..fad6f68b63 --- /dev/null +++ b/sandbox/kgoodson/jagg-webapp/src/main/java/services/PlanViewImpl.java @@ -0,0 +1,252 @@ +/* + * 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. + */ + +package services; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.List; + +import javax.xml.bind.JAXBContext; +import javax.xml.bind.JAXBElement; +import javax.xml.bind.Marshaller; +import javax.xml.bind.Unmarshaller; + +import org.oasisopen.sca.annotation.Init; +import org.oasisopen.sca.annotation.Property; + +import com.example.ipo.jaxb.Item; +import com.example.ipo.jaxb.JiraData; +import com.example.ipo.jaxb.Milestone; +import com.example.ipo.jaxb.Plan; +import com.example.ipo.jaxb.RSS; +import com.example.ipo.jaxb.WorkItem; + +public class PlanViewImpl implements PlanView { + + static String rssPrefix = "http://issues.apache.org/jira/si/jira.issueviews:issue-xml/"; + @Property + public String planFile = "src/main/resources/jiraSideBand.xml"; + + @Init + public void init() { + } + + private Plan getPlan() { + Plan p = null; + try { + p = readPlan(); + augmentPlan(p); + writePlan(p); + } catch (Exception e) { + e.printStackTrace(); + } + return p; + } + + + + private void augmentPlan(Plan plan) { + for(Milestone m : plan.getMilestone()) { + for (WorkItem wi: m.getWorkItem()) { + augmentWorkItem(wi); + + } + } + } + + private void augmentWorkItem(WorkItem wi) { + String jira = wi.getJira(); + if(jira != null) { + JiraData jd = new JiraData(); + wi.setJiraData(jd); + jd.setID(jira); + + try { + JAXBContext jaxbContext = JAXBContext + .newInstance("com.example.ipo.jaxb"); + Unmarshaller m2 = jaxbContext.createUnmarshaller(); + InputStream is = null; + RSS jfeed = null; + try{ + URL url = new URL("http://issues.apache.org/jira/si/jira.issueviews:issue-xml/"+jira+"/"+jira+".xml"); + is = url.openStream(); + jfeed = ((JAXBElement<RSS>) m2.unmarshal(is)).getValue(); + } + catch (FileNotFoundException e) { + String note = wi.getNote(); + note += ": attempt to reference non-existent JIRA " + jira; + wi.setNote(note); + wi.setJira(null); + wi.setJiraData(null); + } + finally { + if(is != null) is.close(); + } + + if(jfeed != null) { + Item i = jfeed.getChannel().getItem(); + List<JAXBElement<?>> c = i.getContent(); + // TODO see if there's a better way to get this data out + for (JAXBElement<?> element : c) { + if("title".equals(element.getName().getLocalPart())) { + String jtitle = (String)element.getValue(); + jd.setTitle(jtitle.substring(jtitle.indexOf(']')+1, jtitle.length())); + } + else if("status".equals(element.getName().getLocalPart())){ + jd.setStatus((String)element.getValue()); + } + else if("assignee".equals(element.getName().getLocalPart())) { + jd.setAssignedTo((String)element.getValue()); + } + } + } + } catch (Exception e) { + e.printStackTrace(); + } finally { + + } + } + } + + public Plan get() { + Plan p = getPlan(); + return p; + } + + public Plan getLite() { + Plan p = readPlan(); + return p; + } + + private Milestone getMS(Plan p, String id) { + + Milestone m = null; + for(Milestone mi : p.getMilestone()) { + if(id.equals(mi.getID())) { + m = mi; + break; + } + } + return m; + } + + public void postNewWorkItem(String msid, String jira) { + + Plan p = readPlan(); + Milestone m = getMS(p,msid); + WorkItem wi = new WorkItem(); + wi.setJira(jira); + augmentWorkItem(wi); + m.getWorkItem().add(wi); + writePlan(p); + } + + public void postNewMilestone(String msid) { + Plan p = readPlan(); + if(getMS(p, msid) == null) { + List<Milestone> mis = p.getMilestone(); + Milestone newm = new Milestone(); + newm.setID(msid); + mis.add(newm); + writePlan(p); + } + } + + + private void writePlan(Plan p) + { + FileOutputStream fos = null; + String dbPath = null; + File existingFile = null; + File newFile= null; + String backupPath = null; + + try { + JAXBContext jaxbContext = JAXBContext + .newInstance("com.example.ipo.jaxb"); + Marshaller m = jaxbContext.createMarshaller(); + m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); + + existingFile = new File(planFile).getAbsoluteFile(); + dbPath = existingFile.getAbsolutePath(); + + + String tempPath = dbPath.substring(0,dbPath.indexOf(".xml"))+".tmp.xml"; + backupPath = dbPath.substring(0,dbPath.indexOf(".xml")); + DateFormat df = new SimpleDateFormat("yyyyMMddHHmmss"); + String timestamp = df.format(Calendar.getInstance().getTime()); + backupPath+= timestamp; + backupPath+=".xml"; + + newFile = new File(tempPath).getAbsoluteFile(); + fos = new FileOutputStream(newFile); + + + m.marshal(p, fos); + } catch (Exception e) { + e.printStackTrace(); + } finally { + + } + + + if(fos!=null) + try { + fos.close(); + + new File(dbPath).renameTo(new File(backupPath)); + newFile.renameTo(new File(dbPath)); + + + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + private Plan readPlan() + { + Plan p = null; + try { + JAXBContext jaxbContext = JAXBContext + .newInstance("com.example.ipo.jaxb"); + Unmarshaller m = jaxbContext.createUnmarshaller(); + + File inputFile = new File(planFile).getAbsoluteFile(); + if(!inputFile.exists()){ // start afresh + Plan newPlan = new Plan(); + writePlan(newPlan); + inputFile = new File(planFile).getAbsoluteFile(); + } + + p = (Plan)m.unmarshal(inputFile); + } catch(Exception e) { + throw new IllegalStateException("Failed to read plan file",e); + } + return p; + } +}
\ No newline at end of file diff --git a/sandbox/kgoodson/jagg-webapp/src/main/resources/JiraRSS.xsd b/sandbox/kgoodson/jagg-webapp/src/main/resources/JiraRSS.xsd new file mode 100644 index 0000000000..4a2b066267 --- /dev/null +++ b/sandbox/kgoodson/jagg-webapp/src/main/resources/JiraRSS.xsd @@ -0,0 +1,99 @@ +<?xml version="1.0" encoding="UTF-8"?> +<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> + + <xsd:include schemaLocation=""></xsd:include> + <xsd:element name="rss" type="RSS"></xsd:element> + + <xsd:complexType name="JiraRSS"> + <xsd:sequence> + <xsd:element name="channel" type="xsd:string"></xsd:element> + </xsd:sequence> + </xsd:complexType> + + <xsd:complexType name="Channel"> + <xsd:sequence> + <xsd:element name="title" type="xsd:string"></xsd:element> + <xsd:element name="link" type="xsd:string"></xsd:element> + <xsd:element name="description" type="xsd:string"></xsd:element> + <xsd:element name="language" type="xsd:string"></xsd:element> + <xsd:element name="build-info" type="BuildInfo"></xsd:element> + <xsd:element name="item" type="Item"></xsd:element> + </xsd:sequence> + </xsd:complexType> + + + + <xsd:complexType name="Item"> + <xsd:sequence> + <xsd:element name="title" type="xsd:string"></xsd:element> + <xsd:element name="link" type="xsd:string"></xsd:element> + <xsd:element name="description" type="xsd:string"></xsd:element> + <xsd:element name="environment" type="xsd:string"></xsd:element> + <xsd:element name="type" type="xsd:string"></xsd:element> + <xsd:element name="priority" type="xsd:string"></xsd:element> + <xsd:element name="status" type="xsd:string"></xsd:element> + <xsd:element name="resolution" type="xsd:string"></xsd:element> + <xsd:element name="assignee" type="xsd:string"></xsd:element> + <xsd:element name="reporter" type="xsd:string"></xsd:element> + <xsd:element name="key" type="Key"></xsd:element> + <xsd:element name="summary" type="xsd:string"></xsd:element> + <xsd:element name="type" type="xsd:string"></xsd:element> + <xsd:element name="priority" type="xsd:string"></xsd:element> + <xsd:element name="status" type="xsd:string"></xsd:element> + <xsd:element name="resolution" type="xsd:string"></xsd:element> + <xsd:element name="assignee" type="xsd:string"></xsd:element> + <xsd:element name="reporter" type="xsd:string"></xsd:element> + <xsd:element name="created" type="xsd:string"></xsd:element> + <xsd:element name="updated" type="xsd:string"></xsd:element> + <xsd:element name="version" type="xsd:string"></xsd:element> + <xsd:element name="fixVersion" type="xsd:string"></xsd:element> + <xsd:element name="component" type="xsd:string"></xsd:element> + <xsd:element name="due" type="xsd:string"></xsd:element> + <xsd:element name="votes" type="xsd:string"></xsd:element> + <xsd:element name="comments" type="Comments"></xsd:element> + + </xsd:sequence> + </xsd:complexType> + + + <xsd:complexType name="RSS"> + <xsd:sequence> + <xsd:element name="channel" type="Channel"></xsd:element> + </xsd:sequence> + <xsd:attribute name="version" type="xsd:string"></xsd:attribute> + </xsd:complexType> + + + <xsd:complexType name="Key"> + <xsd:simpleContent> + <xsd:extension base="xsd:string"> + <xsd:attribute name="id" type="xsd:string"></xsd:attribute> + </xsd:extension> + </xsd:simpleContent> + </xsd:complexType> + + <xsd:complexType name="Comment"> + <xsd:simpleContent> + <xsd:extension base="xsd:string"> + <xsd:attribute name="id" type="xsd:string"></xsd:attribute> + <xsd:attribute name="author" type="xsd:string"></xsd:attribute> + <xsd:attribute name="created" type="xsd:string"></xsd:attribute> + </xsd:extension> + </xsd:simpleContent> + </xsd:complexType> + + <xsd:complexType name="Comments"> + <xsd:sequence> + <xsd:element name="comment" type="Comment" maxOccurs="unbounded" minOccurs="0"></xsd:element> + </xsd:sequence> + </xsd:complexType> + + <xsd:complexType name="BuildInfo"> + <xsd:sequence> + <xsd:element name="version" type="xsd:string"></xsd:element> + <xsd:element name="build-number" type="xsd:string"></xsd:element> + <xsd:element name="build-date" type="xsd:string"></xsd:element> + <xsd:element name="edition" type="xsd:string"></xsd:element> + </xsd:sequence> + </xsd:complexType> +</xsd:schema> diff --git a/sandbox/kgoodson/jagg-webapp/src/main/resources/JiraSideband.xml b/sandbox/kgoodson/jagg-webapp/src/main/resources/JiraSideband.xml new file mode 100644 index 0000000000..2d60a3b83a --- /dev/null +++ b/sandbox/kgoodson/jagg-webapp/src/main/resources/JiraSideband.xml @@ -0,0 +1,65 @@ +<?xml version="1.0" encoding="UTF-8" standalone="yes"?> +<ns2:plan xmlns:ns2="http://www.example.com/tracking"> + <issueBase>https://issues.apache.org/jira/browse/</issueBase> + <milestone ID="V8 M5I14a"> + <workItem> + <jira>TUSCANY-2850</jira> + <jiraData ID="TUSCANY-2850"> + <title> Support binding.json-rpc for implementation.java's reference</title> + <status>Resolved</status> + <assignedTo>Luciano Resende</assignedTo> + </jiraData> + </workItem> + <workItem> + <jira>TUSCANY-3395</jira> + <jiraData ID="TUSCANY-3395"> + <title> Tidying up Contribution Scanner API</title> + <status>Resolved</status> + <assignedTo>Luciano Resende</assignedTo> + </jiraData> + </workItem> + <workItem> + <jira>TUSCANY-3397</jira> + <jiraData ID="TUSCANY-3397"> + <title> Add support for identifying the SCA Spec Version for contribution metadata</title> + <status>Resolved</status> + <assignedTo>Luciano Resende</assignedTo> + </jiraData> + </workItem> + </milestone> + <milestone ID="V8_M5I14b"> + <workItem> + <jira>TUSCANY-3433</jira> + <jiraData ID="TUSCANY-3433"> + <title> Import more of the basic itests from 1.x to 2.x </title> + <status>Open</status> + <assignedTo>Ramkumar Ramalingam</assignedTo> + </jiraData> + </workItem> + <workItem> + <jira>TUSCANY-3409</jira> + <jiraData ID="TUSCANY-3409"> + <title> Non-Simple Property Injected with XML Fails with NullPointerException</title> + <status>Resolved</status> + <assignedTo>Raymond Feng</assignedTo> + </jiraData> + </workItem> + <workItem> + <jira>TUSCANY-3441</jira> + <jiraData ID="TUSCANY-3441"> + <title> Improve mechanism for determining locality of endpoints to endpoint references</title> + <status>Open</status> + <assignedTo>Unassigned</assignedTo> + </jiraData> + </workItem> + <workItem> + <jira>TUSCANY-3443</jira> + <jiraData ID="TUSCANY-3443"> + <title> Devise a away to track and spi changes we make in 2.x</title> + <status>Open</status> + <assignedTo>Unassigned</assignedTo> + </jiraData> + </workItem> + </milestone> + <milestone ID="V8_M5I15a"/> +</ns2:plan> diff --git a/sandbox/kgoodson/jagg-webapp/src/main/resources/JiraSideband.xsd b/sandbox/kgoodson/jagg-webapp/src/main/resources/JiraSideband.xsd new file mode 100644 index 0000000000..19b2beca32 --- /dev/null +++ b/sandbox/kgoodson/jagg-webapp/src/main/resources/JiraSideband.xsd @@ -0,0 +1,133 @@ +<?xml version="1.0" encoding="UTF-8"?>
+ <!--
+ 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.
+ -->
+<xsd:schema targetNamespace="http://www.example.com/tracking"
+ xmlns:jagg="http://www.example.com/tracking" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> + + <xsd:element name="plan"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="issueBase" type="xsd:string" + maxOccurs="1" minOccurs="0"></xsd:element> + + + <xsd:element name="milestone" type="jagg:Milestone" + maxOccurs="unbounded" minOccurs="0"></xsd:element> + </xsd:sequence> + </xsd:complexType>
+ </xsd:element>
+
+
+ <xsd:complexType name="WorkItem">
+ <xsd:annotation>
+ <xsd:documentation>
+ The milestone or deliverable name that we require this
+ function for
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:sequence>
+
+ <xsd:element name="title" type="xsd:string" maxOccurs="1"
+ minOccurs="1"></xsd:element>
+ <xsd:element name="responsible" type="xsd:string"
+ maxOccurs="1" minOccurs="0">
+ </xsd:element>
+ <xsd:element name="dueDate" type="xsd:string" maxOccurs="1"
+ minOccurs="0" />
+ <xsd:element name="jira" type="xsd:string" maxOccurs="1"
+ minOccurs="0">
+ </xsd:element>
+ <xsd:element name="status" type="xsd:string" maxOccurs="1"
+ minOccurs="0">
+ </xsd:element>
+
+
+ <xsd:element name="repository_vid" type="xsd:string"
+ maxOccurs="1" minOccurs="0">
+ </xsd:element>
+ <xsd:element name="note" type="xsd:string" maxOccurs="1"
+ minOccurs="0">
+ </xsd:element>
+
+ <xsd:element name="jiraData" type="jagg:JiraData"
+ maxOccurs="1" minOccurs="0"></xsd:element>
+ </xsd:sequence>
+ <xsd:attribute name="ID" type="xsd:ID"></xsd:attribute>
+ </xsd:complexType>
+
+
+ <xsd:complexType name="Milestone">
+
+ <xsd:sequence>
+ <xsd:element name="dueDate" type="xsd:string" maxOccurs="1"
+ minOccurs="0">
+ </xsd:element>
+
+ <xsd:element name="deliveredby" type="xsd:string"
+ maxOccurs="1" minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>
+ A tuscany source code repository branch name or
+ repository version number
+ </xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="note" type="xsd:string" maxOccurs="1"
+ minOccurs="0">
+ </xsd:element>
+
+ <xsd:element name="workItem" type="jagg:WorkItem"
+ maxOccurs="unbounded" minOccurs="0">
+ </xsd:element>
+ </xsd:sequence>
+
+
+ <xsd:attribute name="ID" type="xsd:string"></xsd:attribute>
+ </xsd:complexType>
+
+ <xsd:complexType name="Milestones"> + <xsd:sequence> + <xsd:element name="milestone" type="jagg:Milestone" + maxOccurs="unbounded" minOccurs="0"></xsd:element>
+ </xsd:sequence>
+ </xsd:complexType> + + <xsd:complexType name="WorkItems"> + <xsd:sequence> + <xsd:element name="workitem" type="jagg:WorkItem" + maxOccurs="unbounded" minOccurs="0"></xsd:element>
+ </xsd:sequence>
+ </xsd:complexType> + + + <xsd:complexType name="PlanDTO"> + <xsd:sequence> + <xsd:element name="milestones" type="jagg:Milestone" + maxOccurs="unbounded" minOccurs="0"></xsd:element> + <xsd:element name="workitems" type="jagg:WorkItem" + maxOccurs="unbounded" minOccurs="0"></xsd:element> + </xsd:sequence> + </xsd:complexType> + + <xsd:complexType name="JiraData"> + <xsd:sequence> + <xsd:element name="title" type="xsd:string"></xsd:element> + <xsd:element name="status" type="xsd:string"></xsd:element> + <xsd:element name="assignedTo" type="xsd:string"></xsd:element> + </xsd:sequence> + <xsd:attribute name="ID" type="xsd:string"></xsd:attribute> + </xsd:complexType> +</xsd:schema>
\ No newline at end of file diff --git a/sandbox/kgoodson/jagg-webapp/src/main/resources/exampleJira.xml b/sandbox/kgoodson/jagg-webapp/src/main/resources/exampleJira.xml new file mode 100644 index 0000000000..08dae93262 --- /dev/null +++ b/sandbox/kgoodson/jagg-webapp/src/main/resources/exampleJira.xml @@ -0,0 +1,67 @@ +<rss version="0.92" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="JiraRSS.xsd "> + <channel> + <title>ASF JIRA</title> + <link>https://issues.apache.org:443/jira</link> + <description>This file is an XML representation of an issue</description> + <language>en-uk</language> + <build-info> + <version>3.13.5</version> + <build-number>360</build-number> + <build-date>07-07-2009</build-date> + <edition>Enterprise</edition> + </build-info> + <item> + <title>[TUSCANY-3397] Add support for identifying the + SCA Spec Version for contribution metadata</title> + <link>https://issues.apache.org:443/jira/browse/TUSCANY-3397</link> + <description>Provide the same support we have for Composites, + for Contribution Metadata</description> + <environment /> + <key id="12443784">TUSCANY-3397</key> + <summary>Add support for identifying the SCA Spec Version for + contribution metadata</summary> + <type id="1" + iconUrl="https://issues.apache.org:443/jira/images/icons/bug.gif">Bug</type> + <priority id="3" + iconUrl="https://issues.apache.org:443/jira/images/icons/priority_major.gif">Major</priority> + <status id="5" + iconUrl="https://issues.apache.org:443/jira/images/icons/status_resolved.gif">Resolved</status> + <resolution id="1">Fixed</resolution> + <assignee username="luciano resende">Luciano Resende</assignee> + <reporter username="luciano resende">Luciano Resende</reporter> + <created>Fri, 18 Dec 2009 17:31:07 +0000 (UTC)</created> + <updated>Fri, 18 Dec 2009 17:58:58 +0000 (UTC)</updated> + <version>Java-SCA-2.0</version> + <fixVersion>Java-SCA-2.0</fixVersion> + <component>Java SCA Core Runtime</component> + <due /> + <votes>0</votes> + <comments> + <comment id="12792548" author="luciano resende" + created="Fri, 18 Dec 2009 17:58:58 +0000 (UTC)"> + Fixed, you can now identify the spec version of the contribution + metadata based on the SCA Namespace being used, this means that, + for SCA 1.1, specVersion will return + <a href="http://docs.oasis-open.org/ns/opencsa/sca/200912">http://docs.oasis-open.org/ns/opencsa/sca/200912</a> + </comment> + </comments> + <attachments /> + <subtasks /> + <customfields> + <customfield id="customfield_12310222" + key="com.atlassian.jira.ext.charting:timeinstatus"> + <customfieldname>Time in Status</customfieldname> + <customfieldvalues /> + </customfield> + <customfield id="customfield_12310221" + key="com.atlassian.jira.ext.charting:resolutiondate"> + <customfieldname>Resolution Date</customfieldname> + <customfieldvalues> + <customfieldvalue>Fri, 18 Dec 2009 17:58:58 +0000 (UTC)</customfieldvalue> + </customfieldvalues> + </customfield> + </customfields> + </item> + </channel> +</rss> diff --git a/sandbox/kgoodson/jagg-webapp/src/main/resources/plan.composite b/sandbox/kgoodson/jagg-webapp/src/main/resources/plan.composite new file mode 100644 index 0000000000..c6f837c0d2 --- /dev/null +++ b/sandbox/kgoodson/jagg-webapp/src/main/resources/plan.composite @@ -0,0 +1,42 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * 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. +--> +<composite xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912" + xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.1" + targetNamespace="http://jagg" + name="jagg"> + + <component name="planApp"> + <tuscany:implementation.widget location="plan.html"/> + <reference name="plan" target="Plan"> + <tuscany:binding.jsonrpc uri="http://localhost:8080/sample-jagg-webapp/Plan"/> + </reference> + </component> + + <component name="Plan"> + <implementation.java class="services.PlanViewImpl"/> + <property name="planFile">src/main/resources/jiraSideBand.xml</property> + <service name="PlanView"> + <tuscany:binding.jsonrpc uri="http://localhost:8080/sample-jagg-webapp/Plan"/> + </service> + </component> + + + +</composite> diff --git a/sandbox/kgoodson/jagg-webapp/src/main/resources/plan.html b/sandbox/kgoodson/jagg-webapp/src/main/resources/plan.html new file mode 100644 index 0000000000..f064b47160 --- /dev/null +++ b/sandbox/kgoodson/jagg-webapp/src/main/resources/plan.html @@ -0,0 +1,150 @@ +<!-- + * 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. +--> +<html> +<head> +<title>Plan</title> + +<script type="text/javascript" src="plan.js"></script> + +<script language="JavaScript"> + + //@Reference + var planView = new tuscany.sca.Reference("plan"); + var project = "TUSCANY"; + var ms; + + function plan_getResponse(plan,exception) { + if(exception){ + alert(exception.message); + return; + } + ms = plan.milestone.list; + var mscontent = "<table border=\"1\" align=\"left\">"; + + + + var mschoice = 'Add new Work Item for JIRA: <input type="text" name="JIRA" value="'+project+'-">in Milestone<select name="mschoice">'; + for(var i=0; i<ms.length; i++) { + mscontent += "<tr><th colspan=\"6\" align=\"left\">Milestone " + ms[i].ID + "</th></tr>"; + mschoice+='<option>'+ms[i].ID+'</option>'; + var mswi = ms[i].workItem.list; + mscontent +="<tr>"+ + "<th>Jira</th>"+ + "<th>Jira title</th>"+ + "<th>Jira Assigned To</th>"+ + "<th>Status</th>"+ + "<th>Note</th>"+ + "</tr>"; + for (var j=0; j<mswi.length; j++) { + mscontent +="<tr>"; + if(mswi[j].jira != null) { + mscontent += + "<td><A HREF=\""+plan.issueBase+mswi[j].jira+"\">"+mswi[j].jira+"</A></td>"; + } else { + mscontent += '<td>No JIRA for Work Item</td>'; + } + if(mswi[j].jiraData!= null) { + mscontent += "<td>"+mswi[j].jiraData.title+"</td>"+ + "<td>"+mswi[j].jiraData.assignedTo+"</td>"+ + "<td>"+mswi[j].jiraData.status+"</td><td>"; + } else { + mscontent += "<td colspan=\"3\"></td>"; + } + if(mswi[j].note != null) { + mscontent += mswi[j].note; + } + mscontent+="</td></tr>"; + } + + } + mscontent += "</table><P>"; + mschoice += '</select><input type="button" onClick="addWorkItem()" value="Add Work Item">'; + + document.getElementById('milestones').innerHTML='<h2>' + mscontent; + + + document.getElementById('mschoice').innerHTML=mschoice; + return; + + } + + + function init() + { + planView.getLite().addCallback(plan_getResponse); + } + + + + function addWorkItem() { + + planView.postNewWorkItem( + document.newWorkItemForm.mschoice.value, + document.newWorkItemForm.JIRA.value).addCallback(plan_postNewWorkItem_response); + } + + function plan_postNewWorkItem_response() + { + planView.getLite().addCallback(plan_getResponse); + } + + function addMilestone() + { + planView.postNewMilestone(document.newWorkItemForm.newmsname.value).addCallback(plan_postNewMilestone_response); + } + + function plan_postNewMilestone_response() + { + // refresh + planView.getLite().addCallback(plan_getResponse); + } + + function refreshJiraData() + { + planView.get().addCallback(plan_getResponse); + } + +</script> + +</head> + +<body onload="init()"> +<h1>Plan</h1> + + + <table> + <tr><td><div id="milestones"></div></td></tr> + <tr><td> + <form name="newWorkItemForm"> + <table> + <tr><td> + <div id=mschoice></div> + </td></tr> + <tr><td> + Add New Milestone <input name="newmsname" type=text/><input type="button" onClick="addMilestone()" value="Add Milestone"> + </td></tr> + <tr><td> + <input type="button" value="Refresh Jira Data" onclick="refreshJiraData()"/> + </td></tr> + </table> + </form> + </td></tr> + </table> + </body> +</html>
\ No newline at end of file diff --git a/sandbox/kgoodson/jagg-webapp/src/main/webapp/META-INF/sca-contribution.xml b/sandbox/kgoodson/jagg-webapp/src/main/webapp/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..9d874181fe --- /dev/null +++ b/sandbox/kgoodson/jagg-webapp/src/main/webapp/META-INF/sca-contribution.xml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * 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. +--> +<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0" + xmlns:store="http://plan"> + <deployable composite="plan:plan"/> +</contribution>
\ No newline at end of file diff --git a/sandbox/kgoodson/jagg-webapp/src/main/webapp/WEB-INF/web.xml b/sandbox/kgoodson/jagg-webapp/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..9c8eb81ae4 --- /dev/null +++ b/sandbox/kgoodson/jagg-webapp/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * 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. +--> +<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5"> + <display-name>sample-jagg-secure-webapp</display-name> + + <filter> + <filter-name>tuscany</filter-name> + <filter-class>org.apache.tuscany.sca.host.webapp.TuscanyServletFilter</filter-class> + </filter> + + <filter-mapping> + <filter-name>tuscany</filter-name> + <url-pattern>/*</url-pattern> + </filter-mapping> + + <welcome-file-list id="WelcomeFileList"> + <welcome-file>plan.html</welcome-file> + </welcome-file-list> +</web-app>
\ No newline at end of file |