You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wookie.apache.org by sc...@apache.org on 2011/05/25 17:46:29 UTC
svn commit: r1127566 [3/4] - in /incubator/wookie/trunk: ./ modules/
modules/jcr/ modules/jcr/src-tests/ modules/jcr/src-tests/org/
modules/jcr/src-tests/org/apache/ modules/jcr/src-tests/org/apache/wookie/
modules/jcr/src-tests/org/apache/wookie/beans...
Added: incubator/wookie/trunk/modules/jcr/src/org/apache/wookie/beans/jcr/impl/ParticipantImpl.java
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/modules/jcr/src/org/apache/wookie/beans/jcr/impl/ParticipantImpl.java?rev=1127566&view=auto
==============================================================================
--- incubator/wookie/trunk/modules/jcr/src/org/apache/wookie/beans/jcr/impl/ParticipantImpl.java (added)
+++ incubator/wookie/trunk/modules/jcr/src/org/apache/wookie/beans/jcr/impl/ParticipantImpl.java Wed May 25 15:46:26 2011
@@ -0,0 +1,160 @@
+/*
+ * 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.apache.wookie.beans.jcr.impl;
+
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Field;
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Node;
+
+import org.apache.wookie.beans.IParticipant;
+import org.apache.wookie.beans.jcr.IPathBean;
+import org.apache.wookie.beans.jcr.JCRPersistenceManager;
+
+/**
+ * ParticipantImpl - JCR OCM IParticipant implementation.
+ *
+ * @author <a href="mailto:rwatler@apache.org">Randy Watler</a>
+ * @version $Id$
+ */
+@Node(jcrType="wookie:participant", discriminator=false)
+public class ParticipantImpl implements IParticipant, IPathBean
+{
+ @Field(path=true)
+ private String path;
+
+ @Field(jcrName="wookie:participantId")
+ private String participantId;
+
+ @Field(jcrName="wookie:participantDisplayName")
+ private String participantDisplayName;
+
+ @Field(jcrName="wookie:participantThumbnailUrl")
+ private String participantThumbnailUrl;
+
+ @Field(jcrName="wookie:sharedDataKey")
+ private String sharedDataKey;
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IBean#getId()
+ */
+ public Object getId()
+ {
+ return path;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.jcr.IPathBean#getNodePath()
+ */
+ public String getNodePath()
+ {
+ return path;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.jcr.IPathBean#setNodePath(java.lang.String)
+ */
+ public String setNodePath(String nodeRootPath)
+ {
+ if (path == null)
+ {
+ path = nodeRootPath+"/"+JCRPersistenceManager.escapeJCRName(sharedDataKey)+"/"+JCRPersistenceManager.escapeJCRName(participantId);
+ }
+ return path;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.util.IParticipant#getParticipantDisplayName()
+ */
+ public String getParticipantDisplayName()
+ {
+ return participantDisplayName;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IParticipant#setParticipantDisplayName(java.lang.String)
+ */
+ public void setParticipantDisplayName(String participantDisplayName)
+ {
+ this.participantDisplayName = participantDisplayName;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IParticipant#getParticipantId()
+ */
+ public String getParticipantId()
+ {
+ return participantId;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IParticipant#setParticipantId(java.lang.String)
+ */
+ public void setParticipantId(String participantId)
+ {
+ this.participantId = participantId;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IParticipant#getParticipantThumbnailUrl()
+ */
+ public String getParticipantThumbnailUrl()
+ {
+ return participantThumbnailUrl;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IParticipant#setParticipantThumbnailUrl(java.lang.String)
+ */
+ public void setParticipantThumbnailUrl(String participantThumbnailUrl)
+ {
+ this.participantThumbnailUrl = participantThumbnailUrl;
+ }
+
+ /**
+ * Get raw persistent JCR absolute node path.
+ *
+ * @return absolute path
+ */
+ public String getPath()
+ {
+ return path;
+ }
+
+ /**
+ * Set raw persistent JCR absolute node path.
+ *
+ * @param path absolute path
+ */
+ public void setPath(String path)
+ {
+ this.path = path;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IParticipant#getSharedDataKey()
+ */
+ public String getSharedDataKey()
+ {
+ return sharedDataKey;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IParticipant#setSharedDataKey(java.lang.String)
+ */
+ public void setSharedDataKey(String sharedDataKey)
+ {
+ this.sharedDataKey = sharedDataKey;
+ }
+
+}
Added: incubator/wookie/trunk/modules/jcr/src/org/apache/wookie/beans/jcr/impl/PreferenceDefaultImpl.java
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/modules/jcr/src/org/apache/wookie/beans/jcr/impl/PreferenceDefaultImpl.java?rev=1127566&view=auto
==============================================================================
--- incubator/wookie/trunk/modules/jcr/src/org/apache/wookie/beans/jcr/impl/PreferenceDefaultImpl.java (added)
+++ incubator/wookie/trunk/modules/jcr/src/org/apache/wookie/beans/jcr/impl/PreferenceDefaultImpl.java Wed May 25 15:46:26 2011
@@ -0,0 +1,107 @@
+/*
+ * 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.apache.wookie.beans.jcr.impl;
+
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Field;
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Node;
+
+import org.apache.wookie.beans.IPreferenceDefault;
+import org.apache.wookie.beans.jcr.IIdElement;
+
+/**
+ * PreferenceDefaultImpl - JCR OCM IPreferenceDefault implementation.
+ *
+ * @author <a href="mailto:rwatler@apache.org">Randy Watler</a>
+ * @version $Id$
+ */
+@Node(jcrType="wookie:preferenceDefault", discriminator=false)
+public class PreferenceDefaultImpl implements IPreferenceDefault, IIdElement
+{
+ @Field(id=true, jcrName="wookie:elementId")
+ private long elementId = -1;
+
+ @Field(jcrName="wookie:preference")
+ private String preference;
+
+ @Field(jcrName="wookie:value")
+ private String value;
+
+ @Field(jcrName="wookie:readOnly")
+ private Boolean readOnly;
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.jcr.IIdElement#getElementId()
+ */
+ public long getElementId()
+ {
+ return elementId;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.jcr.IIdElement#setElementId(long)
+ */
+ public void setElementId(long elementId)
+ {
+ this.elementId = elementId;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IPreferenceDefault#getPreference()
+ */
+ public String getPreference()
+ {
+ return preference;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IPreferenceDefault#setPreference(java.lang.String)
+ */
+ public void setPreference(String preference)
+ {
+ this.preference = preference;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IPreferenceDefault#getValue()
+ */
+ public String getValue()
+ {
+ return value;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IPreferenceDefault#setValue(java.lang.String)
+ */
+ public void setValue(String value)
+ {
+ this.value = value;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IPreferenceDefault#isReadOnly()
+ */
+ public boolean isReadOnly()
+ {
+ return ((readOnly != null) ? readOnly.booleanValue() : false);
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IPreferenceDefault#setReadOnly(boolean)
+ */
+ public void setReadOnly(boolean readOnly)
+ {
+ this.readOnly = (readOnly ? Boolean.TRUE : Boolean.FALSE);
+ }
+}
Added: incubator/wookie/trunk/modules/jcr/src/org/apache/wookie/beans/jcr/impl/PreferenceImpl.java
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/modules/jcr/src/org/apache/wookie/beans/jcr/impl/PreferenceImpl.java?rev=1127566&view=auto
==============================================================================
--- incubator/wookie/trunk/modules/jcr/src/org/apache/wookie/beans/jcr/impl/PreferenceImpl.java (added)
+++ incubator/wookie/trunk/modules/jcr/src/org/apache/wookie/beans/jcr/impl/PreferenceImpl.java Wed May 25 15:46:26 2011
@@ -0,0 +1,112 @@
+/*
+ * 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.apache.wookie.beans.jcr.impl;
+
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Field;
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Node;
+
+import org.apache.wookie.beans.IPreference;
+import org.apache.wookie.beans.jcr.IIdElement;
+
+/**
+ * PreferenceImpl - JCR OCM IPreference implementation.
+ *
+ * @author <a href="mailto:rwatler@apache.org">Randy Watler</a>
+ * @version $Id$
+ */
+@Node(jcrType="wookie:preference", discriminator=false)
+public class PreferenceImpl implements IPreference, IIdElement
+{
+ @Field(id=true, jcrName="wookie:elementId")
+ private long elementId = -1;
+
+ @Field(jcrName="wookie:dkey")
+ private String dkey;
+
+ @Field(jcrName="wookie:dvalue")
+ private String dvalue;
+
+ @Field(jcrName="wookie:readOnly")
+ private Boolean readOnly;
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IPreference#getDkey()
+ */
+ public String getDkey()
+ {
+ return dkey;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IPreference#setDkey(java.lang.String)
+ */
+ public void setDkey(String dkey)
+ {
+ this.dkey = dkey;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IPreference#getDvalue()
+ */
+ public String getDvalue()
+ {
+ return dvalue;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IPreference#setDvalue(java.lang.String)
+ */
+ public void setDvalue(String dvalue)
+ {
+ this.dvalue = dvalue;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.jcr.IIdElement#getElementId()
+ */
+ public long getElementId()
+ {
+ return elementId;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.jcr.IIdElement#setElementId(long)
+ */
+ public void setElementId(long elementId)
+ {
+ this.elementId = elementId;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IPreference#isReadOnly()
+ */
+ public boolean isReadOnly()
+ {
+ return ((readOnly != null) ? readOnly.booleanValue() : false);
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IPreference#setReadOnly(boolean)
+ */
+ public void setReadOnly(boolean readOnly)
+ {
+ this.readOnly = (readOnly ? Boolean.TRUE : Boolean.FALSE);
+ }
+
+ public Object getId() {
+ // TODO is this correct - all the other elements use int field
+ return elementId;
+ }
+}
Added: incubator/wookie/trunk/modules/jcr/src/org/apache/wookie/beans/jcr/impl/SharedDataImpl.java
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/modules/jcr/src/org/apache/wookie/beans/jcr/impl/SharedDataImpl.java?rev=1127566&view=auto
==============================================================================
--- incubator/wookie/trunk/modules/jcr/src/org/apache/wookie/beans/jcr/impl/SharedDataImpl.java (added)
+++ incubator/wookie/trunk/modules/jcr/src/org/apache/wookie/beans/jcr/impl/SharedDataImpl.java Wed May 25 15:46:26 2011
@@ -0,0 +1,112 @@
+/*
+ * 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.apache.wookie.beans.jcr.impl;
+
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Field;
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Node;
+
+import org.apache.wookie.beans.ISharedData;
+import org.apache.wookie.beans.jcr.IIdElement;
+
+/**
+ * SharedDataImpl - JCR OCM ISharedData implementation.
+ *
+ * @author <a href="mailto:rwatler@apache.org">Randy Watler</a>
+ * @version $Id$
+ */
+@Node(jcrType="wookie:sharedData", discriminator=false)
+public class SharedDataImpl implements ISharedData, IIdElement
+{
+ @Field(id=true, jcrName="wookie:elementId")
+ private long elementId = -1;
+
+ @Field(jcrName="wookie:sharedDataKey")
+ private String sharedDataKey;
+
+ @Field(jcrName="wookie:dkey")
+ private String dkey;
+
+ @Field(jcrName="wookie:dvalue")
+ private String dvalue;
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.ISharedData#getDkey()
+ */
+ public String getDkey()
+ {
+ return dkey;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.ISharedData#setDkey(java.lang.String)
+ */
+ public void setDkey(String dkey)
+ {
+ this.dkey = dkey;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.ISharedData#getDvalue()
+ */
+ public String getDvalue()
+ {
+ return dvalue;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.ISharedData#setDvalue(java.lang.String)
+ */
+ public void setDvalue(String dvalue)
+ {
+ this.dvalue = dvalue;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.jcr.IIdElement#getElementId()
+ */
+ public long getElementId()
+ {
+ return elementId;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.jcr.IIdElement#setElementId(long)
+ */
+ public void setElementId(long elementId)
+ {
+ this.elementId = elementId;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.ISharedData#getSharedDataKey()
+ */
+ public String getSharedDataKey()
+ {
+ return sharedDataKey;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.ISharedData#setSharedDataKey(java.lang.String)
+ */
+ public void setSharedDataKey(String sharedDataKey)
+ {
+ this.sharedDataKey = sharedDataKey;
+ }
+
+ public Object getId() {
+ // TODO is this correct - all the other elements use int field
+ return elementId;
+ }
+}
Added: incubator/wookie/trunk/modules/jcr/src/org/apache/wookie/beans/jcr/impl/StartFileImpl.java
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/modules/jcr/src/org/apache/wookie/beans/jcr/impl/StartFileImpl.java?rev=1127566&view=auto
==============================================================================
--- incubator/wookie/trunk/modules/jcr/src/org/apache/wookie/beans/jcr/impl/StartFileImpl.java (added)
+++ incubator/wookie/trunk/modules/jcr/src/org/apache/wookie/beans/jcr/impl/StartFileImpl.java Wed May 25 15:46:26 2011
@@ -0,0 +1,107 @@
+/*
+ * 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.apache.wookie.beans.jcr.impl;
+
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Field;
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Node;
+
+import org.apache.wookie.beans.IStartFile;
+import org.apache.wookie.beans.jcr.IIdElement;
+
+/**
+ * StartFileImpl - JCR OCM IStartFile implementation.
+ *
+ * @author <a href="mailto:rwatler@apache.org">Randy Watler</a>
+ * @version $Id$
+ */
+@Node(jcrType="wookie:startFile", discriminator=false)
+public class StartFileImpl implements IStartFile, IIdElement
+{
+ @Field(id=true, jcrName="wookie:elementId")
+ private long elementId = -1;
+
+ @Field(jcrName="wookie:url")
+ private String url;
+
+ @Field(jcrName="wookie:charset")
+ private String charset;
+
+ @Field(jcrName="wookie:lang")
+ private String lang;
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IStartFile#getCharset()
+ */
+ public String getCharset()
+ {
+ return charset;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IStartFile#setCharset(java.lang.String)
+ */
+ public void setCharset(String charset)
+ {
+ this.charset = charset;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.jcr.IIdElement#getElementId()
+ */
+ public long getElementId()
+ {
+ return elementId;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.jcr.IIdElement#setElementId(long)
+ */
+ public void setElementId(long elementId)
+ {
+ this.elementId = elementId;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IStartFile#getLang()
+ */
+ public String getLang()
+ {
+ return lang;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IStartFile#setLang(java.lang.String)
+ */
+ public void setLang(String lang)
+ {
+ this.lang = lang;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IStartFile#getUrl()
+ */
+ public String getUrl()
+ {
+ return url;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IStartFile#setUrl(java.lang.String)
+ */
+ public void setUrl(String url)
+ {
+ this.url = url;
+ }
+}
Added: incubator/wookie/trunk/modules/jcr/src/org/apache/wookie/beans/jcr/impl/TokenImpl.java
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/modules/jcr/src/org/apache/wookie/beans/jcr/impl/TokenImpl.java?rev=1127566&view=auto
==============================================================================
--- incubator/wookie/trunk/modules/jcr/src/org/apache/wookie/beans/jcr/impl/TokenImpl.java (added)
+++ incubator/wookie/trunk/modules/jcr/src/org/apache/wookie/beans/jcr/impl/TokenImpl.java Wed May 25 15:46:26 2011
@@ -0,0 +1,164 @@
+/*
+ * 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.apache.wookie.beans.jcr.impl;
+
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Field;
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Node;
+
+import org.apache.wookie.beans.IToken;
+import org.apache.wookie.beans.jcr.IIdElement;
+
+/**
+ * TokenImpl - JCR OCM IToken implementation.
+ *
+ * @author <a href="mailto:rwatler@apache.org">Randy Watler</a>
+ * @version $Id$
+ */
+@Node(jcrType="wookie:token", discriminator=false)
+public class TokenImpl implements IToken, IIdElement
+{
+ @Field(id=true, jcrName="wookie:elementId")
+ private long elementId = -1;
+
+ @Field(jcrName="wookie:requestUrl")
+ private String requestUrl;
+
+ @Field(jcrName="wookie:accessUrl")
+ private String accessUrl;
+
+ @Field(jcrName="wookie:authzUrl")
+ private String authzUrl;
+
+ @Field(jcrName="wookie:requestToken")
+ private String requestToken;
+
+ @Field(jcrName="wookie:accessToken")
+ private String accessToken;
+
+ @Field(jcrName="wookie:tokenSecret")
+ private String tokenSecret;
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IToken#getAccessToken()
+ */
+ public String getAccessToken()
+ {
+ return accessToken;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IToken#setAccessToken(java.lang.String)
+ */
+ public void setAccessToken(String accessToken)
+ {
+ this.accessToken = accessToken;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IToken#getAccessUrl()
+ */
+ public String getAccessUrl()
+ {
+ return accessUrl;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IToken#setAccessUrl(java.lang.String)
+ */
+ public void setAccessUrl(String accessUrl)
+ {
+ this.accessUrl = accessUrl;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IToken#getAuthzUrl()
+ */
+ public String getAuthzUrl()
+ {
+ return authzUrl;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IToken#setAuthzUrl(java.lang.String)
+ */
+ public void setAuthzUrl(String authzUrl)
+ {
+ this.authzUrl = authzUrl;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.jcr.IIdElement#getElementId()
+ */
+ public long getElementId()
+ {
+ return elementId;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.jcr.IIdElement#setElementId(long)
+ */
+ public void setElementId(long elementId)
+ {
+ this.elementId = elementId;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IToken#getRequestToken()
+ */
+ public String getRequestToken()
+ {
+ return requestToken;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IToken#setRequestToken(java.lang.String)
+ */
+ public void setRequestToken(String requestToken)
+ {
+ this.requestToken = requestToken;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IToken#getRequestUrl()
+ */
+ public String getRequestUrl()
+ {
+ return requestUrl;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IToken#setRequestUrl(java.lang.String)
+ */
+ public void setRequestUrl(String requestUrl)
+ {
+ this.requestUrl = requestUrl;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IToken#getTokenSecret()
+ */
+ public String getTokenSecret()
+ {
+ return tokenSecret;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IToken#setTokenSecret(java.lang.String)
+ */
+ public void setTokenSecret(String tokenSecret)
+ {
+ this.tokenSecret = tokenSecret;
+ }
+}
Added: incubator/wookie/trunk/modules/jcr/src/org/apache/wookie/beans/jcr/impl/WhitelistImpl.java
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/modules/jcr/src/org/apache/wookie/beans/jcr/impl/WhitelistImpl.java?rev=1127566&view=auto
==============================================================================
--- incubator/wookie/trunk/modules/jcr/src/org/apache/wookie/beans/jcr/impl/WhitelistImpl.java (added)
+++ incubator/wookie/trunk/modules/jcr/src/org/apache/wookie/beans/jcr/impl/WhitelistImpl.java Wed May 25 15:46:26 2011
@@ -0,0 +1,102 @@
+/*
+ * 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.apache.wookie.beans.jcr.impl;
+
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Field;
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Node;
+
+import org.apache.wookie.beans.IWhitelist;
+import org.apache.wookie.beans.jcr.IPathBean;
+import org.apache.wookie.beans.jcr.JCRPersistenceManager;
+
+/**
+ * WhitelistImpl - JCR OCM IWhitelist implementation.
+ *
+ * @author <a href="mailto:rwatler@apache.org">Randy Watler</a>
+ * @version $Id$
+ */
+@Node(jcrType="wookie:whitelist", discriminator=false)
+public class WhitelistImpl implements IWhitelist, IPathBean
+{
+ @Field(path=true)
+ private String path;
+
+ @Field(jcrName="wookie:fUrl")
+ private String fUrl;
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IWhitelist#getfUrl()
+ */
+ public String getfUrl()
+ {
+ return fUrl;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IWhitelist#setfUrl(java.lang.String)
+ */
+ public void setfUrl(String url)
+ {
+ this.fUrl = url;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IBean#getId()
+ */
+ public Object getId()
+ {
+ return path;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.jcr.IPathBean#getNodePath()
+ */
+ public String getNodePath()
+ {
+ return path;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.jcr.IPathBean#setNodePath(java.lang.String)
+ */
+ public String setNodePath(String nodeRootPath)
+ {
+ if (path == null)
+ {
+ path = nodeRootPath+"/"+JCRPersistenceManager.escapeJCRName(fUrl);
+ }
+ return path;
+ }
+
+ /**
+ * Get raw persistent JCR absolute node path.
+ *
+ * @return absolute path
+ */
+ public String getPath()
+ {
+ return path;
+ }
+
+ /**
+ * Set raw persistent JCR absolute node path.
+ *
+ * @param path absolute path
+ */
+ public void setPath(String path)
+ {
+ this.path = path;
+ }
+}
Added: incubator/wookie/trunk/modules/jcr/src/org/apache/wookie/beans/jcr/impl/WidgetDefaultImpl.java
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/modules/jcr/src/org/apache/wookie/beans/jcr/impl/WidgetDefaultImpl.java?rev=1127566&view=auto
==============================================================================
--- incubator/wookie/trunk/modules/jcr/src/org/apache/wookie/beans/jcr/impl/WidgetDefaultImpl.java (added)
+++ incubator/wookie/trunk/modules/jcr/src/org/apache/wookie/beans/jcr/impl/WidgetDefaultImpl.java Wed May 25 15:46:26 2011
@@ -0,0 +1,144 @@
+/*
+ * 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.apache.wookie.beans.jcr.impl;
+
+import org.apache.jackrabbit.ocm.manager.beanconverter.impl.ReferenceBeanConverterImpl;
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Bean;
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Field;
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Node;
+
+import org.apache.wookie.beans.IWidget;
+import org.apache.wookie.beans.IWidgetDefault;
+import org.apache.wookie.beans.jcr.IPathBean;
+import org.apache.wookie.beans.jcr.JCRPersistenceManager;
+
+/**
+ * WidgetDefaultImpl - JCR OCM IWidgetDefault implementation.
+ *
+ * @author <a href="mailto:rwatler@apache.org">Randy Watler</a>
+ * @version $Id$
+ */
+@Node(jcrType="wookie:widgetDefault", discriminator=false)
+public class WidgetDefaultImpl implements IWidgetDefault, IPathBean
+{
+ @Field(path=true)
+ private String path;
+
+ @Field(jcrName="wookie:widgetContext")
+ private String widgetContext;
+
+ @Bean(jcrName="wookie:widget", converter=ReferenceBeanConverterImpl.class)
+ private WidgetImpl widgetImpl;
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IBean#getId()
+ */
+ public Object getId()
+ {
+ return path;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.jcr.IPathBean#getNodePath()
+ */
+ public String getNodePath()
+ {
+ return path;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.jcr.IPathBean#setNodePath(java.lang.String)
+ */
+ public String setNodePath(String nodeRootPath)
+ {
+ if (path == null)
+ {
+ path = nodeRootPath+"/"+JCRPersistenceManager.escapeJCRName(widgetContext);
+ }
+ return path;
+ }
+
+ /**
+ * Get raw persistent JCR absolute node path.
+ *
+ * @return absolute path
+ */
+ public String getPath()
+ {
+ return path;
+ }
+
+ /**
+ * Set raw persistent JCR absolute node path.
+ *
+ * @param path absolute path
+ */
+ public void setPath(String path)
+ {
+ this.path = path;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IWidgetDefault#getWidget()
+ */
+ public IWidget getWidget()
+ {
+ return widgetImpl;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IWidgetDefault#setWidget(org.apache.wookie.beans.IWidget)
+ */
+ public void setWidget(IWidget widget)
+ {
+ this.widgetImpl = (WidgetImpl)widget;
+ }
+
+ /**
+ * Get widget implementation.
+ *
+ * @return widget implementation
+ */
+ public WidgetImpl getWidgetImpl()
+ {
+ return widgetImpl;
+ }
+
+ /**
+ * Set widget implementation.
+ *
+ * @return widgetImpl widget implementation
+ */
+ public void setWidgetImpl(WidgetImpl widgetImpl)
+ {
+ this.widgetImpl = widgetImpl;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IWidgetDefault#getWidgetContext()
+ */
+ public String getWidgetContext()
+ {
+ return widgetContext;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IWidgetDefault#setWidgetContext(java.lang.String)
+ */
+ public void setWidgetContext(String widgetContext)
+ {
+ this.widgetContext = widgetContext;
+ }
+}
Added: incubator/wookie/trunk/modules/jcr/src/org/apache/wookie/beans/jcr/impl/WidgetIconImpl.java
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/modules/jcr/src/org/apache/wookie/beans/jcr/impl/WidgetIconImpl.java?rev=1127566&view=auto
==============================================================================
--- incubator/wookie/trunk/modules/jcr/src/org/apache/wookie/beans/jcr/impl/WidgetIconImpl.java (added)
+++ incubator/wookie/trunk/modules/jcr/src/org/apache/wookie/beans/jcr/impl/WidgetIconImpl.java Wed May 25 15:46:26 2011
@@ -0,0 +1,126 @@
+/*
+ * 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.apache.wookie.beans.jcr.impl;
+
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Field;
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Node;
+
+import org.apache.wookie.beans.IWidgetIcon;
+import org.apache.wookie.beans.jcr.IIdElement;
+
+/**
+ * WidgetIconImpl - JCR OCM IWidgetIcon implementation.
+ *
+ * @author <a href="mailto:rwatler@apache.org">Randy Watler</a>
+ * @version $Id$
+ */
+@Node(jcrType="wookie:widgetIcon", discriminator=false)
+public class WidgetIconImpl implements IWidgetIcon, IIdElement
+{
+ @Field(id=true, jcrName="wookie:elementId")
+ private long elementId = -1;
+
+ @Field(jcrName="wookie:src")
+ private String src;
+
+ @Field(jcrName="wookie:height")
+ private Integer height;
+
+ @Field(jcrName="wookie:width")
+ private Integer width;
+
+ @Field(jcrName="wookie:lang")
+ private String lang;
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.jcr.IIdElement#getElementId()
+ */
+ public long getElementId()
+ {
+ return elementId;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.jcr.IIdElement#setElementId(long)
+ */
+ public void setElementId(long elementId)
+ {
+ this.elementId = elementId;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IWidgetIcon#getHeight()
+ */
+ public Integer getHeight()
+ {
+ return height;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IWidgetIcon#setHeight(java.lang.Integer)
+ */
+ public void setHeight(Integer height)
+ {
+ this.height = height;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IWidgetIcon#getLang()
+ */
+ public String getLang()
+ {
+ return lang;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IWidgetIcon#setLang(java.lang.String)
+ */
+ public void setLang(String lang)
+ {
+ this.lang = lang;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IWidgetIcon#getSrc()
+ */
+ public String getSrc()
+ {
+ return src;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IWidgetIcon#setSrc(java.lang.String)
+ */
+ public void setSrc(String src)
+ {
+ this.src = src;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IWidgetIcon#getWidth()
+ */
+ public Integer getWidth()
+ {
+ return width;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IWidgetIcon#setWidth(java.lang.Integer)
+ */
+ public void setWidth(Integer width)
+ {
+ this.width = width;
+ }
+}
Added: incubator/wookie/trunk/modules/jcr/src/org/apache/wookie/beans/jcr/impl/WidgetImpl.java
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/modules/jcr/src/org/apache/wookie/beans/jcr/impl/WidgetImpl.java?rev=1127566&view=auto
==============================================================================
--- incubator/wookie/trunk/modules/jcr/src/org/apache/wookie/beans/jcr/impl/WidgetImpl.java (added)
+++ incubator/wookie/trunk/modules/jcr/src/org/apache/wookie/beans/jcr/impl/WidgetImpl.java Wed May 25 15:46:26 2011
@@ -0,0 +1,730 @@
+/*
+ * 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.apache.wookie.beans.jcr.impl;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Field;
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Node;
+
+import org.apache.wookie.beans.IDescription;
+import org.apache.wookie.beans.IFeature;
+import org.apache.wookie.beans.ILicense;
+import org.apache.wookie.beans.IName;
+import org.apache.wookie.beans.IPreferenceDefault;
+import org.apache.wookie.beans.IStartFile;
+import org.apache.wookie.beans.IWidget;
+import org.apache.wookie.beans.IWidgetIcon;
+import org.apache.wookie.beans.IWidgetType;
+import org.apache.wookie.beans.jcr.IPathBean;
+import org.apache.wookie.beans.jcr.IUuidBean;
+import org.apache.wookie.beans.jcr.IdCollection;
+import org.apache.wookie.beans.jcr.JCRPersistenceManager;
+
+/**
+ * WidgetImpl - JCR OCM IWidget implementation.
+ *
+ * @author <a href="mailto:rwatler@apache.org">Randy Watler</a>
+ * @version $Id$
+ */
+@Node(jcrType="wookie:widget", jcrMixinTypes="mix:referenceable", discriminator=false)
+public class WidgetImpl extends LocalizedBeanImpl implements IWidget, IPathBean, IUuidBean
+{
+ @Field(path=true)
+ private String path;
+
+ @Field(uuid=true)
+ private String uuid;
+
+ @Field(jcrName="wookie:packagePath")
+ private String packagePath;
+
+ @Field(jcrName="wookie:updateLocation")
+ private String updateLocation;
+
+ @Field(jcrName="wookie:height")
+ private Integer height;
+
+ @Field(jcrName="wookie:width")
+ private Integer width;
+
+ @Field(jcrName="wookie:guid")
+ private String guid;
+
+ @Field(jcrName="wookie:widgetAuthor")
+ private String widgetAuthor;
+
+ @Field(jcrName="wookie:widgetAuthorEmail")
+ private String widgetAuthorEmail;
+
+ @Field(jcrName="wookie:widgetAuthorHref")
+ private String widgetAuthorHref;
+
+ @Field(jcrName="wookie:widgetVersion")
+ private String version;
+
+ @org.apache.jackrabbit.ocm.mapper.impl.annotation.Collection(jcrName="wookie:widgetTypes", elementClassName=WidgetTypeImpl.class)
+ private Collection<WidgetTypeImpl> widgetTypeImpls;
+
+ @org.apache.jackrabbit.ocm.mapper.impl.annotation.Collection(jcrName="wookie:features", elementClassName=FeatureImpl.class)
+ private Collection<FeatureImpl> featureImpls;
+
+ @org.apache.jackrabbit.ocm.mapper.impl.annotation.Collection(jcrName="wookie:widgetIcons", elementClassName=WidgetIconImpl.class)
+ private Collection<WidgetIconImpl> widgetIconImpls;
+
+ @org.apache.jackrabbit.ocm.mapper.impl.annotation.Collection(jcrName="wookie:licenses", elementClassName=LicenseImpl.class)
+ private Collection<LicenseImpl> licenseImpls;
+
+ @org.apache.jackrabbit.ocm.mapper.impl.annotation.Collection(jcrName="wookie:names", elementClassName=NameImpl.class)
+ private Collection<NameImpl> nameImpls;
+
+ @org.apache.jackrabbit.ocm.mapper.impl.annotation.Collection(jcrName="wookie:descriptions", elementClassName=DescriptionImpl.class)
+ private Collection<DescriptionImpl> descriptionImpls;
+
+ @org.apache.jackrabbit.ocm.mapper.impl.annotation.Collection(jcrName="wookie:startFiles", elementClassName=StartFileImpl.class)
+ private Collection<StartFileImpl> startFileImpls;
+
+ @org.apache.jackrabbit.ocm.mapper.impl.annotation.Collection(jcrName="wookie:preferenceDefaults", elementClassName=PreferenceDefaultImpl.class)
+ private Collection<PreferenceDefaultImpl> preferenceDefaultImpls;
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IWidget#getPackagePath()
+ */
+ public String getPackagePath() {
+ return packagePath;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IWidget#setPackagePath(java.lang.String)
+ */
+ public void setPackagePath(String path) {
+ packagePath = path;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IWidget#getDescriptions()
+ */
+ public Collection<IDescription> getDescriptions()
+ {
+ if (descriptionImpls == null)
+ {
+ descriptionImpls = new ArrayList<DescriptionImpl>();
+ }
+ return new IdCollection<DescriptionImpl,IDescription>(descriptionImpls);
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IWidget#setDescriptions(java.util.Collection)
+ */
+ public void setDescriptions(Collection<IDescription> descriptions)
+ {
+ getDescriptions().clear();
+ if (descriptions != null)
+ {
+ for (IDescription description : descriptions)
+ {
+ getDescriptions().add((DescriptionImpl)description);
+ }
+ }
+ }
+
+ /**
+ * Get description implementations collection.
+ *
+ * @return description implementations collection
+ */
+ public Collection<DescriptionImpl> getDescriptionImpls()
+ {
+ return descriptionImpls;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IWidget#getUpdateLocation()
+ */
+ public String getUpdateLocation() {
+ return this.updateLocation;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IWidget#setUpdateLocation(java.lang.String)
+ */
+ public void setUpdateLocation(String location) {
+ this.updateLocation = location;
+ }
+
+ /**
+ * Set description implementations collection.
+ *
+ * @param descriptionImpls description implementations collection
+ */
+ public void setDescriptionImpls(Collection<DescriptionImpl> descriptionImpls)
+ {
+ this.descriptionImpls = descriptionImpls;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IWidget#getFeatures()
+ */
+ public Collection<IFeature> getFeatures()
+ {
+ if (featureImpls == null)
+ {
+ featureImpls = new ArrayList<FeatureImpl>();
+ }
+ return new IdCollection<FeatureImpl,IFeature>(featureImpls);
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IWidget#setFeatures(java.util.Collection)
+ */
+ public void setFeatures(Collection<IFeature> features)
+ {
+ getFeatures().clear();
+ if (features != null)
+ {
+ for (IFeature feature : features)
+ {
+ getFeatures().add((FeatureImpl)feature);
+ }
+ }
+ }
+
+ /**
+ * Get feature implementations collection.
+ *
+ * @return feature implementations collection
+ */
+ public Collection<FeatureImpl> getFeatureImpls()
+ {
+ return featureImpls;
+ }
+
+ /**
+ * Set feature implementations collection.
+ *
+ * @param featureImpls feature implementations collection
+ */
+ public void setFeatureImpls(Collection<FeatureImpl> featureImpls)
+ {
+ this.featureImpls = featureImpls;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IWidget#getGuid()
+ */
+ public String getGuid()
+ {
+ return guid;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IWidget#setGuid(java.lang.String)
+ */
+ public void setGuid(String guid)
+ {
+ this.guid = guid;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IWidget#getHeight()
+ */
+ public Integer getHeight()
+ {
+ return height;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IWidget#setHeight(java.lang.Integer)
+ */
+ public void setHeight(Integer height)
+ {
+ this.height = height;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IBean#getId()
+ */
+ public String getId()
+ {
+ return path;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IWidget#getLicenses()
+ */
+ public Collection<ILicense> getLicenses()
+ {
+ if (licenseImpls == null)
+ {
+ licenseImpls = new ArrayList<LicenseImpl>();
+ }
+ return new IdCollection<LicenseImpl,ILicense>(licenseImpls);
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IWidget#setLicenses(java.util.Collection)
+ */
+ public void setLicenses(Collection<ILicense> licenses)
+ {
+ getLicenses().clear();
+ if (licenses != null)
+ {
+ for (ILicense license : licenses)
+ {
+ getLicenses().add((LicenseImpl)license);
+ }
+ }
+ }
+
+ /**
+ * Get license implementations collection.
+ *
+ * @return license implementations collection
+ */
+ public Collection<LicenseImpl> getLicenseImpls()
+ {
+ return licenseImpls;
+ }
+
+ /**
+ * Set license implementations collection.
+ *
+ * @param licenseImpls license implementations collection
+ */
+ public void setLicenseImpls(Collection<LicenseImpl> licenseImpls)
+ {
+ this.licenseImpls = licenseImpls;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IWidget#getNames()
+ */
+ public Collection<IName> getNames()
+ {
+ if (nameImpls == null)
+ {
+ nameImpls = new ArrayList<NameImpl>();
+ }
+ return new IdCollection<NameImpl,IName>(nameImpls);
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IWidget#setNames(java.util.Collection)
+ */
+ public void setNames(Collection<IName> names)
+ {
+ getNames().clear();
+ if (names != null)
+ {
+ for (IName name : names)
+ {
+ getNames().add((NameImpl)name);
+ }
+ }
+ }
+
+ /**
+ * Get name implementations collection.
+ *
+ * @return name implementations collection
+ */
+ public Collection<NameImpl> getNameImpls()
+ {
+ return nameImpls;
+ }
+
+ /**
+ * Set name implementations collection.
+ *
+ * @param nameImpls name implementations collection
+ */
+ public void setNameImpls(Collection<NameImpl> nameImpls)
+ {
+ this.nameImpls = nameImpls;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.jcr.IPathBean#getNodePath()
+ */
+ public String getNodePath()
+ {
+ return path;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.jcr.IPathBean#setNodePath(java.lang.String)
+ */
+ public String setNodePath(String nodeRootPath)
+ {
+ if (path == null)
+ {
+ path = nodeRootPath+"/"+JCRPersistenceManager.escapeJCRName(guid);
+ }
+ return path;
+ }
+
+ /**
+ * Get raw persistent JCR absolute node path.
+ *
+ * @return absolute path
+ */
+ public String getPath()
+ {
+ return path;
+ }
+
+ /**
+ * Set raw persistent JCR absolute node path.
+ *
+ * @param path absolute path
+ */
+ public void setPath(String path)
+ {
+ this.path = path;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IWidget#getPreferenceDefaults()
+ */
+ public Collection<IPreferenceDefault> getPreferenceDefaults()
+ {
+ if (preferenceDefaultImpls == null)
+ {
+ preferenceDefaultImpls = new ArrayList<PreferenceDefaultImpl>();
+ }
+ return new IdCollection<PreferenceDefaultImpl,IPreferenceDefault>(preferenceDefaultImpls);
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IWidget#setPreferenceDefaults(java.util.Collection)
+ */
+ public void setPreferenceDefaults(Collection<IPreferenceDefault> preferenceDefaults)
+ {
+ getPreferenceDefaults().clear();
+ if (preferenceDefaults != null)
+ {
+ for (IPreferenceDefault preferenceDefault : preferenceDefaults)
+ {
+ getPreferenceDefaults().add((PreferenceDefaultImpl)preferenceDefault);
+ }
+ }
+ }
+
+ /**
+ * Get preference default implementations collection.
+ *
+ * @return preference default implementations collection
+ */
+ public Collection<PreferenceDefaultImpl> getPreferenceDefaultImpls()
+ {
+ return preferenceDefaultImpls;
+ }
+
+ /**
+ * Set preference default implementations collection.
+ *
+ * @param preferenceDefaultImpls preference default implementations collection
+ */
+ public void setPreferenceDefaultImpls(Collection<PreferenceDefaultImpl> preferenceDefaultImpls)
+ {
+ this.preferenceDefaultImpls = preferenceDefaultImpls;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IWidget#getStartFiles()
+ */
+ public Collection<IStartFile> getStartFiles()
+ {
+ if (startFileImpls == null)
+ {
+ startFileImpls = new ArrayList<StartFileImpl>();
+ }
+ return new IdCollection<StartFileImpl,IStartFile>(startFileImpls);
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IWidget#setStartFiles(java.util.Collection)
+ */
+ public void setStartFiles(Collection<IStartFile> startFiles)
+ {
+ getStartFiles().clear();
+ if (startFiles != null)
+ {
+ for (IStartFile startFile : startFiles)
+ {
+ getStartFiles().add((StartFileImpl)startFile);
+ }
+ }
+ }
+
+ /**
+ * Get start file implementations collection.
+ *
+ * @return start file implementations collection
+ */
+ public Collection<StartFileImpl> getStartFileImpls()
+ {
+ return startFileImpls;
+ }
+
+ /**
+ * Set start file implementations collection.
+ *
+ * @param startFileImpls start file implementations collection
+ */
+ public void setStartFileImpls(Collection<StartFileImpl> startFileImpls)
+ {
+ this.startFileImpls = startFileImpls;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.jcr.IUuidBean#getUuid()
+ */
+ public String getUuid()
+ {
+ return uuid;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.jcr.IUuidBean#setUuid(java.lang.String)
+ */
+ public void setUuid(String uuid)
+ {
+ this.uuid = uuid;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IWidget#getVersion()
+ */
+ public String getVersion()
+ {
+ return version;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IWidget#setVersion(java.lang.String)
+ */
+ public void setVersion(String version)
+ {
+ this.version = version;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IWidget#getWidgetAuthor()
+ */
+ public String getWidgetAuthor()
+ {
+ return widgetAuthor;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IWidget#setWidgetAuthor(java.lang.String)
+ */
+ public void setWidgetAuthor(String widgetAuthor)
+ {
+ this.widgetAuthor = widgetAuthor;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IWidget#getWidgetAuthorEmail()
+ */
+ public String getWidgetAuthorEmail()
+ {
+ return widgetAuthorEmail;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IWidget#setWidgetAuthorEmail(java.lang.String)
+ */
+ public void setWidgetAuthorEmail(String widgetAuthorEmail)
+ {
+ this.widgetAuthorEmail = widgetAuthorEmail;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IWidget#getWidgetAuthorHref()
+ */
+ public String getWidgetAuthorHref()
+ {
+ return widgetAuthorHref;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IWidget#setWidgetAuthorHref(java.lang.String)
+ */
+ public void setWidgetAuthorHref(String widgetAuthorHref)
+ {
+ this.widgetAuthorHref = widgetAuthorHref;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IWidget#getWidgetIcons()
+ */
+ public Collection<IWidgetIcon> getWidgetIcons()
+ {
+ if (widgetIconImpls == null)
+ {
+ widgetIconImpls = new ArrayList<WidgetIconImpl>();
+ }
+ return new IdCollection<WidgetIconImpl,IWidgetIcon>(widgetIconImpls);
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IWidget#setWidgetIcons(java.util.Collection)
+ */
+ public void setWidgetIcons(Collection<IWidgetIcon> widgetIcons)
+ {
+ getWidgetIcons().clear();
+ if (widgetIcons != null)
+ {
+ for (IWidgetIcon widgetIcon : widgetIcons)
+ {
+ getWidgetIcons().add((WidgetIconImpl)widgetIcon);
+ }
+ }
+ }
+
+ /**
+ * Get widget icon implementations collection.
+ *
+ * @return widget icon implementations collection
+ */
+ public Collection<WidgetIconImpl> getWidgetIconImpls()
+ {
+ return widgetIconImpls;
+ }
+
+ /**
+ * Set widget icon implementations collection.
+ *
+ * @param widgetIconImpls widget icon implementations collection
+ */
+ public void setWidgetIconImpls(Collection<WidgetIconImpl> widgetIconImpls)
+ {
+ this.widgetIconImpls = widgetIconImpls;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IWidget#getWidgetTypes()
+ */
+ public Collection<IWidgetType> getWidgetTypes()
+ {
+ if (widgetTypeImpls == null)
+ {
+ widgetTypeImpls = new ArrayList<WidgetTypeImpl>();
+ }
+ return new IdCollection<WidgetTypeImpl,IWidgetType>(widgetTypeImpls);
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IWidget#setWidgetTypes(java.util.Collection)
+ */
+ public void setWidgetTypes(Collection<IWidgetType> widgetTypes)
+ {
+ getWidgetTypes().clear();
+ if (widgetTypes != null)
+ {
+ for (IWidgetType widgetType : widgetTypes)
+ {
+ getWidgetTypes().add((WidgetTypeImpl)widgetType);
+ }
+ }
+ }
+
+ /**
+ * Get widget type implementations collection.
+ *
+ * @return widget type implementations collection
+ */
+ public Collection<WidgetTypeImpl> getWidgetTypeImpls()
+ {
+ return widgetTypeImpls;
+ }
+
+ /**
+ * Set widget type implementations collection.
+ *
+ * @param widgetTypeImpls widget type implementations collection
+ */
+ public void setWidgetTypeImpls(Collection<WidgetTypeImpl> widgetTypeImpls)
+ {
+ this.widgetTypeImpls = widgetTypeImpls;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IWidget#getWidth()
+ */
+ public Integer getWidth()
+ {
+ return width;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IWidget#setWidth(java.lang.Integer)
+ */
+ public void setWidth(Integer width)
+ {
+ this.width = width;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IWidget#getWidgetDescription()
+ */
+ public String getWidgetDescription()
+ {
+ return Utilities.getWidgetDescription(this, "en");
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IWidget#getWidgetShortName()
+ */
+ public String getWidgetShortName()
+ {
+ return Utilities.getWidgetShortName(this, "en");
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IWidget#getWidgetTitle()
+ */
+ public String getWidgetTitle()
+ {
+ return Utilities.getWidgetTitle(this, "en");
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IWidget#getWidgetTitle(java.lang.String)
+ */
+ public String getWidgetTitle(String locale)
+ {
+ return Utilities.getWidgetTitle(this, locale);
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IWidget#getUrl()
+ */
+ public String getUrl()
+ {
+ return Utilities.getUrl(this, "en");
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IWidget#getWidgetIconLocation()
+ */
+ public String getWidgetIconLocation()
+ {
+ return Utilities.getWidgetIconLocation(this, "en");
+ }
+}
Added: incubator/wookie/trunk/modules/jcr/src/org/apache/wookie/beans/jcr/impl/WidgetInstanceImpl.java
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/modules/jcr/src/org/apache/wookie/beans/jcr/impl/WidgetInstanceImpl.java?rev=1127566&view=auto
==============================================================================
--- incubator/wookie/trunk/modules/jcr/src/org/apache/wookie/beans/jcr/impl/WidgetInstanceImpl.java (added)
+++ incubator/wookie/trunk/modules/jcr/src/org/apache/wookie/beans/jcr/impl/WidgetInstanceImpl.java Wed May 25 15:46:26 2011
@@ -0,0 +1,469 @@
+/*
+ * 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.apache.wookie.beans.jcr.impl;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.apache.jackrabbit.ocm.manager.beanconverter.impl.ReferenceBeanConverterImpl;
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Bean;
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Field;
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Node;
+
+import org.apache.wookie.beans.IPreference;
+import org.apache.wookie.beans.IToken;
+import org.apache.wookie.beans.IWidget;
+import org.apache.wookie.beans.IWidgetInstance;
+import org.apache.wookie.beans.jcr.IPathBean;
+import org.apache.wookie.beans.jcr.IUuidBean;
+import org.apache.wookie.beans.jcr.IdCollection;
+import org.apache.wookie.beans.jcr.JCRPersistenceManager;
+
+/**
+ * WidgetInstanceImpl - JCR OCM IWidgetInstance implementation.
+ *
+ * @author <a href="mailto:rwatler@apache.org">Randy Watler</a>
+ * @version $Id$
+ */
+@Node(jcrType="wookie:widgetInstance", jcrMixinTypes="mix:referenceable", discriminator=false)
+public class WidgetInstanceImpl implements IWidgetInstance, IPathBean, IUuidBean
+{
+ @Field(path=true)
+ private String path;
+
+ @Field(uuid=true)
+ private String uuid;
+
+ @Field(jcrName="wookie:apiKey")
+ private String apiKey;
+
+ @Field(jcrName="wookie:userId")
+ private String userId;
+
+ @Field(jcrName="wookie:sharedDataKey")
+ private String sharedDataKey;
+
+ @Field(jcrName="wookie:nonce")
+ private String nonce;
+
+ @Field(jcrName="wookie:idKey")
+ private String idKey;
+
+ @Field(jcrName="wookie:opensocialToken")
+ private String opensocialToken;
+
+ @Field(jcrName="wookie:updated")
+ private Boolean updated;
+
+ @Field(jcrName="wookie:shown")
+ private Boolean shown;
+
+ @Field(jcrName="wookie:hidden")
+ private Boolean hidden;
+
+ @Field(jcrName="wookie:locked")
+ private Boolean locked;
+
+ @Field(jcrName="wookie:lang")
+ private String lang;
+
+ @Bean(jcrName="wookie:widget", converter=ReferenceBeanConverterImpl.class)
+ private WidgetImpl widgetImpl;
+
+ @org.apache.jackrabbit.ocm.mapper.impl.annotation.Collection(jcrName="wookie:preferences", elementClassName=PreferenceImpl.class)
+ private Collection<PreferenceImpl> preferenceImpls;
+
+ @org.apache.jackrabbit.ocm.mapper.impl.annotation.Collection(jcrName="wookie:tokens", elementClassName=TokenImpl.class)
+ private Collection<TokenImpl> tokenImpls;
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IWidgetInstance#getApiKey()
+ */
+ public String getApiKey()
+ {
+ return apiKey;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IWidgetInstance#setApiKey(java.lang.String)
+ */
+ public void setApiKey(String apiKey)
+ {
+ this.apiKey = apiKey;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IBean#getId()
+ */
+ public Object getId()
+ {
+ return path;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IWidgetInstance#getIdKey()
+ */
+ public String getIdKey()
+ {
+ return idKey;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IWidgetInstance#setIdKey(java.lang.String)
+ */
+ public void setIdKey(String idKey)
+ {
+ this.idKey = idKey;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IWidgetInstance#getLang()
+ */
+ public String getLang()
+ {
+ return lang;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IWidgetInstance#setLang(java.lang.String)
+ */
+ public void setLang(String lang)
+ {
+ this.lang = lang;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.jcr.IPathBean#getNodePath()
+ */
+ public String getNodePath()
+ {
+ return path;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.jcr.IPathBean#setNodePath(java.lang.String)
+ */
+ public String setNodePath(String nodeRootPath)
+ {
+ if (path == null)
+ {
+ path = nodeRootPath+"/"+JCRPersistenceManager.escapeJCRName(userId)+"/"+JCRPersistenceManager.escapeJCRName(apiKey)+"/"+JCRPersistenceManager.escapeJCRName(sharedDataKey)+"/"+JCRPersistenceManager.escapeJCRName(widgetImpl.getGuid());
+ }
+ return path;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IWidgetInstance#getNonce()
+ */
+ public String getNonce()
+ {
+ return nonce;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IWidgetInstance#setNonce(java.lang.String)
+ */
+ public void setNonce(String nonce)
+ {
+ this.nonce = nonce;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IWidgetInstance#getOpensocialToken()
+ */
+ public String getOpensocialToken()
+ {
+ return opensocialToken;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IWidgetInstance#setOpensocialToken(java.lang.String)
+ */
+ public void setOpensocialToken(String opensocialToken)
+ {
+ this.opensocialToken = opensocialToken;
+ }
+
+ /**
+ * Get raw persistent JCR absolute node path.
+ *
+ * @return absolute path
+ */
+ public String getPath()
+ {
+ return path;
+ }
+
+ /**
+ * Set raw persistent JCR absolute node path.
+ *
+ * @param path absolute path
+ */
+ public void setPath(String path)
+ {
+ this.path = path;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IWidgetInstance#getPreferences()
+ */
+ public Collection<IPreference> getPreferences()
+ {
+ if (preferenceImpls == null)
+ {
+ preferenceImpls = new ArrayList<PreferenceImpl>();
+ }
+ return new IdCollection<PreferenceImpl,IPreference>(preferenceImpls);
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IWidgetInstance#setPreferences(java.util.Collection)
+ */
+ public void setPreferences(Collection<IPreference> preferences)
+ {
+ getPreferences().clear();
+ if (preferences != null)
+ {
+ for (IPreference preference : preferences)
+ {
+ getPreferences().add((PreferenceImpl)preference);
+ }
+ }
+ }
+
+ /**
+ * Get preference implementations collection.
+ *
+ * @return preference implementations collection
+ */
+ public Collection<PreferenceImpl> getPreferenceImpls()
+ {
+ return preferenceImpls;
+ }
+
+ /**
+ * Set preference implementations collection.
+ *
+ * @param preferenceImpls preference implementations collection
+ */
+ public void setPreferenceImpls(Collection<PreferenceImpl> preferenceImpls)
+ {
+ this.preferenceImpls = preferenceImpls;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IWidgetInstance#getSharedDataKey()
+ */
+ public String getSharedDataKey()
+ {
+ return sharedDataKey;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IWidgetInstance#setSharedDataKey(java.lang.String)
+ */
+ public void setSharedDataKey(String sharedDataKey)
+ {
+ this.sharedDataKey = sharedDataKey;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IWidgetInstance#getTokens()
+ */
+ public Collection<IToken> getTokens()
+ {
+ if (tokenImpls == null)
+ {
+ tokenImpls = new ArrayList<TokenImpl>();
+ }
+ return new IdCollection<TokenImpl,IToken>(tokenImpls);
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IWidgetInstance#setTokens(java.util.Collection)
+ */
+ public void setTokens(Collection<IToken> tokens)
+ {
+ getTokens().clear();
+ if (tokens != null)
+ {
+ for (IToken token : tokens)
+ {
+ getTokens().add((TokenImpl)token);
+ }
+ }
+ }
+
+ /**
+ * Get token implementations collection.
+ *
+ * @return token implementations collection
+ */
+ public Collection<TokenImpl> getTokenImpls()
+ {
+ return tokenImpls;
+ }
+
+ /**
+ * Set token implementations collection.
+ *
+ * @param tokenImpls token implementations collection
+ */
+ public void setTokenImpls(Collection<TokenImpl> tokenImpls)
+ {
+ this.tokenImpls = tokenImpls;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IWidgetInstance#getUserId()
+ */
+ public String getUserId()
+ {
+ return userId;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IWidgetInstance#setUserId(java.lang.String)
+ */
+ public void setUserId(String userId)
+ {
+ this.userId = userId;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IWidgetInstance#getWidget()
+ */
+ public IWidget getWidget()
+ {
+ return widgetImpl;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IWidgetInstance#setWidget(org.apache.wookie.beans.IWidget)
+ */
+ public void setWidget(IWidget widget)
+ {
+ this.widgetImpl = (WidgetImpl)widget;
+ }
+
+ /**
+ * Get widget implementation.
+ *
+ * @return widget implementation
+ */
+ public WidgetImpl getWidgetImpl()
+ {
+ return widgetImpl;
+ }
+
+ /**
+ * Set widget implementation.
+ *
+ * @return widgetImpl widget implementation
+ */
+ public void setWidgetImpl(WidgetImpl widgetImpl)
+ {
+ this.widgetImpl = widgetImpl;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IWidgetInstance#isHidden()
+ */
+ public boolean isHidden()
+ {
+ return ((hidden != null) ? hidden.booleanValue() : false);
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IWidgetInstance#setHidden(boolean)
+ */
+ public void setHidden(boolean hidden)
+ {
+ this.hidden = (hidden ? Boolean.TRUE : Boolean.FALSE);
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IWidgetInstance#isLocked()
+ */
+ public boolean isLocked()
+ {
+ return ((locked != null) ? locked.booleanValue() : false);
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IWidgetInstance#setLocked(boolean)
+ */
+ public void setLocked(boolean locked)
+ {
+ this.locked = (locked ? Boolean.TRUE : Boolean.FALSE);
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IWidgetInstance#isShown()
+ */
+ public boolean isShown()
+ {
+ return ((shown != null) ? shown.booleanValue() : false);
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IWidgetInstance#setShown(boolean)
+ */
+ public void setShown(boolean shown)
+ {
+ this.shown = (shown ? Boolean.TRUE : Boolean.FALSE);
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IWidgetInstance#isUpdated()
+ */
+ public boolean isUpdated()
+ {
+ return ((updated != null) ? updated.booleanValue() : false);
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IWidgetInstance#setUpdated(boolean)
+ */
+ public void setUpdated(boolean updated)
+ {
+ this.updated = (updated ? Boolean.TRUE : Boolean.FALSE);
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.jcr.IUuidBean#getUuid()
+ */
+ public String getUuid()
+ {
+ return uuid;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.jcr.IUuidBean#setUuid(java.lang.String)
+ */
+ public void setUuid(String uuid)
+ {
+ this.uuid = uuid;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IWidgetInstance#getPreference(java.lang.String)
+ */
+ public IPreference getPreference(String key)
+ {
+ return Utilities.getPreference(this, key);
+ }
+
+}
Added: incubator/wookie/trunk/modules/jcr/src/org/apache/wookie/beans/jcr/impl/WidgetServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/modules/jcr/src/org/apache/wookie/beans/jcr/impl/WidgetServiceImpl.java?rev=1127566&view=auto
==============================================================================
--- incubator/wookie/trunk/modules/jcr/src/org/apache/wookie/beans/jcr/impl/WidgetServiceImpl.java (added)
+++ incubator/wookie/trunk/modules/jcr/src/org/apache/wookie/beans/jcr/impl/WidgetServiceImpl.java Wed May 25 15:46:26 2011
@@ -0,0 +1,102 @@
+/*
+ * 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.apache.wookie.beans.jcr.impl;
+
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Field;
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Node;
+
+import org.apache.wookie.beans.IWidgetService;
+import org.apache.wookie.beans.jcr.IPathBean;
+import org.apache.wookie.beans.jcr.JCRPersistenceManager;
+
+/**
+ * WidgetServiceImpl - JCR OCM IWidgetService implementation.
+ *
+ * @author <a href="mailto:rwatler@apache.org">Randy Watler</a>
+ * @version $Id$
+ */
+@Node(jcrType="wookie:widgetService", discriminator=false)
+public class WidgetServiceImpl implements IWidgetService, IPathBean
+{
+ @Field(path=true)
+ private String path;
+
+ @Field(jcrName="wookie:serviceName")
+ private String serviceName;
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IBean#getId()
+ */
+ public Object getId()
+ {
+ return path;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.jcr.IPathBean#getNodePath()
+ */
+ public String getNodePath()
+ {
+ return path;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.jcr.IPathBean#setNodePath(java.lang.String)
+ */
+ public String setNodePath(String nodeRootPath)
+ {
+ if (path == null)
+ {
+ path = nodeRootPath+"/"+JCRPersistenceManager.escapeJCRName(serviceName);
+ }
+ return path;
+ }
+
+ /**
+ * Get raw persistent JCR absolute node path.
+ *
+ * @return absolute path
+ */
+ public String getPath()
+ {
+ return path;
+ }
+
+ /**
+ * Set raw persistent JCR absolute node path.
+ *
+ * @param path absolute path
+ */
+ public void setPath(String path)
+ {
+ this.path = path;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IWidgetService#getServiceName()
+ */
+ public String getServiceName()
+ {
+ return serviceName;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IWidgetService#setServiceName(java.lang.String)
+ */
+ public void setServiceName(String serviceName)
+ {
+ this.serviceName = serviceName;
+ }
+}
Added: incubator/wookie/trunk/modules/jcr/src/org/apache/wookie/beans/jcr/impl/WidgetTypeImpl.java
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/modules/jcr/src/org/apache/wookie/beans/jcr/impl/WidgetTypeImpl.java?rev=1127566&view=auto
==============================================================================
--- incubator/wookie/trunk/modules/jcr/src/org/apache/wookie/beans/jcr/impl/WidgetTypeImpl.java (added)
+++ incubator/wookie/trunk/modules/jcr/src/org/apache/wookie/beans/jcr/impl/WidgetTypeImpl.java Wed May 25 15:46:26 2011
@@ -0,0 +1,69 @@
+/*
+ * 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.apache.wookie.beans.jcr.impl;
+
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Field;
+import org.apache.jackrabbit.ocm.mapper.impl.annotation.Node;
+
+import org.apache.wookie.beans.IWidgetType;
+import org.apache.wookie.beans.jcr.IIdElement;
+
+/**
+ * WidgetTypeImpl - JCR OCM IWidgetType implementation.
+ *
+ * @author <a href="mailto:rwatler@apache.org">Randy Watler</a>
+ * @version $Id$
+ */
+@Node(jcrType="wookie:widgetType", discriminator=false)
+public class WidgetTypeImpl implements IWidgetType, IIdElement
+{
+ @Field(id=true, jcrName="wookie:elementId")
+ private long elementId = -1;
+
+ @Field(jcrName="wookie:widgetContext")
+ private String widgetContext;
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.jcr.IIdElement#getElementId()
+ */
+ public long getElementId()
+ {
+ return elementId;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.jcr.IIdElement#setElementId(long)
+ */
+ public void setElementId(long elementId)
+ {
+ this.elementId = elementId;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IWidgetType#getWidgetContext()
+ */
+ public String getWidgetContext()
+ {
+ return widgetContext;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IWidgetType#setWidgetContext(java.lang.String)
+ */
+ public void setWidgetContext(String widgetContext)
+ {
+ this.widgetContext = widgetContext;
+ }
+}
Added: incubator/wookie/trunk/modules/jcr/src/org/apache/wookie/beans/jcr/wookie-schema.cnd
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/modules/jcr/src/org/apache/wookie/beans/jcr/wookie-schema.cnd?rev=1127566&view=auto
==============================================================================
--- incubator/wookie/trunk/modules/jcr/src/org/apache/wookie/beans/jcr/wookie-schema.cnd (added)
+++ incubator/wookie/trunk/modules/jcr/src/org/apache/wookie/beans/jcr/wookie-schema.cnd Wed May 25 15:46:26 2011
@@ -0,0 +1,158 @@
+/*
+ * 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.
+ */
+
+<jcr='http://www.jcp.org/jcr/1.0'>
+<nt='http://www.jcp.org/jcr/nt/1.0'>
+<mix='http://www.jcp.org/jcr/mix/1.0'>
+<wookie='http://www.apache.org/wookie/jcr/nt/0.1'>
+
+[wookie:widgetIcon] > nt:base
+- wookie:elementId (long)
+- wookie:src (string)
+- wookie:height (long)
+- wookie:width (long)
+- wookie:lang (string)
+
+[wookie:license] > nt:base
+- wookie:elementId (long)
+- wookie:href (string)
+- wookie:text (string)
+- wookie:dir (string)
+- wookie:lang (string)
+
+[wookie:name] > nt:base
+- wookie:elementId (long)
+- wookie:name (string)
+- wookie:shortName (string)
+- wookie:dir (string)
+- wookie:lang (string)
+
+[wookie:description] > nt:base
+- wookie:elementId (long)
+- wookie:content (string)
+- wookie:dir (string)
+- wookie:lang (string)
+
+[wookie:startFile] > nt:base
+- wookie:elementId (long)
+- wookie:url (string)
+- wookie:charset (string)
+- wookie:lang (string)
+
+[wookie:preferenceDefault] > nt:base
+- wookie:elementId (long)
+- wookie:preference (string) mandatory
+- wookie:value (string) mandatory
+- wookie:readOnly (boolean)
+
+[wookie:sharedData] > nt:base
+- wookie:elementId (long)
+- wookie:sharedDataKey (string)
+- wookie:dkey (string)
+- wookie:dvalue (string)
+
+[wookie:widgetType] > nt:base
+- wookie:elementId (long)
+- wookie:widgetContext (string)
+
+[wookie:param] > nt:base
+- wookie:elementId (long)
+- wookie:parameterName (string) mandatory
+- wookie:parameterValue (string) mandatory
+
+[wookie:feature] > nt:base
+- wookie:elementId (long)
+- wookie:featureName (string) mandatory
+- wookie:required (boolean)
++ wookie:parameters (nt:unstructured) = nt:unstructured
+
+[wookie:widget] > nt:base, mix:referenceable
+- wookie:packagePath (string)
+- wookie:height (long)
+- wookie:width (long)
+- wookie:guid (string) mandatory
+- wookie:updateLocation (string)
+- wookie:widgetAuthor (string)
+- wookie:widgetAuthorEmail (string)
+- wookie:widgetAuthorHref (string)
+- wookie:widgetVersion (string)
+- wookie:dir (string)
+- wookie:lang (string)
++ wookie:widgetTypes (nt:unstructured) = nt:unstructured
++ wookie:accessRequests (nt:unstructured) = nt:unstructured
++ wookie:features (nt:unstructured) = nt:unstructured
++ wookie:widgetIcons (nt:unstructured) = nt:unstructured
++ wookie:licenses (nt:unstructured) = nt:unstructured
++ wookie:names (nt:unstructured) = nt:unstructured
++ wookie:descriptions (nt:unstructured) = nt:unstructured
++ wookie:startFiles (nt:unstructured) = nt:unstructured
++ wookie:preferenceDefaults (nt:unstructured) = nt:unstructured
+
+[wookie:accessRequest] > nt:base
+- wookie:elementId (long)
+- wookie:origin (string)
+- wookie:subdomains (boolean)
+- wookie:granted (boolean)
+- wookie:widget (reference) mandatory
+
+[wookie:widgetDefault] > nt:base
+- wookie:widgetContext (string) mandatory
+- wookie:widget (reference) mandatory
+
+[wookie:participant] > nt:base
+- wookie:participantId (string) mandatory
+- wookie:participantDisplayName (string) mandatory
+- wookie:participantThumbnailUrl (string)
+- wookie:sharedDataKey (string) mandatory
+
+[wookie:preference] > nt:base
+- wookie:elementId (long)
+- wookie:dkey (string)
+- wookie:dvalue (string)
+- wookie:readOnly (boolean)
+
+[wookie:token] > nt:base
+- wookie:elementId (long)
+- wookie:requestUrl (string) mandatory
+- wookie:accessUrl (string) mandatory
+- wookie:authzUrl (string) mandatory
+- wookie:requestToken (string) mandatory
+- wookie:accessToken (string) mandatory
+- wookie:tokenSecret (string) mandatory
+
+[wookie:widgetInstance] > nt:base, mix:referenceable
+- wookie:apiKey (string) mandatory
+- wookie:userId (string) mandatory
+- wookie:sharedDataKey (string)
+- wookie:nonce (string)
+- wookie:idKey (string) mandatory
+- wookie:opensocialToken (string) mandatory
+- wookie:widget (reference) mandatory
+- wookie:updated (boolean)
+- wookie:shown (boolean)
+- wookie:hidden (boolean)
+- wookie:locked (boolean)
+- wookie:lang (string)
++ wookie:preferences (nt:unstructured) = nt:unstructured
++ wookie:tokens (nt:unstructured) = nt:unstructured
+
+[wookie:whitelist] > nt:base
+- wookie:fUrl (string) mandatory
+
+[wookie:apiKey] > nt:base
+- wookie:value (string) mandatory
+- wookie:email (string) mandatory
+
+[wookie:widgetService] > nt:base
+- wookie:serviceName (string) mandatory
Added: incubator/wookie/trunk/src/org/apache/wookie/beans/jpa/JPAModule.java
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/src/org/apache/wookie/beans/jpa/JPAModule.java?rev=1127566&view=auto
==============================================================================
--- incubator/wookie/trunk/src/org/apache/wookie/beans/jpa/JPAModule.java (added)
+++ incubator/wookie/trunk/src/org/apache/wookie/beans/jpa/JPAModule.java Wed May 25 15:46:26 2011
@@ -0,0 +1,124 @@
+/*
+ *
+ * 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.apache.wookie.beans.jpa;
+
+import java.io.File;
+
+import javax.naming.NamingException;
+import javax.sql.DataSource;
+
+import org.apache.commons.dbcp.BasicDataSource;
+import org.apache.commons.dbcp.DataSourceConnectionFactory;
+import org.apache.commons.dbcp.PoolableConnectionFactory;
+import org.apache.commons.dbcp.PoolingDataSource;
+import org.apache.commons.pool.impl.GenericObjectPool;
+import org.apache.wookie.beans.util.IModule;
+import org.apache.wookie.beans.util.PersistenceManagerFactory;
+import org.mortbay.jetty.plus.naming.Resource;
+
+/**
+ * JPA persistence module
+ */
+public class JPAModule implements IModule{
+
+ private static String dbUser;
+ private static String dbPassword;
+ private static String dbDriver;
+ private static String dbUri;
+ private static String dbType;
+
+ public static final String DB_USER_PROPERTY_NAME = "wookie.db.user";
+ public static final String DB_PASSWORD_PROPERTY_NAME = "wookie.db.password";
+ public static final String DB_DRIVER_CLASS_PROPERTY_NAME = "wookie.db.driver";
+ public static final String DB_URI_PROPERTY_NAME = "wookie.db.uri";
+ public static final String DB_TYPE_PROPERTY_NAME = "wookie.db.type";
+
+ public static final String PERSISTENCE_MANAGER_TYPE_PROPERTY_NAME = "wookie.persistence.manager.type";
+ public static final String PERSISTENCE_MANAGER_TYPE_JPA = "jpa";
+
+ public void configure(){
+ dbUser = getSystemProperty(DB_USER_PROPERTY_NAME, "java");
+ dbPassword = getSystemProperty(DB_PASSWORD_PROPERTY_NAME, "java");
+ dbDriver = getSystemProperty(DB_DRIVER_CLASS_PROPERTY_NAME, "org.apache.derby.jdbc.EmbeddedDriver");
+ dbUri = getSystemProperty(DB_URI_PROPERTY_NAME, "jdbc:derby:widgetDatabase/widgetDB;create=true");
+ dbType = getSystemProperty(DB_TYPE_PROPERTY_NAME, "derby");
+
+ System.setProperty(PersistenceManagerFactory.PERSISTENCE_MANAGER_CLASS_NAME_PROPERTY_NAME, JPAPersistenceManager.class.getName());
+ System.setProperty(JPAPersistenceManager.PERSISTENCE_MANAGER_DB_TYPE_PROPERTY_NAME, dbType);
+ }
+
+ public void setup() throws NamingException{
+
+ // setup derby database directory and logging properties
+ if (dbType.equals("derby") && dbUri.startsWith("jdbc:derby:")) {
+ int dbUriArgsIndex = dbUri.indexOf(";", 11);
+ if (dbUriArgsIndex == -1) {
+ dbUriArgsIndex = dbUri.length();
+ }
+ String databasePath = dbUri.substring(11, dbUriArgsIndex);
+ int databaseDirIndex = databasePath.lastIndexOf(File.separatorChar);
+ if ((databaseDirIndex == -1) && (File.separatorChar != '/')) {
+ databaseDirIndex = databasePath.lastIndexOf('/');
+ }
+ if (databaseDirIndex != -1) {
+ String databaseDir = databasePath.substring(0, databaseDirIndex);
+ File databaseDirFile = new File(databaseDir);
+ if (!databaseDirFile.exists()) {
+ databaseDirFile.mkdirs();
+ }
+ String derbyLog = databaseDirFile.getAbsolutePath()+File.separator+"derby.log";
+ System.setProperty("derby.stream.error.file", derbyLog);
+ }
+ }
+
+ // Setup a database connection resource using DBCP
+ BasicDataSource dataSource = new BasicDataSource();
+ dataSource.setDriverClassName(dbDriver);
+ dataSource.setUrl(dbUri);
+ dataSource.setUsername(dbUser);
+ dataSource.setPassword(dbPassword);
+ dataSource.setMaxActive(80);
+ dataSource.setMaxIdle(80);
+ dataSource.setInitialSize(5);
+ dataSource.setMaxOpenPreparedStatements(0);
+
+ // Set up connection pool
+ GenericObjectPool pool = new GenericObjectPool();
+ // setup factory and pooling DataSource
+ DataSourceConnectionFactory factory = new DataSourceConnectionFactory(dataSource);
+ @SuppressWarnings("unused")
+ PoolableConnectionFactory poolableConnectionFactory = new PoolableConnectionFactory(factory,pool,null,null,false,true);
+ DataSource poolingDataSource = new PoolingDataSource(pool);
+
+
+ new Resource(JPAPersistenceManager.WIDGET_DATABASE_JNDI_DATASOURCE_NAME, poolingDataSource);
+ }
+
+ /**
+ * Get configuration system property.
+ *
+ * @param name property name
+ * @param defaultValue default property value
+ * @return property value
+ */
+ private static String getSystemProperty(String name, String defaultValue)
+ {
+ String value = System.getProperty(name);
+ return (((value != null) && (value.length() > 0) && !value.startsWith("$")) ? value : defaultValue);
+ }
+}
Added: incubator/wookie/trunk/src/org/apache/wookie/beans/util/IModule.java
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/src/org/apache/wookie/beans/util/IModule.java?rev=1127566&view=auto
==============================================================================
--- incubator/wookie/trunk/src/org/apache/wookie/beans/util/IModule.java (added)
+++ incubator/wookie/trunk/src/org/apache/wookie/beans/util/IModule.java Wed May 25 15:46:26 2011
@@ -0,0 +1,42 @@
+/*
+ *
+ * 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.apache.wookie.beans.util;
+
+import java.io.IOException;
+
+import javax.naming.NamingException;
+
+/**
+ * Persistence module interface; used to add persistence implementations that can be configured
+ * in standalone mode.
+ */
+public interface IModule {
+
+ /**
+ * Configure system properties
+ */
+ public void configure();
+
+ /**
+ * Setup database and JNDI resource
+ * @throws NamingException
+ * @throws IOException
+ */
+ public void setup() throws NamingException, IOException;
+
+}