Early work on new modules.

This commit is contained in:
kebernet 2011-04-02 01:13:06 +00:00
parent 68dfd1a3b1
commit 6988e05ac7
22 changed files with 1254 additions and 0 deletions

View file

@ -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 {
}

View file

@ -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 {
}

View file

@ -0,0 +1,3 @@
http://activitystrea.ms/schema/1.0/activity-schema-02.html
http://activitystrea.ms/spec/1.0/atom-activity-02.html

View file

@ -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();
}

View file

@ -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;
/**
* <p>The "article" Object type indicates that the Object is an
* article, such as a news article, a knowledge base entry, or other
* similar construct.
*</p>
*<p>Articles generally consist of paragraphs of text, in some cases
* incorporating embedded media such as photos and inline hyperlinks to
* other resources.
*</p>
*<p>The "Article" Object type is identified by the URL <tt>http://activitystrea.ms/schema/1.0/article</tt>.
*</p>
*<p>An article has the following additional components:
*</p>
*<p></p>
*<blockquote class="text"><dl>
*<dt>Name</dt>
*<dd>The title of the article. Represented by the
* Name component of the base Object Construct.
*</dd>
*<dt>Content</dt>
*<dd>The main body content of the article.
* Represented in JSON as a property called <tt>content</tt>
* whose value is a JSON string containing a fragment of HTML that
* represents the content.
*</dd>
*</dl></blockquote>
* @author robert.cooper
*/
public class Article extends AbstractObject {
@Override
public String getTypeIRI() {
return "http://activitystrea.ms/schema/1.0/article";
}
}

View file

@ -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;
/**
* <p>The "audio" Object type represents audio content.
*</p>
*<p>The "audio" Object type is identified by the URI <tt>http://activitystrea.ms/schema/1.0/audio</tt>.
*</p>
*<p>An audio has the following additional components:
*</p>
*<p></p>
*<blockquote class="text"><dl>
*<dt>Audio Stream Link</dt>
*<dd>A Media Link Construct linking
* to the audio content itself. Represented in JSON as a property
* called <tt>stream</tt> whose value is a JSON
* object with properties as defined in [TODO: xref the JSON
* serialization of a Media Link Construct]
*</dd>
*<dt>Embed Code</dt>
*<dd>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 <tt>embedCode</tt> whose value is a JSON string
* containing the fragment of HTML.
*</dd>
*</dl>
* @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;
}
}

View file

@ -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;
/**
* <p>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.
*</p>
*<p>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.
*</p>
*<p>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.
*</p>
*<p>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.
*</p>
*<p>The "bookmark" Object type is identified by the URI <tt>http://activitystrea.ms/schema/1.0/bookmark</tt>.
*</p>
*<p>A bookmark has the following additional components:
*</p>
*<p></p>
*<blockquote class="text"><dl>
*<dt>Title</dt>
*<dd>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.
*</dd>
*<dt>Target URL</dt>
*<dd>The URL of the item that is the target
* of the bookmark. Represented in JSON by a property called <tt>targetUrl</tt> whose value is a JSON string
* containing the target URL.
*</dd>
*<dt>Thumbnail</dt>
*<dd>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.
*</dd>
*</dl></blockquote>
* @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);
}
}

View file

@ -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;
/**
* <p>The "comment" object type represents a textual response to
* another object.
*</p>
*<p>The comment object type MUST NOT be used for other kinds of
* replies, such as video replies or reviews.
*</p>
*<p>The "comment" object type is identified by the URI <tt>http://activitystrea.ms/schema/1.0/comment</tt>.
*</p>
*<p>A comment has the following additional components:
*</p>
*<p></p>
*<blockquote class="text"><dl>
*<dt>Subject</dt>
*<dd>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.
*</dd>
*<dt>Content</dt>
*<dd>The content of the comment. Represented in
* JSON as a property called <tt>content</tt>
* 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.
*</dd>
*</dl></blockquote>
* @author robert.cooper
*/
public class Comment extends AbstractObject {
@Override
public String getTypeIRI() {
return "http://activitystrea.ms/schema/1.0/comment";
}
}

View file

@ -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;
/**
* <p>The "file" Object type represents some document or other file
* with no additional machine-readable semantics.
*</p>
*<p>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.
*</p>
*<p>The "file" Object type is identified by the URI <tt>http://activitystrea.ms/schema/1.0/file</tt>.
*</p>
*<p>A file has the following additional components:
*</p>
*<p></p>
*<blockquote class="text"><dl>
*<dt>Associated File URL</dt>
*<dd>The URL of the file described
* by this Object Construct. Represented in JSON by a property
* called <tt>fileUrl</tt> whose value is a JSON
* string containing the URL.
*</dd>
*<dt>File MIME Type</dt>
*<dd>The MIME type of the file described
* by this Object Construct. Represented in JSON by a property
* called <tt>mimeType</tt> whose value is a
* JSON string containing the MIME type.
*</dd>
*</dl></blockquote>
* @author robert.cooper
*/
public class File extends AbstractObject {
@Override
public String getTypeIRI() {
return "http://activitystrea.ms/schema/1.0/file";
}
}

View file

@ -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;
/**
* <p>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."
*</p>
*<p>The "folder" object type is identified by the URI <tt>http://activitystrea.ms/schema/1.0/folder</tt>.
*</p>
*<p>A folder has the following additional components:
*</p>
*<p></p>
*<blockquote class="text"><dl>
*<dt>Preview Image Link</dt>
*<dd>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.
*</dd>
*</dl></blockquote>
* @author robert.cooper
*/
public class Folder extends AbstractObject{
@Override
public String getTypeIRI() {
return "http://activitystrea.ms/schema/1.0/folder";
}
}

View file

@ -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;
/**
* <p>The "group" Object type represents a social networking group. A
* group is a collection of people which people can join and leave.
*</p>
*<p>The "group" Object type is identified by the URI <tt>http://activitystrea.ms/schema/1.0/group</tt>.
*</p>
*<p>A group has no additional components.
* @author robert.cooper
*/
public class Group {
}

View file

@ -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;
/**
*<p>The "list" object type represents a collection of related
* objects.
*</p>
*<p>The "list" object type is identified by the URI <tt>http://activitystrea.ms/schema/1.0/list</tt>.
*</p>
*<p>A list has no additional components.
*</p>
* @author robert.cooper
*/
public class List extends AbstractObject
{
@Override
public String getTypeIRI() {
return "http://activitystrea.ms/schema/1.0/list";
}
}

View file

@ -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;
/**
*<p>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.
*</p>
*<p>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.
*</p>
*<p>The "note" Object type is identified by the URI <tt>http://activitystrea.ms/schema/1.0/note</tt>.
*</p>
*<p>A note has the following additional components:
*</p>
*<p></p>
*<blockquote class="text"><dl>
*<dt>Content</dt>
*<dd>The content of the comment. Represented in
* JSON as a property called <tt>content</tt>
* 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.
*</dd>
*</dl></blockquote>
* @author robert.cooper
*/
public class Note extends AbstractObject {
@Override
public String getTypeIRI() {
return "http://activitystrea.ms/schema/1.0/note";
}
}

View file

@ -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;
/**
* <p>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.
*</p>
*<p>The "person" Object type is identified by the URI <tt>http://activitystrea.ms/schema/1.0/person</tt>.
*</p>
*<p>A person has the following additional components:
*</p>
*<p></p>
*<blockquote class="text"><dl>
*<dt>Display Name</dt>
*<dd>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.
*</dd>
*<dt>Avatar</dt>
*<dd>A link to an "avatar" or "userpic" image
* for the user. Represented by the Representative Image component
* of the base Object Construct.
*</dd>
*</dl></blockquote>
@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);
}
}

View file

@ -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;
}
}

View file

@ -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 <georg.schmidl@scandio.de>
*
*/
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);
}

View file

@ -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 <georg.schmidl@scandio.de>
*
*/
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;
}
}

View file

@ -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 <georg.schmidl@scandio.de>
*
*/
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;
}
}

View file

@ -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 <georg.schmidl@scandio.de>
*
*/
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;
}
}

View file

@ -0,0 +1,30 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title></title>
</head>
<body>
<pre>
* 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.
</pre>
</body>
</html>

View file

@ -0,0 +1 @@
http://portablecontacts.net/draft-spec.html

View file

@ -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));
}
}