You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@clerezza.apache.org by mi...@apache.org on 2010/03/04 14:13:16 UTC

svn commit: r918976 - in /incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.rdf.utils: pom.xml src/main/java/org/apache/clerezza/rdf/utils/EncodedUriRef.java

Author: mir
Date: Thu Mar  4 13:13:16 2010
New Revision: 918976

URL: http://svn.apache.org/viewvc?rev=918976&view=rev
Log:
CLEREZZA-144: implemented EncodedUriRef

Added:
    incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.rdf.utils/src/main/java/org/apache/clerezza/rdf/utils/EncodedUriRef.java
Modified:
    incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.rdf.utils/pom.xml

Modified: incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.rdf.utils/pom.xml
URL: http://svn.apache.org/viewvc/incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.rdf.utils/pom.xml?rev=918976&r1=918975&r2=918976&view=diff
==============================================================================
--- incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.rdf.utils/pom.xml (original)
+++ incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.rdf.utils/pom.xml Thu Mar  4 13:13:16 2010
@@ -1,29 +1,33 @@
 <?xml version="1.0" encoding="UTF-8" standalone="no"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-  <modelVersion>4.0.0</modelVersion>
-  <parent>
-	  <artifactId>org.apache.clerezza.parent</artifactId>
+	<modelVersion>4.0.0</modelVersion>
+	<parent>
+		<artifactId>org.apache.clerezza.parent</artifactId>
 		<groupId>org.apache.clerezza</groupId>
 		<version>0.2-incubating-SNAPSHOT</version>
-  </parent>
-  <groupId>org.apache.clerezza</groupId>
-  <artifactId>org.apache.clerezza.rdf.utils</artifactId>
-  <packaging>bundle</packaging>
-  <version>0.13-incubating-SNAPSHOT</version>
-  <name>Clerezza - SCB Utilities</name>
-  <description>Utility classed to deal with Clerezza Models</description>
-  <dependencies>
-    <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-      <scope>test</scope>
-    </dependency>
-	<dependency>
-      <groupId>org.apache.clerezza</groupId>
-      <artifactId>org.apache.clerezza.rdf.core</artifactId>
-    </dependency>
-	<dependency>
-      <groupId>org.apache.clerezza</groupId>
-      <artifactId>org.apache.clerezza.rdf.ontologies</artifactId>
-    </dependency>
-  </dependencies>
+	</parent>
+	<groupId>org.apache.clerezza</groupId>
+	<artifactId>org.apache.clerezza.rdf.utils</artifactId>
+	<packaging>bundle</packaging>
+	<version>0.13-incubating-SNAPSHOT</version>
+	<name>Clerezza - SCB Utilities</name>
+	<description>Utility classed to deal with Clerezza Models</description>
+	<dependencies>
+		<dependency>
+			<groupId>junit</groupId>
+			<artifactId>junit</artifactId>
+			<scope>test</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.clerezza</groupId>
+			<artifactId>org.apache.clerezza.rdf.core</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.clerezza</groupId>
+			<artifactId>org.apache.clerezza.rdf.ontologies</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.clerezza</groupId>
+			<artifactId>org.apache.clerezza.utils</artifactId>
+		</dependency>
+	</dependencies>
 </project>
\ No newline at end of file

Added: incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.rdf.utils/src/main/java/org/apache/clerezza/rdf/utils/EncodedUriRef.java
URL: http://svn.apache.org/viewvc/incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.rdf.utils/src/main/java/org/apache/clerezza/rdf/utils/EncodedUriRef.java?rev=918976&view=auto
==============================================================================
--- incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.rdf.utils/src/main/java/org/apache/clerezza/rdf/utils/EncodedUriRef.java (added)
+++ incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.rdf.utils/src/main/java/org/apache/clerezza/rdf/utils/EncodedUriRef.java Thu Mar  4 13:13:16 2010
@@ -0,0 +1,73 @@
+/*
+ *  Copyright 2010 mir.
+ * 
+ *  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.apache.clerezza.rdf.utils;
+
+import org.apache.clerezza.rdf.core.UriRef;
+import org.apache.clerezza.utils.UriException;
+import org.apache.clerezza.utils.UriUtil;
+
+/**
+ * Automatically escapes and encodes the uri string regarded as the path 
+ * component of an URI with the default protocol charset.
+ * @author mir
+ */
+public class EncodedUriRef extends UriRef{
+
+	/**
+	 * Creates an encoded UriRef.
+	 *
+	 * @param uriRefString unencoded or partly encoded uri string
+	 * @throws UriException
+	 */
+	public EncodedUriRef(String uriRefString) throws UriException {
+		super(UriUtil.encodePartlyEncodedPath(uriRefString, "UTF-8"));		
+	}
+
+	/**
+	 * Creates an encoded UriRef.
+	 *
+	 * @param uriRefString unencoded or partly encoded uri string
+     * @param charset the charset
+	 * @throws UriException
+	 */
+	public EncodedUriRef(String uriRefString, String charset) throws UriException {
+		super(UriUtil.encodePartlyEncodedPath(uriRefString, charset));
+	}
+
+	/**
+	 * Creates an encoded UriRef.
+	 *
+	 * @param uriRef unencoded or partly encoded UriRef
+	 * @throws UriException
+	 */
+	public EncodedUriRef(UriRef uriRef) throws UriException {
+		super(UriUtil.encodePartlyEncodedPath(uriRef.getUnicodeString(), "UTF-8"));
+	}
+
+	/**
+	 * Creates an encoded UriRef.
+	 *
+	 * @param uriRef unencoded or partly encoded UriRef
+     * @param charset the charset
+	 * @throws UriException
+	 */
+	public EncodedUriRef(UriRef uriRef, String charset) throws UriException {
+		super(UriUtil.encodePartlyEncodedPath(uriRef.getUnicodeString(), charset));
+	}
+
+}