diff options
author | kelvingoodson <kelvingoodson@13f79535-47bb-0310-9956-ffa450edef68> | 2010-02-24 11:20:43 +0000 |
---|---|---|
committer | kelvingoodson <kelvingoodson@13f79535-47bb-0310-9956-ffa450edef68> | 2010-02-24 11:20:43 +0000 |
commit | 195bd9804056816bb761e20b04799fc05d75d737 (patch) | |
tree | c6b3c9061b1e6994f4bff5d6c1d2445f1e9fbbab /sandbox/kgoodson/jagg-webapp | |
parent | f6376ab7135234b07ff2fc435ca034ad12eee41f (diff) |
try webapp variant of jira app
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@915751 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sandbox/kgoodson/jagg-webapp')
12 files changed, 1250 insertions, 0 deletions
diff --git a/sandbox/kgoodson/jagg-webapp/build.xml b/sandbox/kgoodson/jagg-webapp/build.xml new file mode 100644 index 0000000000..e186df80e8 --- /dev/null +++ b/sandbox/kgoodson/jagg-webapp/build.xml @@ -0,0 +1,79 @@ +<!-- + * 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. +--> +<project name="jagg" default="compile"> + <property name="test.class" value="launch.Launch" /> + <property name="test.jar" value="sample-jagg.jar" /> + + <target name="init"> + <mkdir dir="target/classes"/> + </target> + + <target name="compile" depends="init"> + <javac srcdir="src/main/java" + destdir="target/classes" + debug="on" + source="1.5" + target="1.5"> + <classpath> + <pathelement location="../../lib/tuscany-sca-manifest.jar"/> + <fileset refid="3rdparty.jars"/> + </classpath> + </javac> + <copy todir="target/classes"> + <fileset dir="src/main/resources"/> + </copy> + <jar destfile="target/${test.jar}" basedir="target/classes"> + <manifest> + <attribute name="Main-Class" value="${test.class}" /> + </manifest> + </jar> + </target> + + <target name="run-classes"> + <java classname="${test.class}" + fork="true"> + <classpath> + <pathelement path="target/classes"/> + <pathelement location="../../lib/tuscany-sca-manifest.jar"/> + <fileset refid="3rdparty.jars"/> + </classpath> + </java> + </target> + + <target name="run"> + <java classname="${test.class}" + fork="true"> + <classpath> + <pathelement path="target/${test.jar}"/> + <pathelement location="../../lib/tuscany-sca-manifest.jar"/> + <fileset refid="3rdparty.jars"/> + </classpath> + </java> + </target> + + <target name="clean"> + <delete quiet="true" includeemptydirs="true"> + <fileset dir="target"/> + </delete> + </target> + + <fileset id="3rdparty.jars" dir="../../lib"> + <include name="saxon-8.7.jar"/> + </fileset> +</project> diff --git a/sandbox/kgoodson/jagg-webapp/pom.xml b/sandbox/kgoodson/jagg-webapp/pom.xml new file mode 100644 index 0000000000..69e7fca7cd --- /dev/null +++ b/sandbox/kgoodson/jagg-webapp/pom.xml @@ -0,0 +1,266 @@ +<?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. +--> +<project> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-sca</artifactId> + <version>2.0-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + <artifactId>sample-jagg-webapp</artifactId> + <name>Apache Tuscany SCA Sample JIRA Aggregator</name> + <packaging>war</packaging> + + <repositories> + + <repository> + <id>apache.incubator</id> + <url>http://people.apache.org/repo/m2-incubating-repository</url> + </repository> + </repositories> + + <build> + <pluginManagement> + <plugins> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>jaxb2-maven-plugin</artifactId> + <version>1.3</version> + </plugin> + </plugins> + </pluginManagement> + <plugins> + + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-dependency-plugin</artifactId> + <executions> + <execution> + <id>copy</id> + <phase>generate-sources</phase> + <goals> + <goal>copy</goal> + </goals> + <configuration> + <artifactItems> + <artifactItem> + <groupId>javax.xml.bind</groupId> + <artifactId>jaxb-api</artifactId> + <version>2.1</version> + <type>jar</type> + </artifactItem> + </artifactItems> + <outputDirectory>${project.build.directory}/endorsed</outputDirectory> + <overWriteReleases>false</overWriteReleases> + <overWriteSnapshots>true</overWriteSnapshots> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <configuration> + <compilerArgument>-Djava.endorsed.dirs=target/endorsed</compilerArgument> + </configuration> + </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>build-helper-maven-plugin</artifactId> + <version>1.0</version> + <executions> + + <execution> + <id>add-source</id> + <phase>generate-sources</phase> + <goals> + <goal>add-source</goal> + </goals> + <configuration> + <sources> + <source>target/jaxb-source</source> + </sources> + </configuration> + </execution> + </executions> + </plugin> + + <plugin> + <groupId>org.jvnet.jaxb2.maven2</groupId> + <artifactId>maven-jaxb2-plugin</artifactId> + <version>0.7.1</version> + <executions> + <execution> + <id>generate-jaxb</id> + <phase>generate-sources</phase> + <goals> + <goal>generate</goal> + </goals> + </execution> + </executions> + <configuration> + <generatePackage>com.example.ipo.jaxb</generatePackage> + <generateDirectory>${project.build.directory}/jaxb-source</generateDirectory> + <schemaDirectory>${basedir}/src/main/resources</schemaDirectory> + <schemaIncludes> + <!-- <include>ipo.xsd</include>--> + <include>JiraSideband.xsd</include> + <include>JiraRSS.xsd</include> + </schemaIncludes> + </configuration> + </plugin> + + </plugins> + <finalName>${artifactId}</finalName> + </build> + + + <dependencies> + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + + <artifactId>tuscany-node-impl</artifactId> + <version>2.0-SNAPSHOT</version> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-data-api</artifactId> + <version>2.0-SNAPSHOT</version> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-java-runtime</artifactId> + <version>2.0-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-widget-runtime-dojo</artifactId> + <version>2.0-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-binding-atom-runtime</artifactId> + <version>2.0-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-binding-atom-js-dojo</artifactId> + <version>2.0-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-binding-jsonrpc-runtime</artifactId> + <version>2.0-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-binding-jsonrpc-js-dojo</artifactId> + <version>2.0-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-binding-http-runtime</artifactId> + <version>2.0-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-host-jetty</artifactId> + <version>2.0-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.5</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>rome</groupId> + <artifactId>rome</artifactId> + <version>1.0</version> + </dependency> + <dependency> + <groupId>javax.xml.bind</groupId> + <artifactId>jaxb-api</artifactId> + <version>2.0</version> + </dependency> + + <dependency> + <groupId>com.sun.xml.bind</groupId> + <artifactId>jaxb-impl</artifactId> + <version>2.0.3</version> + </dependency> + <dependency> + <groupId>org.jvnet.jaxb2_commons</groupId> + <artifactId>runtime</artifactId> + <version>0.4.1</version> + </dependency> + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-binding-http-runtime</artifactId> + <version>2.0-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-host-jetty</artifactId> + <version>2.0-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>net.sourceforge.htmlunit</groupId> + <artifactId>htmlunit</artifactId> + <version>2.6</version> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>org.jvnet.jaxb2_commons</groupId> + <artifactId>testing</artifactId> + <version>0.4.1</version> + <scope>test</scope> + </dependency> + + + </dependencies> + + + +</project> 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 |