You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stanbol.apache.org by re...@apache.org on 2012/04/04 10:24:48 UTC
svn commit: r1309282 - in /incubator/stanbol/branches/ontonet-showcase:
featured-vfolders/src/main/java/org/apache/stanbol/contenthub/vfolders/
webdav/src/main/java/org/apache/stanbol/webdav/resources/
Author: reto
Date: Wed Apr 4 08:24:47 2012
New Revision: 1309282
URL: http://svn.apache.org/viewvc?rev=1309282&view=rev
Log:
added files illustrating proble with milton
Added:
incubator/stanbol/branches/ontonet-showcase/featured-vfolders/src/main/java/org/apache/stanbol/contenthub/vfolders/FacetedResource.java
incubator/stanbol/branches/ontonet-showcase/featured-vfolders/src/main/java/org/apache/stanbol/contenthub/vfolders/FacetedResource2.java
incubator/stanbol/branches/ontonet-showcase/webdav/src/main/java/org/apache/stanbol/webdav/resources/AbstractCollectionResource.java
Added: incubator/stanbol/branches/ontonet-showcase/featured-vfolders/src/main/java/org/apache/stanbol/contenthub/vfolders/FacetedResource.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/branches/ontonet-showcase/featured-vfolders/src/main/java/org/apache/stanbol/contenthub/vfolders/FacetedResource.java?rev=1309282&view=auto
==============================================================================
--- incubator/stanbol/branches/ontonet-showcase/featured-vfolders/src/main/java/org/apache/stanbol/contenthub/vfolders/FacetedResource.java (added)
+++ incubator/stanbol/branches/ontonet-showcase/featured-vfolders/src/main/java/org/apache/stanbol/contenthub/vfolders/FacetedResource.java Wed Apr 4 08:24:47 2012
@@ -0,0 +1,98 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.stanbol.contenthub.vfolders;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.Date;
+import java.util.Map;
+
+import com.bradmcevoy.http.Auth;
+import com.bradmcevoy.http.GetableResource;
+import com.bradmcevoy.http.PropFindableResource;
+import com.bradmcevoy.http.Range;
+import com.bradmcevoy.http.Request;
+import com.bradmcevoy.http.Request.Method;
+import com.bradmcevoy.http.exceptions.BadRequestException;
+import com.bradmcevoy.http.exceptions.NotAuthorizedException;
+
+public class FacetedResource implements PropFindableResource, GetableResource {
+
+ private static String name = "scratchpad.txt";
+ private static final String MESSAGE = "Hello world";
+
+ public FacetedResource(String name) {
+ this.name = name;
+ }
+
+ public static String getFilename() {
+ return name;
+ }
+
+ public String getUniqueId() {
+ return getFilename();
+ }
+
+
+ public String getName() {
+ return getFilename();
+ }
+
+ public Object authenticate(String user, String password) {
+ return "anonymous";
+ }
+
+ public boolean authorise(Request request, Method method, Auth auth) {
+ return true;
+ }
+
+ public String getRealm() {
+ return null;
+ }
+
+ public Date getCreateDate() {
+ return new Date();
+ }
+
+ public Date getModifiedDate() {
+ return new Date();
+ }
+
+
+ public String checkRedirect(Request request) {
+ return null;
+ }
+
+
+ public Long getMaxAgeSeconds(Auth auth) {
+ return null;
+ }
+
+ public String getContentType(String accepts) {
+ return "text/plain";
+ }
+
+ public Long getContentLength() {
+ return Long.valueOf(MESSAGE.length());
+ }
+
+ public void sendContent(OutputStream out, Range range, Map params, String contentType) throws IOException, NotAuthorizedException, BadRequestException {
+ out.write(MESSAGE.getBytes());
+ }
+}
\ No newline at end of file
Added: incubator/stanbol/branches/ontonet-showcase/featured-vfolders/src/main/java/org/apache/stanbol/contenthub/vfolders/FacetedResource2.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/branches/ontonet-showcase/featured-vfolders/src/main/java/org/apache/stanbol/contenthub/vfolders/FacetedResource2.java?rev=1309282&view=auto
==============================================================================
--- incubator/stanbol/branches/ontonet-showcase/featured-vfolders/src/main/java/org/apache/stanbol/contenthub/vfolders/FacetedResource2.java (added)
+++ incubator/stanbol/branches/ontonet-showcase/featured-vfolders/src/main/java/org/apache/stanbol/contenthub/vfolders/FacetedResource2.java Wed Apr 4 08:24:47 2012
@@ -0,0 +1,98 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.stanbol.contenthub.vfolders;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.Date;
+import java.util.Map;
+
+import com.bradmcevoy.http.Auth;
+import com.bradmcevoy.http.GetableResource;
+import com.bradmcevoy.http.PropFindableResource;
+import com.bradmcevoy.http.Range;
+import com.bradmcevoy.http.Request;
+import com.bradmcevoy.http.Request.Method;
+import com.bradmcevoy.http.exceptions.BadRequestException;
+import com.bradmcevoy.http.exceptions.NotAuthorizedException;
+
+public class FacetedResource2 implements PropFindableResource, GetableResource {
+
+ private static String name = "scratchpad.txt";
+ private static final String MESSAGE = "Hello world";
+
+ public FacetedResource2(String name) {
+ this.name = name;
+ }
+
+ public static String getFilename() {
+ return name;
+ }
+
+ public String getUniqueId() {
+ return getFilename();
+ }
+
+
+ public String getName() {
+ return getFilename();
+ }
+
+ public Object authenticate(String user, String password) {
+ return "anonymous";
+ }
+
+ public boolean authorise(Request request, Method method, Auth auth) {
+ return true;
+ }
+
+ public String getRealm() {
+ return null;
+ }
+
+ public Date getCreateDate() {
+ return new Date();
+ }
+
+ public Date getModifiedDate() {
+ return new Date();
+ }
+
+
+ public String checkRedirect(Request request) {
+ return null;
+ }
+
+
+ public Long getMaxAgeSeconds(Auth auth) {
+ return null;
+ }
+
+ public String getContentType(String accepts) {
+ return "text/plain";
+ }
+
+ public Long getContentLength() {
+ return Long.valueOf(MESSAGE.length());
+ }
+
+ public void sendContent(OutputStream out, Range range, Map params, String contentType) throws IOException, NotAuthorizedException, BadRequestException {
+ out.write(MESSAGE.getBytes());
+ }
+}
\ No newline at end of file
Added: incubator/stanbol/branches/ontonet-showcase/webdav/src/main/java/org/apache/stanbol/webdav/resources/AbstractCollectionResource.java
URL: http://svn.apache.org/viewvc/incubator/stanbol/branches/ontonet-showcase/webdav/src/main/java/org/apache/stanbol/webdav/resources/AbstractCollectionResource.java?rev=1309282&view=auto
==============================================================================
--- incubator/stanbol/branches/ontonet-showcase/webdav/src/main/java/org/apache/stanbol/webdav/resources/AbstractCollectionResource.java (added)
+++ incubator/stanbol/branches/ontonet-showcase/webdav/src/main/java/org/apache/stanbol/webdav/resources/AbstractCollectionResource.java Wed Apr 4 08:24:47 2012
@@ -0,0 +1,25 @@
+package org.apache.stanbol.webdav.resources;
+
+import java.util.List;
+
+import com.bradmcevoy.http.CollectionResource;
+import com.bradmcevoy.http.Resource;
+import com.bradmcevoy.http.exceptions.BadRequestException;
+import com.bradmcevoy.http.exceptions.NotAuthorizedException;
+
+public abstract class AbstractCollectionResource implements CollectionResource {
+
+
+ public Resource child(String childName) throws NotAuthorizedException, BadRequestException {
+ @SuppressWarnings("unchecked")
+ final List<Resource> resources = (List<Resource>) getChildren();
+ for (Resource resource : resources) {
+ if (resource.getName().equals(childName)) {
+ return resource;
+ }
+ }
+ return null;
+ }
+
+
+}