diff --git a/src/main/java/org/rometools/feed/module/activitystreams/ActivityStreamModule.java b/src/main/java/org/rometools/feed/module/activitystreams/ActivityStreamModule.java new file mode 100644 index 0000000..73ea810 --- /dev/null +++ b/src/main/java/org/rometools/feed/module/activitystreams/ActivityStreamModule.java @@ -0,0 +1,26 @@ +/* + * Copyright 2011 robert.cooper. + * + * 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. + * under the License. + */ + +package org.rometools.feed.module.activitystreams; + +/** + * + * @author robert.cooper + */ +public interface ActivityStreamModule { + +} diff --git a/src/main/java/org/rometools/feed/module/activitystreams/ActivityStreamModuleImpl.java b/src/main/java/org/rometools/feed/module/activitystreams/ActivityStreamModuleImpl.java new file mode 100644 index 0000000..0f64263 --- /dev/null +++ b/src/main/java/org/rometools/feed/module/activitystreams/ActivityStreamModuleImpl.java @@ -0,0 +1,26 @@ +/* + * Copyright 2011 robert.cooper. + * + * 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. + * under the License. + */ + +package org.rometools.feed.module.activitystreams; + +/** + * + * @author robert.cooper + */ +public class ActivityStreamModuleImpl { + +} diff --git a/src/main/java/org/rometools/feed/module/activitystreams/package.html b/src/main/java/org/rometools/feed/module/activitystreams/package.html new file mode 100644 index 0000000..1e413da --- /dev/null +++ b/src/main/java/org/rometools/feed/module/activitystreams/package.html @@ -0,0 +1,3 @@ + +http://activitystrea.ms/schema/1.0/activity-schema-02.html +http://activitystrea.ms/spec/1.0/atom-activity-02.html \ No newline at end of file diff --git a/src/main/java/org/rometools/feed/module/activitystreams/types/AbstractObject.java b/src/main/java/org/rometools/feed/module/activitystreams/types/AbstractObject.java new file mode 100644 index 0000000..394daaf --- /dev/null +++ b/src/main/java/org/rometools/feed/module/activitystreams/types/AbstractObject.java @@ -0,0 +1,32 @@ +/* + * Copyright 2011 robert.cooper. + * + * 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. + * under the License. + */ + +package org.rometools.feed.module.activitystreams.types; + +import com.sun.syndication.feed.atom.Entry; + +/** + * + * @author robert.cooper + */ +public abstract class AbstractObject extends Entry { + + + public abstract String getTypeIRI(); + + +} diff --git a/src/main/java/org/rometools/feed/module/activitystreams/types/Article.java b/src/main/java/org/rometools/feed/module/activitystreams/types/Article.java new file mode 100644 index 0000000..5dd8b1e --- /dev/null +++ b/src/main/java/org/rometools/feed/module/activitystreams/types/Article.java @@ -0,0 +1,53 @@ +/* + * Copyright 2011 robert.cooper. + * + * 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. + * under the License. + */ +package org.rometools.feed.module.activitystreams.types; + + +/** + *

The "article" Object type indicates that the Object is an + * article, such as a news article, a knowledge base entry, or other + * similar construct. + *

+ *

Articles generally consist of paragraphs of text, in some cases + * incorporating embedded media such as photos and inline hyperlinks to + * other resources. + *

+ *

The "Article" Object type is identified by the URL http://activitystrea.ms/schema/1.0/article. + *

+ *

An article has the following additional components: + *

+ *

+ *
+ *
Name
+ *
The title of the article. Represented by the + * Name component of the base Object Construct. + *
+ *
Content
+ *
The main body content of the article. + * Represented in JSON as a property called content + * whose value is a JSON string containing a fragment of HTML that + * represents the content. + *
+ *
+ * @author robert.cooper + */ +public class Article extends AbstractObject { + @Override + public String getTypeIRI() { + return "http://activitystrea.ms/schema/1.0/article"; + } +} diff --git a/src/main/java/org/rometools/feed/module/activitystreams/types/Audio.java b/src/main/java/org/rometools/feed/module/activitystreams/types/Audio.java new file mode 100644 index 0000000..eaf4239 --- /dev/null +++ b/src/main/java/org/rometools/feed/module/activitystreams/types/Audio.java @@ -0,0 +1,94 @@ +/* + * Copyright 2011 robert.cooper. + * + * 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. + * under the License. + */ + +package org.rometools.feed.module.activitystreams.types; + +/** + *

The "audio" Object type represents audio content. + *

+ *

The "audio" Object type is identified by the URI http://activitystrea.ms/schema/1.0/audio. + *

+ *

An audio has the following additional components: + *

+ *

+ *
+ *
Audio Stream Link
+ *
A Media Link Construct linking + * to the audio content itself. Represented in JSON as a property + * called stream whose value is a JSON + * object with properties as defined in [TODO: xref the JSON + * serialization of a Media Link Construct] + *
+ *
Embed Code
+ *
An HTML fragment that, when embedded in + * an HTML page, will provide an interactive player UI for the + * audio stream. Represented in JSON as a property called embedCode whose value is a JSON string + * containing the fragment of HTML. + *
+ *
+ * @author robert.cooper + */ +public class Audio extends AbstractObject { + + @Override + public String getTypeIRI() { + return "http://activitystrea.ms/schema/1.0/audio"; + } + + + private String embedCode; + + /** + * Get the value of embedCode + * + * @return the value of embedCode + */ + public String getEmbedCode() { + return this.embedCode; + } + + /** + * Set the value of embedCode + * + * @param newembedCode new value of embedCode + */ + public void setEmbedCode(String newembedCode) { + this.embedCode = newembedCode; + } + + + private String streamLink; + + /** + * Get the value of streamLink + * + * @return the value of streamLink + */ + public String getStreamLink() { + return this.streamLink; + } + + /** + * Set the value of streamLink + * + * @param newstreamLink new value of streamLink + */ + public void setStreamLink(String newstreamLink) { + this.streamLink = newstreamLink; + } + +} diff --git a/src/main/java/org/rometools/feed/module/activitystreams/types/Bookmark.java b/src/main/java/org/rometools/feed/module/activitystreams/types/Bookmark.java new file mode 100644 index 0000000..8cf9896 --- /dev/null +++ b/src/main/java/org/rometools/feed/module/activitystreams/types/Bookmark.java @@ -0,0 +1,119 @@ +/* + * Copyright 2011 robert.cooper. + * + * 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. + * under the License. + */ + +package org.rometools.feed.module.activitystreams.types; + +import com.sun.syndication.feed.atom.Link; + + +/** + *

The "bookmark" Object type represents a pointer to some URL -- + * typically a web page. In most cases, a bookmark is specific to a + * given user and contains metadata chosen by that user. Bookmark + * Objects are similar in principle to the concept of bookmarks or + * favorites in a web browser. A bookmark represents a pointer to the + * URL, not the URL or the associated resource itself. + *

+ *

When dealing with bookmarks it is important to note the + * distinction between the title, description, and URL of the bookmark + * itself and the title, content, and URL of the resource that is the + * target of the bookmark. In some implementations these MAY be the + * same, but bookmark managers often allow a user to edit the title and + * description of his or her own bookmarks to differ from the metadata + * on the target itself. + *

+ *

Some implementations refer to this Object type as a "link". This + * specification uses the term "bookmark" to avoid confusion with the + * general concept of hyperlinks which apply to all Object types. + *

+ *

Since bookmarks are often specific to a particular user, even + * though multiple users might have bookmarks pointing at the same + * resource, it is appropriate to use the "post" Verb to describe the + * publication of such a bookmark. The "mark as favorite" Verb SHOULD + * be used when a user flags another user's bookmark as being a + * favorite without creating his own bookmark, or when a user flags his + * own bookmark as being a favorite as a special classification within + * his own bookmark collection. + *

+ *

The "bookmark" Object type is identified by the URI http://activitystrea.ms/schema/1.0/bookmark. + *

+ *

A bookmark has the following additional components: + *

+ *

+ *
+ *
Title
+ *
The title of the bookmark, as entered by the + * user who created the bookmark. Represented by the Name component + * of the base Object Construct. Publishers MAY use the title of + * the target resource as a default for this property where a user + * hasn't entered a customized value. + *
+ *
Target URL
+ *
The URL of the item that is the target + * of the bookmark. Represented in JSON by a property called targetUrl whose value is a JSON string + * containing the target URL. + *
+ *
Thumbnail
+ *
The URL and metadata for a thumbnail + * version of the page. Represented by the Representative Image + * component of the base Object Construct. Processors MAY ignore + * thumbnails that are of an inappropriate size for their user + * interface. + *
+ *
+ * @author robert.cooper + */ +public class Bookmark extends AbstractObject { + + @Override + public String getTypeIRI() { + return "http://activitystrea.ms/schema/1.0/bookmark"; + } + + + + + /** + * Get the value of thumbnail + * + * @return the value of thumbnail + */ + public Link getThumbnail() { + return this.findRelatedLink("thumbnail"); + } + + /** + * Set the value of thumbnail + * + * @param newthumbnail new value of thumbnail + */ + public void setThumbnail(Link newthumbnail) { + Link old = null; + for(Link l : this.getOtherLinks()){ + if("thumbnail".equals(l.getRel())){ + old = l; + break; + } + } + if(old != null){ + this.getOtherLinks().remove(old); + newthumbnail.setRel("thumbnail"); + } + this.getOtherLinks().add(newthumbnail); + } + +} diff --git a/src/main/java/org/rometools/feed/module/activitystreams/types/Comment.java b/src/main/java/org/rometools/feed/module/activitystreams/types/Comment.java new file mode 100644 index 0000000..4302745 --- /dev/null +++ b/src/main/java/org/rometools/feed/module/activitystreams/types/Comment.java @@ -0,0 +1,61 @@ +/* + * Copyright 2011 robert.cooper. + * + * 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. + * under the License. + */ + +package org.rometools.feed.module.activitystreams.types; + +/** + *

The "comment" object type represents a textual response to + * another object. + *

+ *

The comment object type MUST NOT be used for other kinds of + * replies, such as video replies or reviews. + *

+ *

The "comment" object type is identified by the URI http://activitystrea.ms/schema/1.0/comment. + *

+ *

A comment has the following additional components: + *

+ *

+ *
+ *
Subject
+ *
The subject of the comment. Represented by + * the Name component of the base Object Construct. Many systems do + * not have the concept of a title or subject for a comment; such + * systems MUST omit the Name component. Processors SHOULD refer to + * such comments as simply being "a comment", with appropriate + * localization, if they are to be described in a sentence. + *
+ *
Content
+ *
The content of the comment. Represented in + * JSON as a property called content + * whose value is a JSON string containing a fragment of HTML that + * represents the content. Publishers SHOULD include any markup + * necessary to achieve a similar presentation to that on the + * publisher's own HTML pages, including any links that the service + * automatically adds. Processors MAY remove all HTML markup and + * consider the comment to be plain text. + *
+ *
+ * @author robert.cooper + */ +public class Comment extends AbstractObject { + + @Override + public String getTypeIRI() { + return "http://activitystrea.ms/schema/1.0/comment"; + } + +} diff --git a/src/main/java/org/rometools/feed/module/activitystreams/types/File.java b/src/main/java/org/rometools/feed/module/activitystreams/types/File.java new file mode 100644 index 0000000..cbc3777 --- /dev/null +++ b/src/main/java/org/rometools/feed/module/activitystreams/types/File.java @@ -0,0 +1,59 @@ +/* + * Copyright 2011 robert.cooper. + * + * 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. + * under the License. + */ + +package org.rometools.feed.module.activitystreams.types; + +/** + *

The "file" Object type represents some document or other file + * with no additional machine-readable semantics. + *

+ *

It is intended that this type be used as a base type for other + * Objects that manifest as files, so that additional semantics can be + * added while providing a fallback ability for clients that do not + * support the more specific Object type. + *

+ *

The "file" Object type is identified by the URI http://activitystrea.ms/schema/1.0/file. + *

+ *

A file has the following additional components: + *

+ *

+ *
+ *
Associated File URL
+ *
The URL of the file described + * by this Object Construct. Represented in JSON by a property + * called fileUrl whose value is a JSON + * string containing the URL. + *
+ *
File MIME Type
+ *
The MIME type of the file described + * by this Object Construct. Represented in JSON by a property + * called mimeType whose value is a + * JSON string containing the MIME type. + *
+ *
+ * @author robert.cooper + */ +public class File extends AbstractObject { + + @Override + public String getTypeIRI() { + return "http://activitystrea.ms/schema/1.0/file"; + } + + + +} diff --git a/src/main/java/org/rometools/feed/module/activitystreams/types/Folder.java b/src/main/java/org/rometools/feed/module/activitystreams/types/Folder.java new file mode 100644 index 0000000..cbc7cf1 --- /dev/null +++ b/src/main/java/org/rometools/feed/module/activitystreams/types/Folder.java @@ -0,0 +1,49 @@ +/* + * Copyright 2011 robert.cooper. + * + * 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. + * under the License. + */ + +package org.rometools.feed.module.activitystreams.types; + +/** + *

The "folder" object type represents a collection of files or + * media objects. This is similar to the "photo album" object type, but + * not specifically representing a collection of "photos." + *

+ *

The "folder" object type is identified by the URI http://activitystrea.ms/schema/1.0/folder. + *

+ *

A folder has the following additional components: + *

+ *

+ *
+ *
Preview Image Link
+ *
A Media Link Construct + * describing an image file that can be used as a preview image for + * the folder. Represented by the Representative Image component of + * the base Object Construct. Processors MAY ignore thumbnails that + * are of an inappropriate size for their user interface. + *
+ *
+ * @author robert.cooper + */ +public class Folder extends AbstractObject{ + + @Override + public String getTypeIRI() { + return "http://activitystrea.ms/schema/1.0/folder"; + } + + +} diff --git a/src/main/java/org/rometools/feed/module/activitystreams/types/Group.java b/src/main/java/org/rometools/feed/module/activitystreams/types/Group.java new file mode 100644 index 0000000..663848e --- /dev/null +++ b/src/main/java/org/rometools/feed/module/activitystreams/types/Group.java @@ -0,0 +1,32 @@ +/* + * Copyright 2011 robert.cooper. + * + * 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. + * under the License. + */ + +package org.rometools.feed.module.activitystreams.types; + +/** + *

The "group" Object type represents a social networking group. A + * group is a collection of people which people can join and leave. + *

+ *

The "group" Object type is identified by the URI http://activitystrea.ms/schema/1.0/group. + *

+ *

A group has no additional components. + + * @author robert.cooper + */ +public class Group { + +} diff --git a/src/main/java/org/rometools/feed/module/activitystreams/types/List.java b/src/main/java/org/rometools/feed/module/activitystreams/types/List.java new file mode 100644 index 0000000..c781559 --- /dev/null +++ b/src/main/java/org/rometools/feed/module/activitystreams/types/List.java @@ -0,0 +1,39 @@ +/* + * Copyright 2011 robert.cooper. + * + * 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. + * under the License. + */ + +package org.rometools.feed.module.activitystreams.types; + +/** + *

The "list" object type represents a collection of related + * objects. + *

+ *

The "list" object type is identified by the URI http://activitystrea.ms/schema/1.0/list. + *

+ *

A list has no additional components. + *

+ + * @author robert.cooper + */ +public class List extends AbstractObject +{ + + @Override + public String getTypeIRI() { + return "http://activitystrea.ms/schema/1.0/list"; + } + +} diff --git a/src/main/java/org/rometools/feed/module/activitystreams/types/Note.java b/src/main/java/org/rometools/feed/module/activitystreams/types/Note.java new file mode 100644 index 0000000..46f8398 --- /dev/null +++ b/src/main/java/org/rometools/feed/module/activitystreams/types/Note.java @@ -0,0 +1,59 @@ +/* + * Copyright 2011 robert.cooper. + * + * 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. + * under the License. + */ + +package org.rometools.feed.module.activitystreams.types; + +/** + *

The "note" Object type represents short-form text messages. This + * Object type is intended for use in "micro-blogging" and in systems + * where users are invited to publish short, often plain-text messages + * whose useful lifespan is generally shorter than that of an article + * or weblog entry. + *

+ *

A note is similar in structure to an article, but it does not + * have a title and its body tends to be shorter. Applications will + * often display the entire content of a note in an activity stream UI, + * whereas they MAY display only the title or the title and summary for + * a weblog entry. + *

+ *

The "note" Object type is identified by the URI http://activitystrea.ms/schema/1.0/note. + *

+ *

A note has the following additional components: + *

+ *

+ *
+ *
Content
+ *
The content of the comment. Represented in + * JSON as a property called content + * whose value is a JSON string containing a fragment of HTML that + * represents the content. Publishers SHOULD include any markup + * necessary to achieve a similar presentation to that on the + * publisher's own HTML pages, including any links that the service + * automatically adds. Processors MAY remove all HTML markup and + * consider the comment to be plain text. + *
+ *
+ * @author robert.cooper + */ +public class Note extends AbstractObject { + + @Override + public String getTypeIRI() { + return "http://activitystrea.ms/schema/1.0/note"; + } + +} diff --git a/src/main/java/org/rometools/feed/module/activitystreams/types/Person.java b/src/main/java/org/rometools/feed/module/activitystreams/types/Person.java new file mode 100644 index 0000000..ca7c9c8 --- /dev/null +++ b/src/main/java/org/rometools/feed/module/activitystreams/types/Person.java @@ -0,0 +1,84 @@ +/* + * Copyright 2011 robert.cooper. + * + * 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. + * under the License. + */ + +package org.rometools.feed.module.activitystreams.types; + +import com.sun.syndication.feed.atom.Link; + +/** + *

The "person" Object type represents a user account. This is often + represents a person, but might also be a company or fictitious + * character that is being represented by a user account. + *

+ *

The "person" Object type is identified by the URI http://activitystrea.ms/schema/1.0/person. + *

+ *

A person has the following additional components: + *

+ *

+ *
+ *
Display Name
+ *
A name that can be used for the + * person in the user interface. This is often a name by which the + * individual is known in a given context; no restriction is placed + * on what kind of name may be used here. Represented by the Name + * component of the base Object Construct. + *
+ *
Avatar
+ *
A link to an "avatar" or "userpic" image + * for the user. Represented by the Representative Image component + * of the base Object Construct. + *
+ *
+ @author robert.cooper + */ +public class Person extends AbstractObject { + + @Override + public String getTypeIRI() { + return "http://activitystrea.ms/schema/1.0/person"; + } + + + + /** + * Get the value of avatar + * + * @return the value of avatar + */ + public Link getAvatar() { + Link result = this.findRelatedLink("avatar"); + if(result != null){ + return result; + } + return this.findRelatedLink("userpic"); + } + + /** + * Set the value of avatar + * + * @param newavatar new value of avatar + */ + public void setAvatar(Link newavatar) { + Link old = this.getAvatar(); + if(old != null){ + this.getOtherLinks().remove(old); + } + newavatar.setRel("avatar"); + this.getOtherLinks().add(newavatar); + } + +} diff --git a/src/main/java/org/rometools/feed/module/activitystreams/types/Verb.java b/src/main/java/org/rometools/feed/module/activitystreams/types/Verb.java new file mode 100644 index 0000000..e6b1454 --- /dev/null +++ b/src/main/java/org/rometools/feed/module/activitystreams/types/Verb.java @@ -0,0 +1,152 @@ +/* + * Copyright 2011 robert.cooper. + * + * 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. + * under the License. + */ +package org.rometools.feed.module.activitystreams.types; + +import java.util.HashMap; +import java.util.Map; + + +/** + * + * @author robert.cooper + */ +public enum Verb { + /** + * The "mark as favorite" Verb indicates that the Subject marked the Object as an item of + * special interest. Objects so marked often appear in a collection of such Objects which + * MAY be published as a feed of entries annotated with this Verb. + * If a particular service uses favorites as a mechanism by which a user can recall + * items that were earlier marked, it MAY be appropriate to also mark activities of + * this type with the "save" Verb as described in Section 3.1.8. + * The verb URI for the "mark as favorite" Verb is http://activitystrea.ms/schema/1.0/favorite. + */ + MARK_AS_FAVORITE("http://activitystrea.ms/schema/1.0/favorite"), + /** + * The "start following" Verb indicates that the Subject began following the activity + * of the Object. In most cases, the Object of this Verb will be a user, but it can + * potentially be of any type that can sensibly generate activity. + * + * The verb URI for the "start following" Verb is http://activitystrea.ms/schema/1.0/follow. + * + * Processors MAY ignore (silently drop) successive identical "start following" activities + * regardless of whether they maintain state sufficient to determine (A), (B), or (C) above. + */ + START_FOLLOWING("http://activitystrea.ms/schema/1.0/follow"), + /** + * The "mark as liked" verb indicates that the actor indicated that it likes the object. + * + * The verb URI for the "mark as liked" Verb is http://activitystrea.ms/schema/1.0/like. + */ + MARK_AS_LIKED("http://activitystrea.ms/schema/1.0/like"), + /** + * The "make friend" Verb indicates the creation of a friendship that is reciprocated by the object. + * + * Since this verb implies an activity on the part of its object, processors MUST NOT accept + * activities with this Verb unless they are able to verify through some external means that + * there is in fact a reciprocated connection. For example, a processor MAY have received a + * guarantee from a particular publisher that the publisher will only use this Verb in cases + * where a reciprocal relationship exists. + * + * The verb URI for the "make friend" Verb is http://activitystrea.ms/schema/1.0/make-friend. + */ + MAKE_FRIEND("http://activitystrea.ms/schema/1.0/make-friend"), + /** + * The "join" Verb indicates that the actor has become a member of the Object. + * This specification only defines the meaning of this Verb when its Object is a Group, + * though implementors SHOULD be prepared to handle other Object types as meaning + * MAY be provided by extension specifications. + * + * Processors MAY ignore (silently drop) successive identical "join" activities + * regardless of whether they maintain state sufficient to determine (A) or (B) above. + * + * The "join" Verb is identified by the URI http://activitystrea.ms/schema/1.0/join. + */ + JOIN("http://activitystrea.ms/schema/1.0/join"), + /** + * The "play" verb indicates that the subject spent some time enjoying the object. + * For example, if the object is a video this indicates that the subject watched all or part of the video. + * + * The "play" Verb is identified by the URI http://activitystrea.ms/schema/1.0/play. + */ + PLAY("http://activitystrea.ms/schema/1.0/play"), + /** + * The "Post" Verb is described in section 8 of the AtomActivity specification. + * It is only referenced here for completeness. + * + * http://activitystrea.ms/schema/1.0/post + */ + POST("http://activitystrea.ms/schema/1.0/post"), + /** + * The "save" Verb indicates that the Subject has called out the Object as being of + * interest primarily to him- or herself. Though this action MAY be shared publicly, + * the implication is that the Object has been saved primarily for the actor's own + * benefit rather than to show it to others as would be indicated by the "share" + * Verb (Section 3.1.9). + * + * The "save" Verb is identified by the URI http://activitystrea.ms/schema/1.0/save. + */ + SAVE("http://activitystrea.ms/schema/1.0/save"), + /** + * The "share" Verb indicates that the Subject has called out the Object to readers. + * In most cases, the actor did not create the Object being shared, but is instead + * drawing attention to it. + * + * The "share" Verb is identified by the URI http://activitystrea.ms/schema/1.0/share. + */ + SHARE("http://activitystrea.ms/schema/1.0/share"), + /** + * The "tag" verb indicates that the actor has identified the presence of a target + * inside another object. For example, the actor may have specified that a particular + * user appears in a photo. + * + * The "tag" verb is identified by the URI http://activitystrea.ms/schema/1.0/tag. + * + * The target of the "tag" verb gives the object in which the tag has been added. + * For example, if a user appears in a photo, the activity:object is the user and + * the activity:target is the photo. + */ + TAG("http://activitystrea.ms/schema/1.0/tag"), + /** + * The "update" Verb indicates that the Subject has modified the referenced Object. + * + * Implementors SHOULD use verbs such as Section 3.1.7 where the Subject is adding + * new items to a Section 3.2.8 or similar. Update is reserved for modifications + * to existing Objects or data such as changing a user's profile information. + * + * The "update" Verb is identified by the URI http://activitystrea.ms/schema/1.0/update. + */ + UPDATE("http://activitystrea.ms/schema/1.0/update"); + private final String iri; + + Verb(final String iri){ + this.iri = iri; + } + + @Override + public String toString(){ + return iri; + } + + public static Verb fromIRI(String iri){ + for(Verb v: Verb.values()){ + if(v.toString().equals(iri)){ + return v; + } + } + return null; + } +} diff --git a/src/main/java/org/rometools/feed/module/feedburner/FeedBurner.java b/src/main/java/org/rometools/feed/module/feedburner/FeedBurner.java new file mode 100644 index 0000000..3da1200 --- /dev/null +++ b/src/main/java/org/rometools/feed/module/feedburner/FeedBurner.java @@ -0,0 +1,47 @@ +/* + * Copyright 2011 robert.cooper. + * + * 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. + * under the License. + */ + +package org.rometools.feed.module.feedburner; + +import java.io.Serializable; + +import com.sun.syndication.feed.module.Module; + +/** + * Interface for the FeedBurner RSS extension. + * + * @version 1.0 + * @author Georg Schmidl + * + */ +public interface FeedBurner extends Module, Serializable, Cloneable { + + public static final String URI = "http://rssnamespace.org/feedburner/ext/1.0"; + + public String getAwareness(); + + public void setAwareness(String awareness); + + public String getOrigLink(); + + public void setOrigLink(String origLink); + + public String getOrigEnclosureLink(); + + public void setOrigEnclosureLink(String origEnclosureLink); + +} diff --git a/src/main/java/org/rometools/feed/module/feedburner/FeedBurnerImpl.java b/src/main/java/org/rometools/feed/module/feedburner/FeedBurnerImpl.java new file mode 100644 index 0000000..925a7f9 --- /dev/null +++ b/src/main/java/org/rometools/feed/module/feedburner/FeedBurnerImpl.java @@ -0,0 +1,81 @@ +/* + * Copyright 2010 Scandio GmbH. + * + * 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. + * + */ + +package org.rometools.feed.module.feedburner; + +import com.sun.syndication.feed.CopyFrom; + +/** + * Implementation of the FeedBurner RSS extension. + * + * @version 1.0 + * @author Georg Schmidl + * + */ +public class FeedBurnerImpl implements FeedBurner { + + private static final long serialVersionUID = 4595722221441468838L; + + private String awareness; + private String origLink; + private String origEnclosureLink; + + public String getAwareness() { + return awareness; + } + + public void setAwareness(String awareness) { + this.awareness = awareness; + } + + public String getOrigLink() { + return origLink; + } + + public void setOrigLink(String origLink) { + this.origLink = origLink; + } + + public String getOrigEnclosureLink() { + return origEnclosureLink; + } + + public void setOrigEnclosureLink(String origEnclosureLink) { + this.origEnclosureLink = origEnclosureLink; + } + + public String getUri() { + return FeedBurner.URI; + } + + public void copyFrom(CopyFrom object) { + FeedBurner source = (FeedBurner) object; + this.setAwareness(source.getAwareness()); + this.setOrigLink(source.getOrigLink()); + this.setOrigEnclosureLink(source.getOrigEnclosureLink()); + } + + public Class getInterface() { + return FeedBurner.class; + } + + public Object clone() { + FeedBurnerImpl fbi = new FeedBurnerImpl(); + fbi.copyFrom( this ); + return fbi; + } +} diff --git a/src/main/java/org/rometools/feed/module/feedburner/io/FeedBurnerModuleGenerator.java b/src/main/java/org/rometools/feed/module/feedburner/io/FeedBurnerModuleGenerator.java new file mode 100644 index 0000000..15fbb4e --- /dev/null +++ b/src/main/java/org/rometools/feed/module/feedburner/io/FeedBurnerModuleGenerator.java @@ -0,0 +1,78 @@ +/* + * Copyright 2010 Scandio GmbH. + * + * 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. + * + */ +package org.rometools.feed.module.feedburner.io; + +import com.sun.syndication.feed.module.Module; +import com.sun.syndication.io.ModuleGenerator; + +import org.jdom.Element; +import org.jdom.Namespace; + +import org.rometools.feed.module.feedburner.FeedBurner; + +import java.util.HashSet; +import java.util.Set; + + +/** + * ModuleGenerator implementation for the FeedBurner RSS extension. + * + * @version 1.0 + * @author Georg Schmidl + * + */ +public class FeedBurnerModuleGenerator implements ModuleGenerator { + private static final Namespace NS = Namespace.getNamespace("feedburner", FeedBurner.URI); + + public String getNamespaceUri() { + return FeedBurner.URI; + } + + public Set getNamespaces() { + HashSet set = new HashSet(); + set.add(FeedBurnerModuleGenerator.NS); + + return set; + } + + public void generate(Module module, Element element) { + if (!(module instanceof FeedBurner)) { + return; + } + + FeedBurner feedBurner = (FeedBurner) module; + + if (feedBurner.getAwareness() != null) { + element.addContent(this.generateSimpleElement("awareness", feedBurner.getAwareness())); + } + + if (feedBurner.getOrigLink() != null) { + element.addContent(this.generateSimpleElement("origLink", feedBurner.getOrigLink())); + } + + if (feedBurner.getOrigEnclosureLink() != null) { + element.addContent(this.generateSimpleElement("origEnclosureLink", feedBurner.getOrigEnclosureLink())); + } + } + + protected Element generateSimpleElement(String name, String value) { + Element element = new Element(name, FeedBurnerModuleGenerator.NS); + element.addContent(value); + + return element; + } +} diff --git a/src/main/java/org/rometools/feed/module/feedburner/io/FeedBurnerModuleParser.java b/src/main/java/org/rometools/feed/module/feedburner/io/FeedBurnerModuleParser.java new file mode 100644 index 0000000..3a0b6e4 --- /dev/null +++ b/src/main/java/org/rometools/feed/module/feedburner/io/FeedBurnerModuleParser.java @@ -0,0 +1,73 @@ +/* + * Copyright 2010 Scandio GmbH. + * + * 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. + * + */ +package org.rometools.feed.module.feedburner.io; + +import com.sun.syndication.feed.module.Module; +import com.sun.syndication.io.ModuleParser; + +import org.jdom.Element; +import org.jdom.Namespace; + +import org.rometools.feed.module.feedburner.FeedBurner; +import org.rometools.feed.module.feedburner.FeedBurnerImpl; + + +/** + * ModuleParser implementation for the FeedBurner RSS extension. + * + * @version 1.0 + * @author Georg Schmidl + * + */ +public class FeedBurnerModuleParser implements ModuleParser { + private static final Namespace NS = Namespace.getNamespace(FeedBurner.URI); + + public String getNamespaceUri() { + return FeedBurner.URI; + } + + public Module parse(Element element) { + FeedBurnerImpl fbi = new FeedBurnerImpl(); + boolean returnObj = false; + Element tag = element.getChild("awareness", FeedBurnerModuleParser.NS); + + if (tag != null) { + fbi.setAwareness(tag.getText().trim()); + returnObj = true; + } + + tag = element.getChild("origLink", FeedBurnerModuleParser.NS); + + if (tag != null) { + fbi.setOrigLink(tag.getText().trim()); + returnObj = true; + } + + tag = element.getChild("origEnclosureLink", FeedBurnerModuleParser.NS); + + if (tag != null) { + fbi.setOrigEnclosureLink(tag.getText().trim()); + returnObj = true; + } + + if (returnObj) { + return fbi; + } + + return null; + } +} diff --git a/src/main/java/org/rometools/feed/module/feedburner/package.html b/src/main/java/org/rometools/feed/module/feedburner/package.html new file mode 100644 index 0000000..46822a8 --- /dev/null +++ b/src/main/java/org/rometools/feed/module/feedburner/package.html @@ -0,0 +1,30 @@ + + + + + + + + + +
+ * This library is provided under dual licenses.
+ * You may choose the terms of the Lesser General Public License or the Apache
+ * License at your discretion.
+ *
+ *  Copyright (C) 2011 The ROME Team
+ *
+ * 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.
+    
+ + \ No newline at end of file diff --git a/src/main/java/org/rometools/feed/module/portablecontacts/package.html b/src/main/java/org/rometools/feed/module/portablecontacts/package.html new file mode 100644 index 0000000..c2f8fc6 --- /dev/null +++ b/src/main/java/org/rometools/feed/module/portablecontacts/package.html @@ -0,0 +1 @@ +http://portablecontacts.net/draft-spec.html \ No newline at end of file diff --git a/src/test/java/org/rometools/feed/module/activitystreams/types/VerbTest.java b/src/test/java/org/rometools/feed/module/activitystreams/types/VerbTest.java new file mode 100644 index 0000000..5eb4b0c --- /dev/null +++ b/src/test/java/org/rometools/feed/module/activitystreams/types/VerbTest.java @@ -0,0 +1,56 @@ +/* + * Copyright 2011 robert.cooper. + * + * 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. + * under the License. + */ + +package org.rometools.feed.module.activitystreams.types; + +import junit.framework.TestCase; + +/** + * + * @author robert.cooper + */ +public class VerbTest extends TestCase { + + public VerbTest(String testName) { + super(testName); + } + + @Override + protected void setUp() throws Exception { + super.setUp(); + } + + @Override + protected void tearDown() throws Exception { + super.tearDown(); + } + + + + /** + * Test of valueOf method, of class Verb. + */ + public void testValueOf() { + System.out.println("valueOf"); + String fav = Verb.MARK_AS_FAVORITE.toString(); + assertEquals("http://activitystrea.ms/schema/1.0/favorite", fav); + assertEquals(Verb.MARK_AS_FAVORITE, Verb.fromIRI(fav)); + } + + + +}