Index: /ComponentRegistry/trunk/ComponentRegistry/pom.xml
===================================================================
--- /ComponentRegistry/trunk/ComponentRegistry/pom.xml	(revision 5552)
+++ /ComponentRegistry/trunk/ComponentRegistry/pom.xml	(revision 5553)
@@ -1,551 +1,551 @@
 
 <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>
-		<groupId>clarin.cmdi</groupId>
-		<artifactId>componentRegistry.parent</artifactId>
-		<version>1.0</version>
-	</parent>
-	<groupId>clarin.cmdi</groupId>
-	<artifactId>ComponentRegistry</artifactId>
-	<packaging>${packaging}</packaging>
-	<version>${ComponentRegistry.version}</version>
-	<name>ComponentRegistry</name>
-	<description>
-	ComponentRegistry is part of the clarin metadata infrastructure (cmdi). 
-	The goal of the ComponentRegistry will be to register and make searchable Metadata Components and Profiles. 
+         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>
+        <groupId>clarin.cmdi</groupId>
+        <artifactId>componentRegistry.parent</artifactId>
+        <version>1.0</version>
+    </parent>
+    <groupId>clarin.cmdi</groupId>
+    <artifactId>ComponentRegistry</artifactId>
+    <packaging>${packaging}</packaging>
+    <version>${ComponentRegistry.version}</version>
+    <name>ComponentRegistry</name>
+    <description>
+        ComponentRegistry is part of the clarin metadata infrastructure (cmdi). 
+        The goal of the ComponentRegistry will be to register and make searchable Metadata Components and Profiles. 
     </description>
 
-	<properties>
-		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-		<packaging>war</packaging>
-		<!-- Properties to configure ComponentRegistry override on commandline 
-			with -D or change here -->
-		<serviceRootUrl>http://localhost:8080/${project.artifactId}</serviceRootUrl>
-		<!-- Will be inserted in context.xml -->
-		<webXmlPath>src/main/webapp/WEB-INF/web-test.xml</webXmlPath>
-		<!-- non-shib web.xml -->
-		<isocatSearchUrl>http://www.isocat.org/rest/user/guest/search</isocatSearchUrl>
-		<ComponentRegistrySwfName>${project.artifactId}-${ComponentBrowserGui.version}</ComponentRegistrySwfName>
-		<flexDebug>0</flexDebug>
-		<spring-data-jpa.version>1.3.4.RELEASE</spring-data-jpa.version>
-		<spring.version>3.2.10.RELEASE</spring.version>
-		<jackson.version>1.9.13</jackson.version>
-		<jersey.version>1.17.1</jersey.version>
-		<!-- hibernate.version>4.2.4.Final</hibernate.version -->
-		<hibernate.version>3.6.10.Final</hibernate.version>
-		<spring-data-jpa.version>1.3.4.RELEASE</spring-data-jpa.version>
-	</properties>
-
-
-	<ciManagement>
-		<system>hudson</system>
-		<url>http://lux16.mpi.nl/jenkins/job/ComponentRegistry/</url>
-	</ciManagement>
-	<scm>
-		<connection>scm:svn:http://svn.clarin.eu/ComponentRegistry/trunk/ComponentRegistry</connection>
-		<developerConnection>scm:svn:http://svn.clarin.eu/ComponentRegistry/trunk/ComponentRegistry</developerConnection>
-		<url>http://trac.clarin.eu/browser/ComponentRegistry</url>
-	</scm>
-
-
-
-	<dependencies>
-		<dependency>
-			<groupId>org.springframework.data</groupId>
-			<artifactId>spring-data-jpa</artifactId>
-			<version>${spring-data-jpa.version}</version>
-		</dependency>
-		<dependency>
-			<groupId>org.hibernate</groupId>
-			<artifactId>hibernate-entitymanager</artifactId>
-			<version>${hibernate.version}</version>
-		</dependency>
-		<dependency>
-			<groupId>junit</groupId>
-			<artifactId>junit</artifactId>
-			<version>4.11</version>
-			<scope>test</scope>
-		</dependency>
-		<dependency>
-			<groupId>javax.servlet</groupId>
-			<artifactId>servlet-api</artifactId>
-			<version>2.5</version>
-			<scope>provided</scope>
-		</dependency>
-		<dependency>
-			<groupId>commons-codec</groupId>
-			<artifactId>commons-codec</artifactId>
-			<version>1.3</version>
-		</dependency>
-		<dependency>
-			<groupId>commons-io</groupId>
-			<artifactId>commons-io</artifactId>
-			<version>1.4</version>
-		</dependency>
-		<dependency>
-			<groupId>commons-lang</groupId>
-			<artifactId>commons-lang</artifactId>
-			<version>2.5</version>
-		</dependency>
-		<dependency>
-			<groupId>commons-fileupload</groupId>
-			<artifactId>commons-fileupload</artifactId>
-			<version>1.2.1</version>
-		</dependency>
-		<dependency>
-			<groupId>commons-collections</groupId>
-			<artifactId>commons-collections</artifactId>
-			<version>3.2.1</version>
-		</dependency>
-		<dependency>
-			<groupId>xml-resolver</groupId>
-			<artifactId>xml-resolver</artifactId>
-			<version>1.2</version>
-		</dependency>
-		<dependency>
-			<groupId>org.slf4j</groupId>
-			<artifactId>slf4j-log4j12</artifactId>
-			<version>1.7.2</version>
-		</dependency>
-		<dependency>
-			<groupId>org.slf4j</groupId>
-			<artifactId>jcl-over-slf4j</artifactId>
-			<version>1.7.2</version>
-		</dependency>
-		<dependency>
-			<groupId>com.sun.jersey.contribs</groupId>
-			<artifactId>jersey-multipart</artifactId>
-			<version>${jersey.version}</version>
-		</dependency>
-		<dependency>
-			<groupId>org.codehaus.jackson</groupId>
-			<artifactId>jackson-core-asl</artifactId>
-			<version>${jackson.version}</version>
-		</dependency>
-		<dependency>
-			<groupId>com.sun.jersey</groupId>
-			<artifactId>jersey-bundle</artifactId>
-			<version>${jersey.version}</version>
-			<exclusions>
-				<!-- Jersey has dependencies with different group ids therefore maven 
-					cannot resolve the conflict and gives me both jars (two of stax and two of 
-					jaxb-impl). Excluding them manually to overcome the problem -->
-				<exclusion>
-					<groupId>stax</groupId>
-					<artifactId>stax-api</artifactId>
-				</exclusion>
-			</exclusions>
-		</dependency>
-		<dependency>
-			<groupId>com.sun.jersey.jersey-test-framework</groupId>
-			<artifactId>jersey-test-framework-grizzly</artifactId>
-			<version>${jersey.version}</version>
-			<scope>test</scope>
-		</dependency>
-		<dependency>
-			<groupId>com.sun.grizzly</groupId>
-			<artifactId>grizzly-servlet-webserver</artifactId>
-			<version>1.9.19</version>
-			<scope>test</scope>
-		</dependency>
-		<dependency>
-			<groupId>xmlunit</groupId>
-			<artifactId>xmlunit</artifactId>
-			<version>1.5</version>
-			<scope>test</scope>
-		</dependency>
-		<dependency>
-			<groupId>com.sun.xml.stream</groupId>
-			<artifactId>sjsxp</artifactId>
-			<version>1.0.1</version>
-		</dependency>
-		<dependency>
-			<groupId>de.mpg.mpgaai</groupId>
-			<artifactId>mpgaai-jaas</artifactId>
-			<version>1.3.2</version>
-			<exclusions>
-				<exclusion>
-					<groupId>commons-logging</groupId>
-					<artifactId>commons-logging</artifactId>
-				</exclusion>
-			</exclusions>
-		</dependency>
-		<dependency>
-			<groupId>de.mpg.mpgaai</groupId>
-			<artifactId>mpgaai-shhaa</artifactId>
-			<version>1.0.4</version>
-			<exclusions>
-				<exclusion>
-					<groupId>commons-logging</groupId>
-					<artifactId>commons-logging</artifactId>
-				</exclusion>
-			</exclusions>
-		</dependency>
-		<dependency>
-			<groupId>org.apache.wicket</groupId>
-			<artifactId>wicket</artifactId>
-			<version>1.4.8</version>
-		</dependency>
-		<dependency>
-			<groupId>org.apache.wicket</groupId>
-			<artifactId>wicket-extensions</artifactId>
-			<version>1.4.8</version>
-		</dependency>
-		<dependency>
-			<groupId>javax.servlet</groupId>
-			<artifactId>jsp-api</artifactId>
-			<version>2.0</version>
-			<scope>provided</scope>
-		</dependency>
-
-		<!-- Spring framework -->
-
-		<dependency>
-			<groupId>org.springframework</groupId>
-			<artifactId>spring-webmvc</artifactId>
-			<version>${spring.version}</version>
-		</dependency>
-		<dependency>
-			<groupId>org.springframework</groupId>
-			<artifactId>spring-test</artifactId>
-			<version>${spring.version}</version>
-			<scope>test</scope>
-		</dependency>
-		<dependency>
-			<groupId>org.springframework</groupId>
-			<artifactId>spring-context</artifactId>
-			<version>${spring.version}</version>
-		</dependency>
-		<dependency>
-			<groupId>org.springframework.data</groupId>
-			<artifactId>spring-data-jpa</artifactId>
-			<version>${spring-data-jpa.version}</version>
-			<exclusions>
-				<exclusion>
-					<artifactId>spring-aop</artifactId>
-					<groupId>org.springframework</groupId>
-				</exclusion>
-				<exclusion>
-					<artifactId>spring-core</artifactId>
-					<groupId>org.springframework</groupId>
-				</exclusion>
-				<exclusion>
-					<artifactId>spring-context</artifactId>
-					<groupId>org.springframework</groupId>
-				</exclusion>
-				<exclusion>
-					<artifactId>spring-beans</artifactId>
-					<groupId>org.springframework</groupId>
-				</exclusion>
-			</exclusions>
-		</dependency>
-		<dependency>
-			<groupId>org.springframework</groupId>
-			<artifactId>spring-core</artifactId>
-			<version>${spring.version}</version>
-		</dependency>
-		<dependency>
-			<groupId>org.apache.wicket</groupId>
-			<artifactId>wicket-spring</artifactId>
-			<version>1.4.8</version>
-			<exclusions>
-				<exclusion>
-					<groupId>org.springframework</groupId>
-					<artifactId>spring</artifactId>
-				</exclusion>
-			</exclusions>
-		</dependency>
-		<dependency>
-			<groupId>com.sun.jersey.contribs</groupId>
-			<artifactId>jersey-spring</artifactId>
-			<version>${jersey.version}</version>
-			<exclusions>
-				<exclusion>
-					<groupId>commons-logging</groupId>
-					<artifactId>commons-logging</artifactId>
-				</exclusion>
-				<exclusion>
-					<artifactId>spring-core</artifactId>
-					<groupId>org.springframework</groupId>
-				</exclusion>
-				<exclusion>
-					<artifactId>spring-aop</artifactId>
-					<groupId>org.springframework</groupId>
-				</exclusion>
-				<exclusion>
-					<artifactId>spring-context</artifactId>
-					<groupId>org.springframework</groupId>
-				</exclusion>
-				<exclusion>
-					<artifactId>spring-web</artifactId>
-					<groupId>org.springframework</groupId>
-				</exclusion>
-				<exclusion>
-					<artifactId>spring-beans</artifactId>
-					<groupId>org.springframework</groupId>
-				</exclusion>
-			</exclusions>
-		</dependency>
-
-		<!-- Database -->
-
-		<dependency>
-			<groupId>commons-dbcp</groupId>
-			<artifactId>commons-dbcp</artifactId>
-			<version>1.4</version>
-		</dependency>
-		<dependency>
-			<groupId>postgresql</groupId>
-			<artifactId>postgresql</artifactId>
-			<version>8.4-701.jdbc3</version>
-			<scope>provided</scope>
-		</dependency>
-		<dependency>
-			<groupId>org.hsqldb</groupId>
-			<artifactId>hsqldb</artifactId>
-			<version>2.2.8</version>
-			<scope>test</scope>
-		</dependency>
-		<dependency>
-			<groupId>clarin.cmdi</groupId>
-			<artifactId>cmd-validate</artifactId>
-			<version>1.2-SNAPSHOT</version>
-		</dependency>
-		<dependency>
-			<groupId>org.slf4j</groupId>
-			<artifactId>jul-to-slf4j</artifactId>
-			<version>1.7.2</version>
-		</dependency>
-	 <dependency>
-	  <groupId>com.google.guava</groupId>
-	  <artifactId>guava</artifactId>
-	  <version>16.0.1</version>
-	 </dependency>
-	</dependencies>
-
-
-	<profiles>
-		<profile>
-			<id>lux16</id>
-			<properties>
-				<serviceRootUrl>http://lux16.mpi.nl/ds/ComponentRegistry</serviceRootUrl>
-				<!-- Will be inserted in context.xml -->
-				<shibLI>http://lux16.mpi.nl/Shibboleth.sso/Login</shibLI>
-				<!-- Shibboleth login URI for SHHAA -->
-				<shibLO>http://lux16.mpi.nl/Shibboleth.sso/Logout</shibLO>
-				<!-- Shibboleth logout URI for SHHAA -->
-				<webXmlPath>src/main/webapp/WEB-INF/web-shib.xml</webXmlPath>
-				<!-- web.xml for shibboleth authentication -->
-			</properties>
-		</profile>
-		<profile>
-			<id>clarin</id>
-			<properties>
-				<serviceRootUrl>http://catalog.clarin.eu/ds/ComponentRegistry</serviceRootUrl>
-				<!-- Will be inserted in context.xml -->
-				<shibLI>https://catalog.clarin.eu/Shibboleth.sso/DiscoJuice</shibLI>
-				<!-- Shibboleth login URI for SHHAA -->
-				<shibLO>https://catalog.clarin.eu/Shibboleth.sso/Logout</shibLO>
-				<!-- Shibboleth logout URI for SHHAA -->
-				<webXmlPath>src/main/webapp/WEB-INF/web-shib.xml</webXmlPath>
-				<!-- web.xml for shibboleth authentication -->
-			</properties>
-		</profile>
-	</profiles>
-
-	<build>
-		<filters>
-			<filter>properties/flexindex.properties</filter>
-		</filters>
-		<resources>
-			<resource>
-				<filtering>false</filtering>
-				<directory>src/generated/jaxb/components</directory>
-			</resource>
-			<resource>
-				<filtering>false</filtering>
-				<directory>src/generated/jaxb/rss</directory>
-			</resource>
-			<resource>
-				<filtering>true</filtering>
-				<directory>src/main/resources</directory>
-			</resource>
-			<resource>
-				<filtering>false</filtering>
-				<directory>src/main/java</directory>
-				<includes>
-					<include>**/*.html</include>
-				</includes>
-			</resource>
-		</resources>
-		<testResources>
-			<testResource>
-				<directory>src/test/resources</directory>
-			</testResource>
-		</testResources>
-		<plugins>
-			<plugin>
-				<groupId>org.apache.maven.plugins</groupId>
-				<artifactId>maven-compiler-plugin</artifactId>
-				<configuration>
-					<source>1.6</source>
-					<target>1.6</target>
-				</configuration>
-			</plugin>
-			<plugin>
-				<groupId>org.apache.maven.plugins</groupId>
-				<artifactId>maven-war-plugin</artifactId>
-				<configuration>
-					<warName>${project.artifactId}</warName>
-					<webXml>${webXmlPath}</webXml>
-					<webResources>
-						<resource>
-							<directory>src/main/webapp</directory>
-							<filtering>true</filtering>
-						</resource>
-					</webResources>
-					<archive>
-						<manifest>
-							<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
-						</manifest>
-					</archive>
-				</configuration>
-			</plugin>
-			<plugin>
-				<groupId>org.jvnet.jaxb2.maven2</groupId>
-				<artifactId>maven-jaxb2-plugin</artifactId>
-				<executions>
-					<execution>
-						<id>jaxb-components</id>
-						<goals>
-							<goal>generate</goal>
-						</goals>
-						<configuration>
-							<schemaDirectory>src/main/binding/components</schemaDirectory>
-							<schemaIncludes>
-								<include>general-component-schema.xsd</include>
-							</schemaIncludes>
-							<bindingDirectory>src/main/binding/components</bindingDirectory>
-							<extension>true</extension>
-							<generateDirectory>${basedir}/src/generated/jaxb/components</generateDirectory>
-							<generatePackage>clarin.cmdi.componentregistry.components</generatePackage>
-							<catalog>src/main/resources/catalog.cat</catalog>
-							<catalogResolver>org.jvnet.jaxb2.maven2.resolver.tools.ClasspathCatalogResolver</catalogResolver>
-						</configuration>
-					</execution>
-					<execution>
-						<id>jaxb-rrs</id>
-						<goals>
-							<goal>generate</goal>
-						</goals>
-						<configuration>
-							<schemaDirectory>src/main/binding/rss</schemaDirectory>
-							<schemaIncludes>
-								<include>rss-2_0.xsd</include>
-							</schemaIncludes>
-							<bindingDirectory>src/main/binding/rss</bindingDirectory>
-							<extension>true</extension>
-							<generateDirectory>${basedir}/src/generated/jaxb/rss</generateDirectory>
-							<generatePackage>clarin.cmdi.componentregistry.rss</generatePackage>
-							<catalog>src/main/resources/catalog.cat</catalog>
-							<catalogResolver>org.jvnet.jaxb2.maven2.resolver.tools.ClasspathCatalogResolver</catalogResolver>
-						</configuration>
-					</execution>
-				</executions>
-			</plugin>
-			<plugin>
-				<groupId>org.apache.maven.plugins</groupId>
-				<artifactId>maven-dependency-plugin</artifactId>
-				<executions>
-					<execution>
-						<id>copy</id>
-						<phase>process-resources</phase>
-						<goals>
-							<goal>copy</goal>
-						</goals>
-						<configuration>
-							<artifactItems>
-								<artifactItem>
-									<groupId>clarin.cmdi</groupId>
-									<artifactId>ComponentBrowserGui</artifactId>
-									<version>${ComponentBrowserGui.version}</version>
-									<type>swf</type>
-									<overWrite>true</overWrite>
-									<outputDirectory>${project.build.directory}/${project.artifactId}-${project.version}</outputDirectory>
-									<destFileName>${ComponentRegistrySwfName}.swf</destFileName>
-								</artifactItem>
-							</artifactItems>
-						</configuration>
-					</execution>
-				</executions>
-			</plugin>
-			<plugin>
-				<artifactId>maven-assembly-plugin</artifactId>
-				<version>2.2.2</version>
-				<executions>
-					<execution>
-						<id>make-assembly</id>
-						<phase>package</phase>
-						<goals>
-							<goal>single</goal>
-						</goals>
-						<configuration>
-							<descriptors>
-								<descriptor>src/main/assembly/release.xml</descriptor>
-							</descriptors>
-						</configuration>
-					</execution>
-				</executions>
-			</plugin>
-			<plugin>
-				<groupId>org.apache.maven.plugins</groupId>
-				<artifactId>maven-surefire-plugin</artifactId>
-				<version>2.13</version>
-				<configuration>
-					<systemProperties>
-						<property>
-							<name>java.util.logging.config.file</name>
-							<value>${project.build.directory}/classes/logging.properties</value>
-						</property>
-					</systemProperties>
-					<additionalClasspathElements>
-						<additionalClasspathElement>src/test/resources</additionalClasspathElement>
-					</additionalClasspathElements>
-				</configuration>
-			</plugin>
-
-		</plugins>
-	</build>
-
-<!--
-	<reporting>
-		<plugins>
-			<plugin>
-				<groupId>org.codehaus.mojo</groupId>
-				<artifactId>findbugs-maven-plugin</artifactId>
-			        <version>2.5.4-SNAPSHOT</version>
-				<configuration>
-					<excludeFilterFile>${basedir}/src/main/resources/findbugs-exclude.xml</excludeFilterFile>
-					<threshold>Normal</threshold>
-					<effort>Min</effort>
-				</configuration>
-			</plugin>
-		</plugins>
-	</reporting>
--->
-	<repositories>
-		<repository>
-			<id>cmdi.clarin.repository</id>
-			<name>Clarin Repository</name>
-			<url>http://catalog.clarin.eu/ds/nexus/content/groups/public/</url>
-		</repository>
-		<!--
-		<repository>
-			<id>sonatype</id>
-			<url>https://oss.sonatype.org/content/groups/public</url>
-		</repository>
-		-->
-	</repositories>
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+        <packaging>war</packaging>
+        <!-- Properties to configure ComponentRegistry override on commandline 
+     			with -D or change here -->
+        <serviceRootUrl>http://localhost:8080/${project.artifactId}</serviceRootUrl>
+        <!-- Will be inserted in context.xml -->
+        <webXmlPath>src/main/webapp/WEB-INF/web-test.xml</webXmlPath>
+        <!-- non-shib web.xml -->
+        <isocatSearchUrl>http://www.isocat.org/rest/user/guest/search</isocatSearchUrl>
+        <ComponentRegistrySwfName>${project.artifactId}-${ComponentBrowserGui.version}</ComponentRegistrySwfName>
+        <flexDebug>0</flexDebug>
+        <spring-data-jpa.version>1.3.4.RELEASE</spring-data-jpa.version>
+        <spring.version>3.2.10.RELEASE</spring.version>
+        <jackson.version>1.9.13</jackson.version>
+        <jersey.version>1.17.1</jersey.version>
+        <!-- hibernate.version>4.2.4.Final</hibernate.version -->
+        <hibernate.version>3.6.10.Final</hibernate.version>
+        <spring-data-jpa.version>1.3.4.RELEASE</spring-data-jpa.version>
+    </properties>
+
+
+    <ciManagement>
+        <system>hudson</system>
+        <url>http://lux16.mpi.nl/jenkins/job/ComponentRegistry/</url>
+    </ciManagement>
+    <scm>
+        <connection>scm:svn:http://svn.clarin.eu/ComponentRegistry/trunk/ComponentRegistry</connection>
+        <developerConnection>scm:svn:http://svn.clarin.eu/ComponentRegistry/trunk/ComponentRegistry</developerConnection>
+        <url>http://trac.clarin.eu/browser/ComponentRegistry</url>
+    </scm>
+
+
+
+    <dependencies>
+        <dependency>
+            <groupId>org.springframework.data</groupId>
+            <artifactId>spring-data-jpa</artifactId>
+            <version>${spring-data-jpa.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.hibernate</groupId>
+            <artifactId>hibernate-entitymanager</artifactId>
+            <version>${hibernate.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>4.11</version>
+            <scope>test</scope>
+        </dependency>       
+        <dependency>
+            <groupId>javax.servlet</groupId>
+            <artifactId>servlet-api</artifactId>
+            <version>2.5</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>commons-codec</groupId>
+            <artifactId>commons-codec</artifactId>
+            <version>1.3</version>
+        </dependency>
+        <dependency>
+            <groupId>commons-io</groupId>
+            <artifactId>commons-io</artifactId>
+            <version>1.4</version>
+        </dependency>
+        <dependency>
+            <groupId>commons-lang</groupId>
+            <artifactId>commons-lang</artifactId>
+            <version>2.5</version>
+        </dependency>
+        <dependency>
+            <groupId>commons-fileupload</groupId>
+            <artifactId>commons-fileupload</artifactId>
+            <version>1.2.1</version>
+        </dependency>
+        <dependency>
+            <groupId>commons-collections</groupId>
+            <artifactId>commons-collections</artifactId>
+            <version>3.2.1</version>
+        </dependency>
+        <dependency>
+            <groupId>xml-resolver</groupId>
+            <artifactId>xml-resolver</artifactId>
+            <version>1.2</version>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-log4j12</artifactId>
+            <version>1.7.2</version>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>jcl-over-slf4j</artifactId>
+            <version>1.7.2</version>
+        </dependency>
+        <dependency>
+            <groupId>com.sun.jersey.contribs</groupId>
+            <artifactId>jersey-multipart</artifactId>
+            <version>${jersey.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.codehaus.jackson</groupId>
+            <artifactId>jackson-core-asl</artifactId>
+            <version>${jackson.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>com.sun.jersey</groupId>
+            <artifactId>jersey-bundle</artifactId>
+            <version>${jersey.version}</version>
+            <exclusions>
+                <!-- Jersey has dependencies with different group ids therefore maven 
+           					cannot resolve the conflict and gives me both jars (two of stax and two of 
+           					jaxb-impl). Excluding them manually to overcome the problem -->
+                <exclusion>
+                    <groupId>stax</groupId>
+                    <artifactId>stax-api</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>com.sun.jersey.jersey-test-framework</groupId>
+            <artifactId>jersey-test-framework-grizzly</artifactId>
+            <version>${jersey.version}</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>com.sun.grizzly</groupId>
+            <artifactId>grizzly-servlet-webserver</artifactId>
+            <version>1.9.19</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>xmlunit</groupId>
+            <artifactId>xmlunit</artifactId>
+            <version>1.5</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>com.sun.xml.stream</groupId>
+            <artifactId>sjsxp</artifactId>
+            <version>1.0.1</version>
+        </dependency>
+        <dependency>
+            <groupId>de.mpg.mpgaai</groupId>
+            <artifactId>mpgaai-jaas</artifactId>
+            <version>1.3.2</version>
+            <exclusions>
+                <exclusion>
+                    <groupId>commons-logging</groupId>
+                    <artifactId>commons-logging</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>de.mpg.mpgaai</groupId>
+            <artifactId>mpgaai-shhaa</artifactId>
+            <version>1.0.4</version>
+            <exclusions>
+                <exclusion>
+                    <groupId>commons-logging</groupId>
+                    <artifactId>commons-logging</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.wicket</groupId>
+            <artifactId>wicket</artifactId>
+            <version>1.4.8</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.wicket</groupId>
+            <artifactId>wicket-extensions</artifactId>
+            <version>1.4.8</version>
+        </dependency>
+        <dependency>
+            <groupId>javax.servlet</groupId>
+            <artifactId>jsp-api</artifactId>
+            <version>2.0</version>
+            <scope>provided</scope>
+        </dependency>
+
+        <!-- Spring framework -->
+
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-webmvc</artifactId>
+            <version>${spring.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-test</artifactId>
+            <version>${spring.version}</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-context</artifactId>
+            <version>${spring.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.data</groupId>
+            <artifactId>spring-data-jpa</artifactId>
+            <version>${spring-data-jpa.version}</version>
+            <exclusions>
+                <exclusion>
+                    <artifactId>spring-aop</artifactId>
+                    <groupId>org.springframework</groupId>
+                </exclusion>
+                <exclusion>
+                    <artifactId>spring-core</artifactId>
+                    <groupId>org.springframework</groupId>
+                </exclusion>
+                <exclusion>
+                    <artifactId>spring-context</artifactId>
+                    <groupId>org.springframework</groupId>
+                </exclusion>
+                <exclusion>
+                    <artifactId>spring-beans</artifactId>
+                    <groupId>org.springframework</groupId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-core</artifactId>
+            <version>${spring.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.wicket</groupId>
+            <artifactId>wicket-spring</artifactId>
+            <version>1.4.8</version>
+            <exclusions>
+                <exclusion>
+                    <groupId>org.springframework</groupId>
+                    <artifactId>spring</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>com.sun.jersey.contribs</groupId>
+            <artifactId>jersey-spring</artifactId>
+            <version>${jersey.version}</version>
+            <exclusions>
+                <exclusion>
+                    <groupId>commons-logging</groupId>
+                    <artifactId>commons-logging</artifactId>
+                </exclusion>
+                <exclusion>
+                    <artifactId>spring-core</artifactId>
+                    <groupId>org.springframework</groupId>
+                </exclusion>
+                <exclusion>
+                    <artifactId>spring-aop</artifactId>
+                    <groupId>org.springframework</groupId>
+                </exclusion>
+                <exclusion>
+                    <artifactId>spring-context</artifactId>
+                    <groupId>org.springframework</groupId>
+                </exclusion>
+                <exclusion>
+                    <artifactId>spring-web</artifactId>
+                    <groupId>org.springframework</groupId>
+                </exclusion>
+                <exclusion>
+                    <artifactId>spring-beans</artifactId>
+                    <groupId>org.springframework</groupId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+
+        <!-- Database -->
+
+        <dependency>
+            <groupId>commons-dbcp</groupId>
+            <artifactId>commons-dbcp</artifactId>
+            <version>1.4</version>
+        </dependency>
+        <dependency>
+            <groupId>postgresql</groupId>
+            <artifactId>postgresql</artifactId>
+            <version>8.4-701.jdbc3</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.hsqldb</groupId>
+            <artifactId>hsqldb</artifactId>
+            <version>2.2.8</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>clarin.cmdi</groupId>
+            <artifactId>cmd-validate</artifactId>
+            <version>1.2-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>jul-to-slf4j</artifactId>
+            <version>1.7.2</version>
+        </dependency>
+        <dependency>
+            <groupId>com.google.guava</groupId>
+            <artifactId>guava</artifactId>
+            <version>16.0.1</version>
+        </dependency>
+    </dependencies>
+
+
+    <profiles>
+        <profile>
+            <id>lux16</id>
+            <properties>
+                <serviceRootUrl>http://lux16.mpi.nl/ds/ComponentRegistry</serviceRootUrl>
+                <!-- Will be inserted in context.xml -->
+                <shibLI>http://lux16.mpi.nl/Shibboleth.sso/Login</shibLI>
+                <!-- Shibboleth login URI for SHHAA -->
+                <shibLO>http://lux16.mpi.nl/Shibboleth.sso/Logout</shibLO>
+                <!-- Shibboleth logout URI for SHHAA -->
+                <webXmlPath>src/main/webapp/WEB-INF/web-shib.xml</webXmlPath>
+                <!-- web.xml for shibboleth authentication -->
+            </properties>
+        </profile>
+        <profile>
+            <id>clarin</id>
+            <properties>
+                <serviceRootUrl>http://catalog.clarin.eu/ds/ComponentRegistry</serviceRootUrl>
+                <!-- Will be inserted in context.xml -->
+                <shibLI>https://catalog.clarin.eu/Shibboleth.sso/DiscoJuice</shibLI>
+                <!-- Shibboleth login URI for SHHAA -->
+                <shibLO>https://catalog.clarin.eu/Shibboleth.sso/Logout</shibLO>
+                <!-- Shibboleth logout URI for SHHAA -->
+                <webXmlPath>src/main/webapp/WEB-INF/web-shib.xml</webXmlPath>
+                <!-- web.xml for shibboleth authentication -->
+            </properties>
+        </profile>
+    </profiles>
+
+    <build>
+        <filters>
+            <filter>properties/flexindex.properties</filter>
+        </filters>
+        <resources>
+            <resource>
+                <filtering>false</filtering>
+                <directory>src/generated/jaxb/components</directory>
+            </resource>
+            <resource>
+                <filtering>false</filtering>
+                <directory>src/generated/jaxb/rss</directory>
+            </resource>
+            <resource>
+                <filtering>true</filtering>
+                <directory>src/main/resources</directory>
+            </resource>
+            <resource>
+                <filtering>false</filtering>
+                <directory>src/main/java</directory>
+                <includes>
+                    <include>**/*.html</include>
+                </includes>
+            </resource>
+        </resources>
+        <testResources>
+            <testResource>
+                <directory>src/test/resources</directory>
+            </testResource>
+        </testResources>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <configuration>
+                    <source>1.6</source>
+                    <target>1.6</target>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-war-plugin</artifactId>
+                <configuration>
+                    <warName>${project.artifactId}</warName>
+                    <webXml>${webXmlPath}</webXml>
+                    <webResources>
+                        <resource>
+                            <directory>src/main/webapp</directory>
+                            <filtering>true</filtering>
+                        </resource>
+                    </webResources>
+                    <archive>
+                        <manifest>
+                            <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
+                        </manifest>
+                    </archive>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.jvnet.jaxb2.maven2</groupId>
+                <artifactId>maven-jaxb2-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>jaxb-components</id>
+                        <goals>
+                            <goal>generate</goal>
+                        </goals>
+                        <configuration>
+                            <schemaDirectory>src/main/binding/components</schemaDirectory>
+                            <schemaIncludes>
+                                <include>general-component-schema.xsd</include>
+                            </schemaIncludes>
+                            <bindingDirectory>src/main/binding/components</bindingDirectory>
+                            <extension>true</extension>
+                            <generateDirectory>${basedir}/src/generated/jaxb/components</generateDirectory>
+                            <generatePackage>clarin.cmdi.componentregistry.components</generatePackage>
+                            <catalog>src/main/resources/catalog.cat</catalog>
+                            <catalogResolver>org.jvnet.jaxb2.maven2.resolver.tools.ClasspathCatalogResolver</catalogResolver>
+                        </configuration>
+                    </execution>
+                    <execution>
+                        <id>jaxb-rrs</id>
+                        <goals>
+                            <goal>generate</goal>
+                        </goals>
+                        <configuration>
+                            <schemaDirectory>src/main/binding/rss</schemaDirectory>
+                            <schemaIncludes>
+                                <include>rss-2_0.xsd</include>
+                            </schemaIncludes>
+                            <bindingDirectory>src/main/binding/rss</bindingDirectory>
+                            <extension>true</extension>
+                            <generateDirectory>${basedir}/src/generated/jaxb/rss</generateDirectory>
+                            <generatePackage>clarin.cmdi.componentregistry.rss</generatePackage>
+                            <catalog>src/main/resources/catalog.cat</catalog>
+                            <catalogResolver>org.jvnet.jaxb2.maven2.resolver.tools.ClasspathCatalogResolver</catalogResolver>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-dependency-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>copy</id>
+                        <phase>process-resources</phase>
+                        <goals>
+                            <goal>copy</goal>
+                        </goals>
+                        <configuration>
+                            <artifactItems>
+                                <artifactItem>
+                                    <groupId>clarin.cmdi</groupId>
+                                    <artifactId>ComponentBrowserGui</artifactId>
+                                    <version>${ComponentBrowserGui.version}</version>
+                                    <type>swf</type>
+                                    <overWrite>true</overWrite>
+                                    <outputDirectory>${project.build.directory}/${project.artifactId}-${project.version}</outputDirectory>
+                                    <destFileName>${ComponentRegistrySwfName}.swf</destFileName>
+                                </artifactItem>
+                            </artifactItems>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <artifactId>maven-assembly-plugin</artifactId>
+                <version>2.2.2</version>
+                <executions>
+                    <execution>
+                        <id>make-assembly</id>
+                        <phase>package</phase>
+                        <goals>
+                            <goal>single</goal>
+                        </goals>
+                        <configuration>
+                            <descriptors>
+                                <descriptor>src/main/assembly/release.xml</descriptor>
+                            </descriptors>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-surefire-plugin</artifactId>
+                <version>2.13</version>
+                <configuration>
+                    <systemProperties>
+                        <property>
+                            <name>java.util.logging.config.file</name>
+                            <value>${project.build.directory}/classes/logging.properties</value>
+                        </property>
+                    </systemProperties>
+                    <additionalClasspathElements>
+                        <additionalClasspathElement>src/test/resources</additionalClasspathElement>
+                    </additionalClasspathElements>
+                </configuration>
+            </plugin>
+
+        </plugins>
+    </build>
+
+    <!--
+           	<reporting>
+                  		<plugins>
+                         			<plugin>
+                                				<groupId>org.codehaus.mojo</groupId>
+                                				<artifactId>findbugs-maven-plugin</artifactId>
+                         			        <version>2.5.4-SNAPSHOT</version>
+                                				<configuration>
+                                       					<excludeFilterFile>${basedir}/src/main/resources/findbugs-exclude.xml</excludeFilterFile>
+                                       					<threshold>Normal</threshold>
+                                       					<effort>Min</effort>
+                                				</configuration>
+                         			</plugin>
+                  		</plugins>
+           	</reporting>
+    -->
+    <repositories>
+        <repository>
+            <id>cmdi.clarin.repository</id>
+            <name>Clarin Repository</name>
+            <url>http://catalog.clarin.eu/ds/nexus/content/groups/public/</url>
+        </repository>
+        <!--
+      		<repository>
+             			<id>sonatype</id>
+             			<url>https://oss.sonatype.org/content/groups/public</url>
+      		</repository>
+      		-->
+    </repositories>
 </project>
Index: /ComponentRegistry/trunk/ComponentRegistry/src/main/java/clarin/cmdi/componentregistry/ComponentRegistry.java
===================================================================
--- /ComponentRegistry/trunk/ComponentRegistry/src/main/java/clarin/cmdi/componentregistry/ComponentRegistry.java	(revision 5552)
+++ /ComponentRegistry/trunk/ComponentRegistry/src/main/java/clarin/cmdi/componentregistry/ComponentRegistry.java	(revision 5553)
@@ -236,3 +236,7 @@
     Boolean isItemPublic(String id) throws ItemNotFoundException;
     
+    Number makeGroupMember(String principalName, String groupName) throws  UserUnauthorizedException, ItemNotFoundException;
+    
+    //long removeGroupMember(String principalName, String groupName) throws  UserUnauthorizedException, ItemNotFoundException;
+    
 }
Index: /ComponentRegistry/trunk/ComponentRegistry/src/main/java/clarin/cmdi/componentregistry/impl/database/ComponentRegistryDbImpl.java
===================================================================
--- /ComponentRegistry/trunk/ComponentRegistry/src/main/java/clarin/cmdi/componentregistry/impl/database/ComponentRegistryDbImpl.java	(revision 5552)
+++ /ComponentRegistry/trunk/ComponentRegistry/src/main/java/clarin/cmdi/componentregistry/impl/database/ComponentRegistryDbImpl.java	(revision 5553)
@@ -48,4 +48,5 @@
 import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.dao.DataAccessException;
+import org.springframework.orm.jpa.vendor.Database;
 import org.springframework.transaction.annotation.Transactional;
 
@@ -154,5 +155,28 @@
         }
     }
-
+    
+    @Override
+    public Number makeGroupMember(String principalName, String groupName) throws  UserUnauthorizedException, ItemNotFoundException{
+        RegistryUser regOwner = userDao.getPrincipalNameById(registryOwner.getId());
+        if  (groupService.isUserOwnerOfGroup(groupName, regOwner.getPrincipalName()) || 
+                configuration.isAdminUser(regOwner.getPrincipalName())) {
+        return groupService.makeMember(principalName, groupName);
+        } else {
+            throw new UserUnauthorizedException("The registry owner is not the admin or not the owner of the group and cannot add users to the group");
+        }
+    }
+    
+//    @Override
+//    public long removeGroupMember(String principalName, String groupName) throws  UserUnauthorizedException, ItemNotFoundException{
+//        RegistryUser regOwner = userDao.getPrincipalNameById(registryOwner.getId());
+//        if  (groupService.isUserOwnerOfGroup(groupName, regOwner.getPrincipalName()) || 
+//                configuration.isAdminUser(regOwner.getPrincipalName())) {
+//        return groupService.removeMember(principalName, groupName);
+//        } else {
+//            throw new UserUnauthorizedException("The registry owner is not the admin or not the owner of the group and cannot add users to the group");
+//        }
+//    }
+    
+   
     @Override
     public List<ProfileDescription> getProfileDescriptions() throws ComponentRegistryException, UserUnauthorizedException {
@@ -960,3 +984,5 @@
         }
     }
+    
+    
 }
Index: /ComponentRegistry/trunk/ComponentRegistry/src/main/java/clarin/cmdi/componentregistry/impl/database/GroupService.java
===================================================================
--- /ComponentRegistry/trunk/ComponentRegistry/src/main/java/clarin/cmdi/componentregistry/impl/database/GroupService.java	(revision 5552)
+++ /ComponentRegistry/trunk/ComponentRegistry/src/main/java/clarin/cmdi/componentregistry/impl/database/GroupService.java	(revision 5553)
@@ -1,4 +1,5 @@
 package clarin.cmdi.componentregistry.impl.database;
 
+import clarin.cmdi.componentregistry.ItemNotFoundException;
 import clarin.cmdi.componentregistry.UserUnauthorizedException;
 import java.util.List;
@@ -49,11 +50,6 @@
     List<String> listGroupNames();
 
-    /**
-     * Determines whether a user is the direct owner of a group
-     * @param groupId
-     * @param user
-     * @return
-     */
-    boolean isUserOwnerOfGroup(long groupId, RegistryUser user);
+   
+    boolean isUserOwnerOfGroup(String groupName, String ownerPrincipalName);
     
     /**
@@ -88,5 +84,7 @@
      * @return database ID of group membership row
      */
-    long makeMember(String userName, String groupName);
+    long makeMember(String userName, String groupName) throws ItemNotFoundException;
+    
+   // long removeMember(String userName, String groupName) throws ItemNotFoundException;
     
     /**
@@ -130,3 +128,6 @@
     boolean userGroupMember(String principalName, String groupId);
    
+    public  Number  getGroupIdByName(String groupName) throws ItemNotFoundException;
+    
+    public  String  getGroupNameById(long groupId) throws ItemNotFoundException;
 }
Index: /ComponentRegistry/trunk/ComponentRegistry/src/main/java/clarin/cmdi/componentregistry/impl/database/GroupServiceImpl.java
===================================================================
--- /ComponentRegistry/trunk/ComponentRegistry/src/main/java/clarin/cmdi/componentregistry/impl/database/GroupServiceImpl.java	(revision 5552)
+++ /ComponentRegistry/trunk/ComponentRegistry/src/main/java/clarin/cmdi/componentregistry/impl/database/GroupServiceImpl.java	(revision 5553)
@@ -1,4 +1,5 @@
 package clarin.cmdi.componentregistry.impl.database;
 
+import clarin.cmdi.componentregistry.ItemNotFoundException;
 import clarin.cmdi.componentregistry.UserUnauthorizedException;
 import java.util.ArrayList;
@@ -34,7 +35,7 @@
  * functions over JMX, that's why some methods use human-friendly names (user
  * principal names, group names) rather than ID arguments.
- * 
+ *
  * @author george.georgovassilis@mpi.nl
- * 
+ *
  */
 @ManagedResource(objectName = "componentregistry:name=GroupService", description = "Operations for managing groups")
@@ -43,265 +44,339 @@
 public class GroupServiceImpl implements GroupService {
 
-	@Autowired
-	private GroupDao groupDao;
-	@Autowired
-	private GroupMembershipDao groupMembershipDao;
-	@Autowired
-	private OwnershipDao ownershipDao;
-	@Autowired
-	private ComponentDao componentDao;
-	@Autowired
-	private UserDao userDao;
-
-	public void setGroupDao(GroupDao groupDao) {
-		this.groupDao = groupDao;
-	}
-
-	public void setGroupMembershipDao(GroupMembershipDao groupMembershipDao) {
-		this.groupMembershipDao = groupMembershipDao;
-	}
-
-	public void setOwnershipDao(OwnershipDao ownershipDao) {
-		this.ownershipDao = ownershipDao;
-	}
-
-	@Override
-	public List<Group> getGroupsOwnedByUser(String ownerPrincipalName) {
-		RegistryUser owner = userDao.getByPrincipalName(ownerPrincipalName);
-		return groupDao.findGroupOwnedByUser(owner.getId().longValue());
-	}
-
-	@Override
-	public boolean isUserOwnerOfGroup(long groupId, RegistryUser user) {
-		List<Group> groups = getGroupsOwnedByUser(user.getPrincipalName());
-		for (Group group : groups)
-			if (group.getId() == groupId)
-				return true;
-		return false;
-	}
-
-	private void checkOwnership(Ownership ownership) {
-		if (ownership.getComponentId() == null)
-			throw new RuntimeException("Ownership needs a componentId");
-		if (ownership.getUserId() == 0 && ownership.getGroupId() == 0)
-			throw new RuntimeException("Ownership needs a groupId or userId");
-		if (ownership.getUserId() != 0 && ownership.getGroupId() != 0)
-			throw new RuntimeException("Ownership has both a groupId and a userId ");
-	}
-
-	private void assertOwnershipDoesNotExist(Ownership ownership) {
-		Ownership o = ownershipDao.findOwnershipByGroupAndComponent(ownership.getGroupId(), ownership.getComponentId());
-		if (o != null)
-			throw new ValidationException("Ownership exists");
-	}
-
-	@Override
-	public void addOwnership(Ownership ownership) {
-		checkOwnership(ownership);
-		assertOwnershipDoesNotExist(ownership);
-		ownershipDao.save(ownership);
-	}
-
-	@Override
-	public void removeOwnership(Ownership ownership) {
-		throw new RuntimeException("not implemented");
-	}
-
-	protected boolean canUserAccessAbstractDescriptionEitherOnHisOwnOrThroughGroupMembership(RegistryUser user,
-			BaseDescription description) {
-		// TODO make some joins and multi-id queries to speed the entire method
-		// up
-		boolean isProfile = (description instanceof ProfileDescription);
-		long userId = user.getId().longValue();
-		// anyone can access public profile
-		if (componentDao.isPublic(description.getId()))
-			return true;
-		// the creator can also access any profile
-		if (description.getUserId().equals(user.getId() + ""))
-			return true;
-
-		// a co-ownership on the profile also allows access
-		Ownership ownership = ownershipDao.findOwnershipByUserAndComponent(userId, description.getId());
-		if (ownership != null)
-			return true;
-
-		// get a list of groups the user owns and is a member of
-		List<Group> groups = groupDao.findGroupOwnedByUser(userId);
-		Set<Long> groupIds = new HashSet<Long>();
-		for (Group group : groups)
-			groupIds.add(group.getId());
-
-		List<GroupMembership> memberships = groupMembershipDao.findGroupsTheUserIsAmemberOf(userId);
-		for (GroupMembership gm : memberships)
-			groupIds.add(gm.getGroupId());
-
-		for (Long groupId : groupIds) {
-			ownership = ownershipDao.findOwnershipByGroupAndComponent(groupId, description.getId());
-			if (ownership != null)
-				return true;
-		}
-		return false;
-	}
-
-	@Override
-	public boolean canUserAccessComponentEitherOnHisOwnOrThroughGroupMembership(RegistryUser user,
-			BaseDescription baseDescription) {
-		return canUserAccessAbstractDescriptionEitherOnHisOwnOrThroughGroupMembership(user, baseDescription);
-	}
-
-	@Override
-	@ManagedOperation(description = "Make a user member of a group")
-	@ManagedOperationParameters({
-			@ManagedOperationParameter(name = "principalName", description = "Principal name of the user to make a member"),
-			@ManagedOperationParameter(name = "groupName", description = "Name of the group") })
-	public long makeMember(String userPrincipalName, String groupName) {
-		RegistryUser user = userDao.getByPrincipalName(userPrincipalName);
-		Group group = groupDao.findGroupByName(groupName);
-		GroupMembership gm = groupMembershipDao.findMembership(user.getId().longValue(), group.getId());
-		if (gm != null)
-			return gm.getId();
-		gm = new GroupMembership();
-		gm.setGroupId(group.getId());
-		gm.setUserId(user.getId().longValue());
-		return groupMembershipDao.save(gm).getId();
-	}
-
-	@ManagedOperation(description = "Create a new group")
-	@ManagedOperationParameters({
-			@ManagedOperationParameter(name = "name", description = "Name of the group, must be unique"),
-			@ManagedOperationParameter(name = "ownerPrincipalName", description = "Principal name of the user") })
-	@Override
-	public long createNewGroup(String name, String ownerPrincipalName) {
-		RegistryUser owner = userDao.getByPrincipalName(ownerPrincipalName);
-		if (owner == null)
-			throw new ValidationException("No principal '" + ownerPrincipalName + "' found");
-		Group group = groupDao.findGroupByName(name);
-		if (group != null)
-			throw new ValidationException("Group '" + name + "' already exists");
-		group = new Group();
-		group.setName(name);
-		group.setOwnerId(owner.getId().longValue());
-		group = groupDao.save(group);
-		return group.getId();
-	}
-
-	@ManagedOperation(description = "List available groups")
-	@Override
-	public List<String> listGroupNames() {
-		List<String> groupNames = new ArrayList<String>();
-		for (Group group : groupDao.findAll())
-			groupNames.add(group.getName());
-		return groupNames;
-	}
-
-	@Override
-	public List<Group> getGroupsOfWhichUserIsAMember(String principal) {
-		RegistryUser user = userDao.getByPrincipalName(principal);
-		if (user == null || user.getId() == null)
-			return new ArrayList<Group>();
-		List<GroupMembership> memberships = groupMembershipDao.findGroupsTheUserIsAmemberOf(user.getId().longValue());
-		List<Group> groups = new ArrayList<Group>();
-		for (GroupMembership m : memberships)
-			groups.add(groupDao.findOne(m.getGroupId()));
-		return groups;
-	}
-
-	@Override
-	public List<String> getComponentIdsInGroup(long groupId) {
-		List<Ownership> ownerships = ownershipDao.findOwnershipByGroup(groupId);
-		Set<String> componentIds = new HashSet<String>();
-		for (Ownership o : ownerships)
-			if (ComponentUtils.isComponentId(o.getComponentId()))
-				componentIds.add(o.getComponentId());
-		List<String> idsList = new ArrayList<String>(componentIds);
-		Collections.sort(idsList);
-		return idsList;
-	}
-
-	@Override
-	public List<String> getProfileIdsInGroup(long groupId) {
-		List<Ownership> ownerships = ownershipDao.findOwnershipByGroup(groupId);
-		Set<String> profileIds = new HashSet<String>();
-		for (Ownership o : ownerships)
-			if (ComponentUtils.isProfileId(o.getComponentId()))
-				profileIds.add(o.getComponentId());
-		List<String> idsList = new ArrayList<String>(profileIds);
-		Collections.sort(idsList);
-		return idsList;
-	}
-
-	@Override
-	public List<Group> getGroupsTheItemIsAMemberOf(String itemId) {
-		Set<Ownership> ownerships = new HashSet<Ownership>();
-		ownerships.addAll(ownershipDao.findOwnershipByComponentId(itemId));
-		Set<Group> groups = new HashSet<Group>();
-		for (Ownership ownership : ownerships) {
-			groups.add(groupDao.findOne(ownership.getGroupId()));
-                }
-		List<Group> groupList = new ArrayList<Group>(groups);
-		Collections.sort(groupList, new Comparator<Group>() {
-
-			@Override
-			public int compare(Group g1, Group g2) {
-				return (int) (g1.getId() - g2.getId());
-			}
-		});
-		return groupList;
-	}
+    @Autowired
+    private GroupDao groupDao;
+    @Autowired
+    private GroupMembershipDao groupMembershipDao;
+    @Autowired
+    private OwnershipDao ownershipDao;
+    @Autowired
+    private ComponentDao componentDao;
+    @Autowired
+    private UserDao userDao;
+
+    public void setGroupDao(GroupDao groupDao) {
+        this.groupDao = groupDao;
+    }
+
+    public void setGroupMembershipDao(GroupMembershipDao groupMembershipDao) {
+        this.groupMembershipDao = groupMembershipDao;
+    }
+
+    public void setOwnershipDao(OwnershipDao ownershipDao) {
+        this.ownershipDao = ownershipDao;
+    }
+
+    @Override
+    public List<Group> getGroupsOwnedByUser(String ownerPrincipalName) {
+        RegistryUser owner = userDao.getByPrincipalName(ownerPrincipalName);
+        return groupDao.findGroupOwnedByUser(owner.getId().longValue());
+    }
+
+    @Override
+    public boolean isUserOwnerOfGroup(String groupName, String ownerPrincipalName) {
+        List<Group> groups = getGroupsOwnedByUser(ownerPrincipalName);
+        for (Group group : groups) {
+            if (group.getName().equals(groupName)) {
+                return true;
+            }
+        }
+
+        return false;
+    }
+
+    private void checkOwnership(Ownership ownership) {
+        if (ownership.getComponentId() == null) {
+            throw new RuntimeException("Ownership needs a componentId");
+        }
+        if (ownership.getUserId() == 0 && ownership.getGroupId() == 0) {
+            throw new RuntimeException("Ownership needs a groupId or userId");
+        }
+        if (ownership.getUserId() != 0 && ownership.getGroupId() != 0) {
+            throw new RuntimeException("Ownership has both a groupId and a userId ");
+        }
+    }
+
+    private void assertOwnershipDoesNotExist(Ownership ownership) {
+        Ownership o = ownershipDao.findOwnershipByGroupAndComponent(ownership.getGroupId(), ownership.getComponentId());
+        if (o != null) {
+            throw new ValidationException("Ownership exists");
+        }
+    }
+
+    @Override
+    public void addOwnership(Ownership ownership) {
+        checkOwnership(ownership);
+        assertOwnershipDoesNotExist(ownership);
+        ownershipDao.save(ownership);
+    }
+
+    @Override
+    public void removeOwnership(Ownership ownership) {
+        throw new RuntimeException("not implemented");
+    }
+
+    protected boolean canUserAccessAbstractDescriptionEitherOnHisOwnOrThroughGroupMembership(RegistryUser user,
+            BaseDescription description) {
+        // TODO make some joins and multi-id queries to speed the entire method
+        // up
+        boolean isProfile = (description instanceof ProfileDescription);
+        long userId = user.getId().longValue();
+        // anyone can access public profile
+        if (componentDao.isPublic(description.getId())) {
+            return true;
+        }
+        // the creator can also access any profile
+        if (description.getUserId().equals(user.getId() + "")) {
+            return true;
+        }
+
+        // a co-ownership on the profile also allows access
+        Ownership ownership = ownershipDao.findOwnershipByUserAndComponent(userId, description.getId());
+        if (ownership != null) {
+            return true;
+        }
+
+        // get a list of groups the user owns and is a member of
+        List<Group> groups = groupDao.findGroupOwnedByUser(userId);
+        Set<Long> groupIds = new HashSet<Long>();
+        for (Group group : groups) {
+            groupIds.add(group.getId());
+        }
+
+        List<GroupMembership> memberships = groupMembershipDao.findGroupsTheUserIsAmemberOf(userId);
+        for (GroupMembership gm : memberships) {
+            groupIds.add(gm.getGroupId());
+        }
+
+        for (Long groupId : groupIds) {
+            ownership = ownershipDao.findOwnershipByGroupAndComponent(groupId, description.getId());
+            if (ownership != null) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    @Override
+    public boolean canUserAccessComponentEitherOnHisOwnOrThroughGroupMembership(RegistryUser user,
+            BaseDescription baseDescription) {
+        return canUserAccessAbstractDescriptionEitherOnHisOwnOrThroughGroupMembership(user, baseDescription);
+    }
+
+    @Override
+    @ManagedOperation(description = "Make a user member of a group")
+    @ManagedOperationParameters({
+        @ManagedOperationParameter(name = "principalName", description = "Principal name of the user to make a member"),
+        @ManagedOperationParameter(name = "groupName", description = "Name of the group")})
+    public long makeMember(String userPrincipalName, String groupName) throws ItemNotFoundException{
         
+        RegistryUser user = userDao.getByPrincipalName(userPrincipalName);
         
-
-	@ManagedOperation(description = "Make a component owned by a group instead of a user")
-	@ManagedOperationParameters({
-			@ManagedOperationParameter(name = "principal", description = "Name of the principal who owns the component"),
-			@ManagedOperationParameter(name = "groupName", description = "Name of the group to move the component to"),
-			@ManagedOperationParameter(name = "componentId", description = "Id of component") })
-	@Override
-	public void transferItemOwnershipFromUserToGroup(String principal, String groupName, String itemId) throws UserUnauthorizedException{
-                
-                           
-		BaseDescription item = null;
-		item = componentDao.getByCmdId(itemId);
-		if (item == null) {
-			throw new ValidationException("No profile or component found with ID " + itemId);
-                }
-		Group group = groupDao.findGroupByName(groupName);
-		if (group == null) {
-			throw new ValidationException("No group found with name " + groupName);
-                }
-                
-                if (!this.userGroupMember(principal, String.valueOf(group.getId()))) {
-                   throw new UserUnauthorizedException("User " + principal+ " is not a member of group "+groupName); 
-                }
-                
-                String creatorName = item.getCreatorName();
-                if (!creatorName.equals(principal)) {
-                   throw new UserUnauthorizedException("User " + principal+ " is not creator of the item  "+item.getName()); 
-                }
-                
-                
-		Ownership ownership = null;
-		List<Ownership> oldOwnerships = ownershipDao.findOwnershipByComponentId(itemId);
-		ownershipDao.delete(oldOwnerships);
-		ownership = new Ownership();
-		ownership.setComponentId(itemId);
-		ownership.setGroupId(group.getId());
-		addOwnership(ownership);
-	}
-
-	@Override
-	public void transferItemOwnershipFromUserToGroupId(String principal, long groupId, String componentId) throws UserUnauthorizedException{
-		Group group = groupDao.findOne(groupId);
-		if (group == null) {
-			throw new ValidationException("No group found with id " + groupId);
-                }
-		this.transferItemOwnershipFromUserToGroup(principal, group.getName(), componentId);
-	}
-
-        @Override
-        public boolean userGroupMember(String principalName, String groupId) {
-            RegistryUser user = userDao.getByPrincipalName(principalName);
-            GroupMembership gm = groupMembershipDao.findMembership(user.getId(), Long.parseLong(groupId));
-            return gm != null;
-        }
+        if (user == null) {
+            throw new ItemNotFoundException("User with the principal name "+userPrincipalName+" is not found.");
+        }
+        Group group = groupDao.findGroupByName(groupName);
+        
+        if (group == null) {
+            throw new ItemNotFoundException("Group with the  name "+groupName+" is not found.");
+        }
+        
+        GroupMembership gm = groupMembershipDao.findMembership(user.getId().longValue(), group.getId());
+        if (gm != null) {
+            return gm.getId();
+        }
+        gm = new GroupMembership();
+        gm.setGroupId(group.getId());
+        gm.setUserId(user.getId().longValue());
+        return groupMembershipDao.save(gm).getId();
+    }
+    
+    
+//    @Override
+//    @ManagedOperation(description = "Remove user member from  a group")
+//    @ManagedOperationParameters({
+//        @ManagedOperationParameter(name = "principalName", description = "Principal name of the user to make a member"),
+//        @ManagedOperationParameter(name = "groupName", description = "Name of the group")})
+//    public long removeMember(String userPrincipalName, String groupName) throws ItemNotFoundException{
+//        
+//        RegistryUser user = userDao.getByPrincipalName(userPrincipalName);
+//        
+//        if (user == null) {
+//            throw new ItemNotFoundException("User the the principal name "+userPrincipalName+" is not found.");
+//        }
+//        Group group = groupDao.findGroupByName(groupName);
+//        
+//        if (group == null) {
+//            throw new ItemNotFoundException("Group with the  name "+groupName+" is not found.");
+//        }
+//        
+//       
+//        return groupMembershipDao.deleteMembership(user.getId(), group.getId());
+//    }
+
+    
+    @ManagedOperation(description = "Create a new group")
+    @ManagedOperationParameters({
+        @ManagedOperationParameter(name = "name", description = "Name of the group, must be unique"),
+        @ManagedOperationParameter(name = "ownerPrincipalName", description = "Principal name of the user")})
+    @Override
+    public long createNewGroup(String name, String ownerPrincipalName) {
+        RegistryUser owner = userDao.getByPrincipalName(ownerPrincipalName);
+        if (owner == null) {
+            throw new ValidationException("No principal '" + ownerPrincipalName + "' found");
+        }
+        Group group = groupDao.findGroupByName(name);
+        if (group != null) {
+            throw new ValidationException("Group '" + name + "' already exists");
+        }
+        group = new Group();
+        group.setName(name);
+        group.setOwnerId(owner.getId().longValue());
+        group = groupDao.save(group);
+        return group.getId();
+    }
+
+    @ManagedOperation(description = "List available groups")
+    @Override
+    public List<String> listGroupNames() {
+        List<String> groupNames = new ArrayList<String>();
+        for (Group group : groupDao.findAll()) {
+            groupNames.add(group.getName());
+        }
+        return groupNames;
+    }
+
+    @Override
+    public List<Group> getGroupsOfWhichUserIsAMember(String principal) {
+        RegistryUser user = userDao.getByPrincipalName(principal);
+        if (user == null || user.getId() == null) {
+            return new ArrayList<Group>();
+        }
+        List<GroupMembership> memberships = groupMembershipDao.findGroupsTheUserIsAmemberOf(user.getId().longValue());
+        List<Group> groups = new ArrayList<Group>();
+        for (GroupMembership m : memberships) {
+            groups.add(groupDao.findOne(m.getGroupId()));
+        }
+        return groups;
+    }
+
+    @Override
+    public List<String> getComponentIdsInGroup(long groupId) {
+        List<Ownership> ownerships = ownershipDao.findOwnershipByGroup(groupId);
+        Set<String> componentIds = new HashSet<String>();
+        for (Ownership o : ownerships) {
+            if (ComponentUtils.isComponentId(o.getComponentId())) {
+                componentIds.add(o.getComponentId());
+            }
+        }
+        List<String> idsList = new ArrayList<String>(componentIds);
+        Collections.sort(idsList);
+        return idsList;
+    }
+
+    @Override
+    public List<String> getProfileIdsInGroup(long groupId) {
+        List<Ownership> ownerships = ownershipDao.findOwnershipByGroup(groupId);
+        Set<String> profileIds = new HashSet<String>();
+        for (Ownership o : ownerships) {
+            if (ComponentUtils.isProfileId(o.getComponentId())) {
+                profileIds.add(o.getComponentId());
+            }
+        }
+        List<String> idsList = new ArrayList<String>(profileIds);
+        Collections.sort(idsList);
+        return idsList;
+    }
+
+    @Override
+    public List<Group> getGroupsTheItemIsAMemberOf(String itemId) {
+        Set<Ownership> ownerships = new HashSet<Ownership>();
+        ownerships.addAll(ownershipDao.findOwnershipByComponentId(itemId));
+        Set<Group> groups = new HashSet<Group>();
+        for (Ownership ownership : ownerships) {
+            groups.add(groupDao.findOne(ownership.getGroupId()));
+        }
+        List<Group> groupList = new ArrayList<Group>(groups);
+        Collections.sort(groupList, new Comparator<Group>() {
+            @Override
+            public int compare(Group g1, Group g2) {
+                return (int) (g1.getId() - g2.getId());
+            }
+        });
+        return groupList;
+    }
+
+    @ManagedOperation(description = "Make a component owned by a group instead of a user")
+    @ManagedOperationParameters({
+        @ManagedOperationParameter(name = "principal", description = "Name of the principal who owns the component"),
+        @ManagedOperationParameter(name = "groupName", description = "Name of the group to move the component to"),
+        @ManagedOperationParameter(name = "componentId", description = "Id of component")})
+    @Override
+    public void transferItemOwnershipFromUserToGroup(String principal, String groupName, String itemId) throws UserUnauthorizedException {
+
+
+        BaseDescription item = null;
+        item = componentDao.getByCmdId(itemId);
+        if (item == null) {
+            throw new ValidationException("No profile or component found with ID " + itemId);
+        }
+        Group group = groupDao.findGroupByName(groupName);
+        if (group == null) {
+            throw new ValidationException("No group found with name " + groupName);
+        }
+
+        if (!this.userGroupMember(principal, String.valueOf(group.getId()))) {
+            throw new UserUnauthorizedException("User " + principal + " is not a member of group " + groupName);
+        }
+
+        String creatorName = item.getCreatorName();
+        if (!creatorName.equals(principal)) {
+            throw new UserUnauthorizedException("User " + principal + " is not creator of the item  " + item.getName());
+        }
+
+
+        Ownership ownership = null;
+        List<Ownership> oldOwnerships = ownershipDao.findOwnershipByComponentId(itemId);
+        ownershipDao.delete(oldOwnerships);
+        ownership = new Ownership();
+        ownership.setComponentId(itemId);
+        ownership.setGroupId(group.getId());
+        addOwnership(ownership);
+    }
+
+    @Override
+    public void transferItemOwnershipFromUserToGroupId(String principal, long groupId, String componentId) throws UserUnauthorizedException {
+        Group group = groupDao.findOne(groupId);
+        if (group == null) {
+            throw new ValidationException("No group found with id " + groupId);
+        }
+        this.transferItemOwnershipFromUserToGroup(principal, group.getName(), componentId);
+    }
+
+    @Override
+    public boolean userGroupMember(String principalName, String groupId) {
+        RegistryUser user = userDao.getByPrincipalName(principalName);
+        GroupMembership gm = groupMembershipDao.findMembership(user.getId(), Long.parseLong(groupId));
+        return gm != null;
+    }
+    
+    @Override
+    public  Number  getGroupIdByName(String groupName) throws ItemNotFoundException {
+        Group group = groupDao.findGroupByName(groupName);        
+        if (group != null) {
+            return group.getId();
+        } else {
+            throw new ItemNotFoundException("No group with the name "+groupName);
+        }
+    }
+   
+    @Override
+    public  String  getGroupNameById(long groupId) throws ItemNotFoundException {
+        Group group = groupDao.findOne(groupId);        
+        if (group != null) {
+            return group.getName();
+        } else {
+            throw new ItemNotFoundException("No group with the id "+groupId);
+        }
+    }
 }
Index: /ComponentRegistry/trunk/ComponentRegistry/src/main/java/clarin/cmdi/componentregistry/persistence/jpa/GroupMembershipDao.java
===================================================================
--- /ComponentRegistry/trunk/ComponentRegistry/src/main/java/clarin/cmdi/componentregistry/persistence/jpa/GroupMembershipDao.java	(revision 5552)
+++ /ComponentRegistry/trunk/ComponentRegistry/src/main/java/clarin/cmdi/componentregistry/persistence/jpa/GroupMembershipDao.java	(revision 5553)
@@ -16,4 +16,6 @@
     @Query("select gm from GroupMembership gm where gm.userId = ?1 and gm.groupId = ?2")
     GroupMembership findMembership(long userId, long groupId);
-
+//
+//    @Query("delete gm from GroupMembership gm where gm.userId = ?1 and gm.groupId = ?2")
+//    int deleteMembership(long userId, long groupId);
 }
Index: /ComponentRegistry/trunk/ComponentRegistry/src/main/java/clarin/cmdi/componentregistry/rest/ComponentRegistryRestService.java
===================================================================
--- /ComponentRegistry/trunk/ComponentRegistry/src/main/java/clarin/cmdi/componentregistry/rest/ComponentRegistryRestService.java	(revision 5552)
+++ /ComponentRegistry/trunk/ComponentRegistry/src/main/java/clarin/cmdi/componentregistry/rest/ComponentRegistryRestService.java	(revision 5553)
@@ -28,6 +28,4 @@
 import clarin.cmdi.componentregistry.rss.RssCreatorDescriptions;
 import com.google.common.collect.Lists;
-import com.sun.jersey.api.client.ClientResponse;
-import com.sun.jersey.api.client.UniformInterfaceException;
 
 import com.sun.jersey.api.core.InjectParam;
@@ -61,4 +59,5 @@
 import javax.ws.rs.WebApplicationException;
 import javax.ws.rs.core.Context;
+import javax.ws.rs.core.GenericEntity;
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
@@ -68,4 +67,6 @@
 import javax.ws.rs.core.UriInfo;
 import javax.xml.bind.JAXBException;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
 
 import org.slf4j.Logger;
@@ -189,5 +190,5 @@
                     "Releasing {} registered components into the world ({} millisecs)",
                     result.size(), (System.currentTimeMillis() - start));
-           
+
             return result;
         } catch (AuthenticationFailException e) {
@@ -226,5 +227,5 @@
                     "Releasing {} registered components into the world ({} millisecs)",
                     result.size(), (System.currentTimeMillis() - start));
-             
+
             return result;
         } catch (AuthenticationFailException e) {
@@ -553,5 +554,4 @@
     }
 
-    
     @Override
     @POST
@@ -568,5 +568,4 @@
     }
 
-    
     @Override
     @POST
@@ -881,5 +880,5 @@
 
         LOG.info("Component with id: {} deleted.", componentId);
-        return Response.ok("Component with id" + componentId+" deleted.").build();
+        return Response.ok("Component with id" + componentId + " deleted.").build();
     }
 
@@ -1792,3 +1791,189 @@
         }
     }
+
+    // Group Service (added by Olha)
+    @Override
+    @POST
+    @Path("/groups/create")
+    @Produces({MediaType.TEXT_XML, MediaType.APPLICATION_XML,
+        MediaType.APPLICATION_JSON})
+    public Response createNewGroup(@QueryParam("groupName") String groupName) throws IOException {
+
+        try {
+            Principal principal = this.checkAndGetUserPrincipal();
+            Number id = groupService.createNewGroup(groupName, principal.getName());
+            return Response.ok("Group with the name " + groupName + " is created and given an id " + id).build();
+        } catch (AuthenticationFailException e) {
+            return Response.status(Status.UNAUTHORIZED).build();
+        }
+    }
+
+    @Override
+    @GET
+    @Path("/groups/principal")
+    @Produces({MediaType.TEXT_XML, MediaType.APPLICATION_XML,
+        MediaType.APPLICATION_JSON})
+    public List<Group> getGroupsOwnedByUser(@QueryParam("principalName") String pricipalName) throws IOException {
+
+        try {
+            Principal principal = this.checkAndGetUserPrincipal();
+            return groupService.getGroupsOwnedByUser(principal.getName());
+        } catch (AuthenticationFailException e) {
+            response.sendError(Status.UNAUTHORIZED.getStatusCode());
+            return new ArrayList<Group>();
+        }
+    }
+
+    @Override
+    @GET
+    @Path("/groups/names")
+    public Response listGroupNames() throws IOException {
+
+        try {
+            Principal principal = this.checkAndGetUserPrincipal();
+            List<String> result = groupService.listGroupNames();
+            //final GenericEntity<List<String>> entity  = new GenericEntity<List<String>>(result){};
+            //return Response.status(Status.OK).entity(entity).build();
+            StringsWrapper ids = new StringsWrapper();
+            ids.setStrings(result);
+            return Response.status(Status.OK).entity(ids).build();
+        } catch (AuthenticationFailException e) {
+            return Response.status(Status.UNAUTHORIZED).build();
+        }
+    }
+
+    @Override
+    @GET
+    @Path("/groups/ownership")
+    public Response isOwner(@QueryParam("groupName") String groupName) throws IOException {
+
+        try {
+            Principal principal = this.checkAndGetUserPrincipal();
+            Boolean isOwner = groupService.isUserOwnerOfGroup(groupName, principal.getName());
+            return Response.ok(isOwner.toString()).build();
+        } catch (AuthenticationFailException e) {
+            return Response.serverError().status(Status.UNAUTHORIZED).build();
+        }
+    }
+
+    @Override
+    @POST
+    @Path("/groups/makemember")
+    @Produces({MediaType.TEXT_XML, MediaType.APPLICATION_XML,
+        MediaType.APPLICATION_JSON})
+    public Response makeGroupMember(@QueryParam("groupName") String groupName, @QueryParam("principalName") String principalName) throws IOException {
+        try {
+            ComponentRegistry registry = this.getBaseRegistry();
+            Number id = registry.makeGroupMember(principalName, groupName);
+            return Response.ok(id.toString()).build();
+        } catch (UserUnauthorizedException e) {
+            return Response.status(Status.FORBIDDEN).entity(e.getMessage()).build();
+        } catch (ItemNotFoundException e) {
+            return Response.status(Status.NOT_FOUND).entity(e.getMessage()).build();
+        
+        } catch (AuthenticationFailException e) {
+            return Response.status(Status.UNAUTHORIZED).build();
+        }
+    }
+    
+//    @Override
+//    @DELETE
+//    @Path("/groups/removemember")
+//    @Produces({MediaType.TEXT_XML, MediaType.APPLICATION_XML,
+//        MediaType.APPLICATION_JSON})
+//    public Response removeGroupMember(@QueryParam("groupName") String groupName, @QueryParam("principalName") String principalName) throws IOException {
+//        try {
+//            ComponentRegistry registry = this.getBaseRegistry();
+//            Number id = registry.removeGroupMember(principalName, groupName);
+//            return Response.ok(id.toString()).build();
+//        } catch (UserUnauthorizedException e) {
+//            return Response.status(Status.FORBIDDEN).entity(e.getMessage()).build();
+//        } catch (ItemNotFoundException e) {
+//            return Response.status(Status.NOT_FOUND).entity(e.getMessage()).build();
+//        
+//        } catch (AuthenticationFailException e) {
+//            return Response.status(Status.UNAUTHORIZED).build();
+//        }
+//    }
+
+    @Override
+    @GET
+    @Path("/groups/profiles")
+    public Response listProfiles(@QueryParam("groupId") String groupId) throws IOException {
+
+        try {
+            Principal principal = this.checkAndGetUserPrincipal();
+            List<String> result = groupService.getProfileIdsInGroup(Long.parseLong(groupId));
+            StringsWrapper ids = new StringsWrapper();
+            ids.setStrings(result);
+            return Response.status(Status.OK).entity(ids).build();
+        } catch (AuthenticationFailException e) {
+            return Response.status(Status.UNAUTHORIZED).build();
+        }
+    }
+
+    @Override
+    @GET
+    @Path("/groups/components")
+    public Response listComponents(@QueryParam("groupId") String groupId) throws IOException {
+
+        try {
+            Principal principal = this.checkAndGetUserPrincipal();
+            List<String> result = groupService.getComponentIdsInGroup(Long.parseLong(groupId));
+            StringsWrapper ids = new StringsWrapper();
+            ids.setStrings(result);
+            return Response.status(Status.OK).entity(ids).build();
+        } catch (AuthenticationFailException e) {
+            response.sendError(Status.UNAUTHORIZED.getStatusCode());
+            return Response.status(Status.UNAUTHORIZED).build();
+        }
+    }
+
+    @Override
+    @GET
+    @Path("/groups/nameById")
+    public Response getGroupNameById(@QueryParam("groupId") String groupId) throws IOException {
+
+        try {
+            Principal principal = this.checkAndGetUserPrincipal();
+            String name = groupService.getGroupNameById(Long.parseLong(groupId));
+            return Response.ok(name).build();
+        } catch (AuthenticationFailException e) {
+            return Response.status(Status.UNAUTHORIZED).build();
+        } catch (ItemNotFoundException e) {
+            return Response.status(Status.NOT_FOUND).build();
+        }
+    }
+
+    @Override
+    @GET
+    @Path("/groups/idByName")
+    public Response getGroupIdByName(@QueryParam("groupName") String groupName) throws IOException {
+
+        try {
+            Principal principal = this.checkAndGetUserPrincipal();
+            Number id = groupService.getGroupIdByName(groupName);
+            return Response.ok(id.toString()).build();
+        } catch (AuthenticationFailException e) {
+            return Response.status(Status.UNAUTHORIZED).build();
+        } catch (ItemNotFoundException e) {
+            return Response.status(Status.NOT_FOUND).build();
+        }
+    }
+
+    @XmlRootElement(name = "Identifiers")
+    public static class StringsWrapper {
+
+        @XmlElement(name = "item")
+        List<String> strings = new ArrayList<String>();
+
+        StringsWrapper() {
+        }
+
+        public void setStrings(List<String> strings) {
+            this.strings = strings;
+        }
+        
+       
+    }
 }
Index: /ComponentRegistry/trunk/ComponentRegistry/src/main/java/clarin/cmdi/componentregistry/rest/IComponentRegistryRestService.java
===================================================================
--- /ComponentRegistry/trunk/ComponentRegistry/src/main/java/clarin/cmdi/componentregistry/rest/IComponentRegistryRestService.java	(revision 5552)
+++ /ComponentRegistry/trunk/ComponentRegistry/src/main/java/clarin/cmdi/componentregistry/rest/IComponentRegistryRestService.java	(revision 5553)
@@ -27,5 +27,5 @@
 
 /**
- * 
+ *
  * @author twago@mpi.nl
  * @author olsha@mpi.nl
@@ -35,30 +35,29 @@
 @Path("/registry")
 @Singleton
-@Transactional(rollbackFor=Exception.class)
+@Transactional(rollbackFor = Exception.class)
 public interface IComponentRegistryRestService {
 
-	public static final String APPLICATION_BASE_URL_PARAM = "eu.clarin.cmdi.componentregistry.serviceRootUrl";
-	public static final String DATA_FORM_FIELD = "data";
-	public static final String NAME_FORM_FIELD = "name";
-	public static final String DESCRIPTION_FORM_FIELD = "description";
-	public static final String GROUP_FORM_FIELD = "group";
-	public static final String DOMAIN_FORM_FIELD = "domainName";
-	public static final String REGISTRY_SPACE_PARAM = "registrySpace";
-	public static final String GROUPID_PARAM = "groupid";
-	public static final String METADATA_EDITOR_PARAM = "mdEditor";
-	public static final String NUMBER_OF_RSSITEMS = "limit";
-
-	List<ComponentDescription> getRegisteredComponents(String registrySpace, String groupId)
-			throws ComponentRegistryException, IOException, UserUnauthorizedException;
-
-	List<ProfileDescription> getRegisteredProfiles(String registrySpace, boolean metadataEditor, String groupId) throws ComponentRegistryException, IOException, UserUnauthorizedException;
-
-	Response getRegisteredComponent(String componentId) throws IOException;
-
-	Response getRegisteredProfile(String profileId) throws IOException;
-        
-        Response getRegisteredComponentRawType(String componentId, String rawType) throws ComponentRegistryException;
-
-        
+    public static final String APPLICATION_BASE_URL_PARAM = "eu.clarin.cmdi.componentregistry.serviceRootUrl";
+    public static final String DATA_FORM_FIELD = "data";
+    public static final String NAME_FORM_FIELD = "name";
+    public static final String DESCRIPTION_FORM_FIELD = "description";
+    public static final String GROUP_FORM_FIELD = "group";
+    public static final String DOMAIN_FORM_FIELD = "domainName";
+    public static final String REGISTRY_SPACE_PARAM = "registrySpace";
+    public static final String GROUPID_PARAM = "groupid";
+    public static final String METADATA_EDITOR_PARAM = "mdEditor";
+    public static final String NUMBER_OF_RSSITEMS = "limit";
+
+    List<ComponentDescription> getRegisteredComponents(String registrySpace, String groupId)
+            throws ComponentRegistryException, IOException, UserUnauthorizedException;
+
+    List<ProfileDescription> getRegisteredProfiles(String registrySpace, boolean metadataEditor, String groupId) throws ComponentRegistryException, IOException, UserUnauthorizedException;
+
+    Response getRegisteredComponent(String componentId) throws IOException;
+
+    Response getRegisteredProfile(String profileId) throws IOException;
+
+    Response getRegisteredComponentRawType(String componentId, String rawType) throws ComponentRegistryException;
+
 //	ComponentRegistry findRegistry(String id,
 //			RegistryClosure<? extends BaseDescription> clos)
@@ -66,133 +65,161 @@
 //
 //	
-
-	List<BaseDescription> getComponentUsage(String componentId) throws ComponentRegistryException, IOException;
-
-	List<Comment> getCommentsFromProfile(String profileId) throws ComponentRegistryException, IOException;
-
-	List<Comment> getCommentsFromComponent(String componentId) throws ComponentRegistryException, IOException;
-
-	Comment getSpecifiedCommentFromProfile(String profileId, String commentId) throws ComponentRegistryException, IOException ;
-
-	Comment getSpecifiedCommentFromComponent(String componentId, String commentId) throws ComponentRegistryException, IOException ;
-
-	/**
-	 *
-	 * Purely helper method for my front-end (FLEX) which only does post/get
-	 * requests. The query param is checked and the "proper" method is called.
-	 *
-	 * @param profileId
-	 * @param method
-	 * @return
-	 */
-	Response manipulateRegisteredProfile(String profileId, String method);
-
-	Response manipulateCommentFromProfile(String profileId, String commentId,
-			String method);
-
-	Response manipulateCommentFromComponent(String componentId,
-			String commentId, String method);
-
-	Response publishRegisteredProfile(String profileId, InputStream input,
-			String name, String description, String group, String domainName);
-
-	Response updateRegisteredProfile(String profileId, 
-			InputStream input, String name, String description, String groupId,
-			String domainName);
-
-	/**
-	 *
-	 * Purely helper method for my front-end (FLEX) which van only do post/get
-	 * requests. The query param is checked and the "proper" method is called.
-	 *
-	 * @param componentId
-	 * @param method
-	 * @return
-	 */
-	Response manipulateRegisteredComponent(String componentId, String method);
-
-	Response publishRegisteredComponent(String componentId, InputStream input,
-			String name, String description, String groupId, String domainName);
-
-	Response updateRegisteredComponent(String componentId,
-			InputStream input, String name, String description, String groupId,
-			String domainName);
-
-	Response deleteRegisteredComponent(String componentId);
-
-	Response deleteRegisteredProfile(String profileId);
-
-	Response deleteCommentFromProfile(String profileId, String commentId);
-
-	Response deleteCommentFromComponent(String componentId, String commentId);
-
-	Response getRegisteredProfileRawType(String profileId, String rawType) throws ComponentRegistryException;
-
-	Response registerProfile(InputStream input, String name,
-			String description, String groupId, String domainName);
-
-	Response registerComponent(InputStream input, String name,
-			String description, String groupId, String domainName);
-
-	Response registerCommentInComponent(InputStream input, String componentId) throws ComponentRegistryException;
-
-	Response registerCommentInProfile(InputStream input, String profileId) throws ComponentRegistryException;
-
-	Response pingSession();
-
-	/**
-	 * @param componentRegistryFactory the componentRegistryFactory to set
-	 */
-	void setComponentRegistryFactory(ComponentRegistryFactory componentRegistryFactory);
-
-	
-	Rss getRssComponent(String groupId, String registrySpace, String limit)
-			throws ComponentRegistryException, ParseException, IOException;
-
-	
-	Rss getRssProfile(String groupId, String registrySpace, String limit)
-			throws ComponentRegistryException, ParseException, IOException;
-
-	
-	Rss getRssOfCommentsFromProfile(String profileId, String limit) throws ComponentRegistryException, 
-			JAXBException, ParseException, IOException;
-
-	
-	Rss getRssOfCommentsFromComponent(String componentId,
-			String limit) throws ComponentRegistryException, IOException,
-			JAXBException, ParseException;
-
-	AllowedAttributetypesXML getAllowedAttributeTypes()
-			throws ComponentRegistryException, IOException, JAXBException,
-			ParseException;
-	
-	void setFileNamesFromListToNull(List<CMDComponentType> listofcomponents);
-	
-	/**
-	 * Get a list of groups the user is a member of
-	 * @return
-	 */
-	List<Group> getGroupsTheCurrentUserIsAMemberOf();
-
-	/**
-	 * Get a list of groups the item is available to. For all practical reasons, this will return either 0 or 1 groups
-	 * @param itemId ID of component or profile. This is not the DB id but the logical ID which is unique across components and profiles
-	 * @return List of groups
-	 */
-	List<Group> getGroupsTheItemIsAMemberOf(String itemId);
-	
-	/**
-	 * Transfer ownership of an item (group/profile) to a group
-	 * @param itemId
-	 * @param groupId
-	 */
-	Response transferItemOwnershipToGroup(String itemId, long groupId) throws IOException;
-	
-	/**
-	 * Get any component (public or private) with the specified ID
-	 * @param componentId
-	 * @return
-	 */
-	BaseDescription getBaseDescription(String componentId) throws ComponentRegistryException, IOException;
-
+    List<BaseDescription> getComponentUsage(String componentId) throws ComponentRegistryException, IOException;
+
+    List<Comment> getCommentsFromProfile(String profileId) throws ComponentRegistryException, IOException;
+
+    List<Comment> getCommentsFromComponent(String componentId) throws ComponentRegistryException, IOException;
+
+    Comment getSpecifiedCommentFromProfile(String profileId, String commentId) throws ComponentRegistryException, IOException;
+
+    Comment getSpecifiedCommentFromComponent(String componentId, String commentId) throws ComponentRegistryException, IOException;
+
+    /**
+     *
+     * Purely helper method for my front-end (FLEX) which only does post/get
+     * requests. The query param is checked and the "proper" method is called.
+     *
+     * @param profileId
+     * @param method
+     * @return
+     */
+    Response manipulateRegisteredProfile(String profileId, String method);
+
+    Response manipulateCommentFromProfile(String profileId, String commentId,
+            String method);
+
+    Response manipulateCommentFromComponent(String componentId,
+            String commentId, String method);
+
+    Response publishRegisteredProfile(String profileId, InputStream input,
+            String name, String description, String group, String domainName);
+
+    Response updateRegisteredProfile(String profileId,
+            InputStream input, String name, String description, String groupId,
+            String domainName);
+
+    /**
+     *
+     * Purely helper method for my front-end (FLEX) which van only do post/get
+     * requests. The query param is checked and the "proper" method is called.
+     *
+     * @param componentId
+     * @param method
+     * @return
+     */
+    Response manipulateRegisteredComponent(String componentId, String method);
+
+    Response publishRegisteredComponent(String componentId, InputStream input,
+            String name, String description, String groupId, String domainName);
+
+    Response updateRegisteredComponent(String componentId,
+            InputStream input, String name, String description, String groupId,
+            String domainName);
+
+    Response deleteRegisteredComponent(String componentId);
+
+    Response deleteRegisteredProfile(String profileId);
+
+    Response deleteCommentFromProfile(String profileId, String commentId);
+
+    Response deleteCommentFromComponent(String componentId, String commentId);
+
+    Response getRegisteredProfileRawType(String profileId, String rawType) throws ComponentRegistryException;
+
+    Response registerProfile(InputStream input, String name,
+            String description, String groupId, String domainName);
+
+    Response registerComponent(InputStream input, String name,
+            String description, String groupId, String domainName);
+
+    Response registerCommentInComponent(InputStream input, String componentId) throws ComponentRegistryException;
+
+    Response registerCommentInProfile(InputStream input, String profileId) throws ComponentRegistryException;
+
+    Response pingSession();
+
+    /**
+     * @param componentRegistryFactory the componentRegistryFactory to set
+     */
+    void setComponentRegistryFactory(ComponentRegistryFactory componentRegistryFactory);
+
+    Rss getRssComponent(String groupId, String registrySpace, String limit)
+            throws ComponentRegistryException, ParseException, IOException;
+
+    Rss getRssProfile(String groupId, String registrySpace, String limit)
+            throws ComponentRegistryException, ParseException, IOException;
+
+    Rss getRssOfCommentsFromProfile(String profileId, String limit) throws ComponentRegistryException,
+            JAXBException, ParseException, IOException;
+
+    Rss getRssOfCommentsFromComponent(String componentId,
+            String limit) throws ComponentRegistryException, IOException,
+            JAXBException, ParseException;
+
+    AllowedAttributetypesXML getAllowedAttributeTypes()
+            throws ComponentRegistryException, IOException, JAXBException,
+            ParseException;
+
+    void setFileNamesFromListToNull(List<CMDComponentType> listofcomponents);
+
+  
+
+    /**
+     * Get any component (public or private) with the specified ID
+     *
+     * @param componentId
+     * @return
+     */
+    BaseDescription getBaseDescription(String componentId) throws ComponentRegistryException, IOException;
+
+    // Group Service 
+    
+     /**
+     * Get a list of groups the user is a member of
+     *
+     * @return
+     */
+    List<Group> getGroupsTheCurrentUserIsAMemberOf();
+
+   
+    
+     /**
+     * Get a list of groups the item is available to. For all practical reasons,
+     * this will return either 0 or 1 groups
+     *
+     * @param itemId ID of component or profile. This is not the DB id but the
+     * logical ID which is unique across components and profiles
+     * @return List of groups
+     */
+    List<Group> getGroupsTheItemIsAMemberOf(String itemId);
+
+    /**
+     * Transfer ownership of an item (group/profile) to a group
+     *
+     * @param itemId
+     * @param groupId
+     */
+    Response transferItemOwnershipToGroup(String itemId, long groupId) throws IOException;
+    
+    // (added by Olha)
+    
+    Response createNewGroup(String groupName) throws IOException;
+
+    List<Group> getGroupsOwnedByUser(String pricipalName) throws IOException;
+
+    Response listGroupNames() throws IOException;
+
+    Response isOwner(String groupName) throws IOException;
+
+    Response makeGroupMember(String groupName, String principalName) throws IOException;
+    
+    //Response removeGroupMember(String groupName, String principalName) throws IOException;
+
+    Response listProfiles(String groupId) throws IOException;
+
+    Response listComponents(String groupId) throws IOException;
+
+    Response getGroupNameById(String groupId) throws IOException;
+
+    Response getGroupIdByName(String groupName) throws IOException;
 }
Index: /ComponentRegistry/trunk/ComponentRegistry/src/test/java/clarin/cmdi/componentregistry/impl/database/GroupServiceImplTest.java
===================================================================
--- /ComponentRegistry/trunk/ComponentRegistry/src/test/java/clarin/cmdi/componentregistry/impl/database/GroupServiceImplTest.java	(revision 5552)
+++ /ComponentRegistry/trunk/ComponentRegistry/src/test/java/clarin/cmdi/componentregistry/impl/database/GroupServiceImplTest.java	(revision 5553)
@@ -8,4 +8,5 @@
 
 import clarin.cmdi.componentregistry.BaseUnitTest;
+import clarin.cmdi.componentregistry.ItemNotFoundException;
 import clarin.cmdi.componentregistry.UserUnauthorizedException;
 import clarin.cmdi.componentregistry.model.BaseDescription;
@@ -159,5 +160,5 @@
 
     @Test
-    public void testAccessViaGroupToPrivateProfile() {
+    public void testAccessViaGroupToPrivateProfile() throws ItemNotFoundException{
 	// Make a profile that belongs to someone else
 	BaseDescription profile = makeTestProfile("4567", false, 9999);
@@ -230,5 +231,5 @@
 
     @Test
-    public void testAccessViaGroupToPrivateComponent() {
+    public void testAccessViaGroupToPrivateComponent() throws ItemNotFoundException{
 	// Make a profile that belongs to someone else
 	BaseDescription componentDescription = makeTestComponent(false,
@@ -257,5 +258,5 @@
 
     @Test
-    public void testTransferComponentOwnershipFromUserToGroup()  throws UserUnauthorizedException{
+    public void testTransferComponentOwnershipFromUserToGroup()  throws UserUnauthorizedException, ItemNotFoundException{
 
 	// Make a group
@@ -309,5 +310,5 @@
 
     @Test
-    public void testtransferComponentOwnershipFromUserToGroup()  throws UserUnauthorizedException{
+    public void testtransferComponentOwnershipFromUserToGroup()  throws UserUnauthorizedException, ItemNotFoundException{
 
 	// Make a group
@@ -362,5 +363,5 @@
 
     @Test
-    public void testTransferItemOwnershipFromUserToGroup()  throws UserUnauthorizedException{
+    public void testTransferItemOwnershipFromUserToGroup()  throws UserUnauthorizedException, ItemNotFoundException{
 	//TODO: improve test by mixing in components and exclusing components/profiles
 	// Make a group
@@ -415,5 +416,5 @@
 
     @Test
-    public void testGetGroupsTheItemIsAMemberOf()  throws UserUnauthorizedException{
+    public void testGetGroupsTheItemIsAMemberOf()  throws UserUnauthorizedException, ItemNotFoundException{
 	// Make a group
 	Group group1 = groupDao.findOne(groupService.createNewGroup("Group 1",
Index: /ComponentRegistry/trunk/ComponentRegistry/src/test/java/clarin/cmdi/componentregistry/rest/ComponentRegistryRestServiceTestCase.java
===================================================================
--- /ComponentRegistry/trunk/ComponentRegistry/src/test/java/clarin/cmdi/componentregistry/rest/ComponentRegistryRestServiceTestCase.java	(revision 5552)
+++ /ComponentRegistry/trunk/ComponentRegistry/src/test/java/clarin/cmdi/componentregistry/rest/ComponentRegistryRestServiceTestCase.java	(revision 5553)
@@ -7,4 +7,5 @@
 import clarin.cmdi.componentregistry.model.Comment;
 import clarin.cmdi.componentregistry.model.ComponentDescription;
+import clarin.cmdi.componentregistry.model.Group;
 import clarin.cmdi.componentregistry.model.ProfileDescription;
 import clarin.cmdi.componentregistry.model.RegistryUser;
@@ -28,6 +29,4 @@
 import org.springframework.test.context.ContextConfiguration;
 import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-import org.springframework.test.context.transaction.TransactionConfiguration;
-import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.context.ContextLoaderListener;
 import org.springframework.web.context.request.RequestContextListener;
@@ -52,4 +51,8 @@
     };
     protected final static GenericType<List<Comment>> COMMENT_LIST_GENERICTYPE = new GenericType<List<Comment>>() {
+    };
+    protected final static GenericType<List<Group>> GROUP_LIST_GENERICTYPE = new GenericType<List<Group>>() {
+    };
+    protected final static GenericType<List<String>> STRING_LIST_GENERICTYPE = new GenericType<List<String>>() {
     };
 
Index: /ComponentRegistry/trunk/ComponentRegistry/src/test/java/clarin/cmdi/componentregistry/rest/RegistryTestHelper.java
===================================================================
--- /ComponentRegistry/trunk/ComponentRegistry/src/test/java/clarin/cmdi/componentregistry/rest/RegistryTestHelper.java	(revision 5552)
+++ /ComponentRegistry/trunk/ComponentRegistry/src/test/java/clarin/cmdi/componentregistry/rest/RegistryTestHelper.java	(revision 5553)
@@ -43,4 +43,6 @@
 	RegistryTestHelper.marshaller = marshaller;
     }
+    
+   
 
     public static ComponentDescription addComponent(ComponentRegistry testRegistry, String id, boolean isPublic) throws ParseException, JAXBException {
@@ -111,4 +113,6 @@
 	return addProfile(testRegistry, id, new ByteArrayInputStream(content.getBytes()), isPublic);
     }
+    
+    
 
     private static ProfileDescription addProfile(ComponentRegistry testRegistry, String id, InputStream content, boolean isPublic) throws ParseException,
Index: /ComponentRegistry/trunk/ComponentRegistry/src/test/java/clarin/cmdi/componentregistry/rest/RestGroupServiceTest.java
===================================================================
--- /ComponentRegistry/trunk/ComponentRegistry/src/test/java/clarin/cmdi/componentregistry/rest/RestGroupServiceTest.java	(revision 5553)
+++ /ComponentRegistry/trunk/ComponentRegistry/src/test/java/clarin/cmdi/componentregistry/rest/RestGroupServiceTest.java	(revision 5553)
@@ -0,0 +1,430 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package clarin.cmdi.componentregistry.rest;
+
+import clarin.cmdi.componentregistry.ComponentRegistry;
+import clarin.cmdi.componentregistry.ComponentRegistryFactory;
+import clarin.cmdi.componentregistry.ItemNotFoundException;
+import clarin.cmdi.componentregistry.impl.database.ComponentRegistryTestDatabase;
+import clarin.cmdi.componentregistry.impl.database.GroupService;
+import clarin.cmdi.componentregistry.model.Comment;
+import clarin.cmdi.componentregistry.model.ComponentDescription;
+import clarin.cmdi.componentregistry.model.Group;
+import clarin.cmdi.componentregistry.model.Ownership;
+import clarin.cmdi.componentregistry.model.ProfileDescription;
+import clarin.cmdi.componentregistry.model.RegistryUser;
+import clarin.cmdi.componentregistry.persistence.jpa.UserDao;
+import com.sun.jersey.api.client.ClientResponse;
+import java.text.ParseException;
+import java.util.List;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.MultivaluedMap;
+import javax.xml.bind.JAXBException;
+import org.junit.Before;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.jdbc.core.JdbcTemplate;
+
+import static org.junit.Assert.*;
+import org.junit.Test;
+
+/**
+ *
+ * @author olhsha
+ */
+public class RestGroupServiceTest extends ComponentRegistryRestServiceTestCase {
+    
+    @Autowired
+    private ComponentRegistryFactory componentRegistryFactory;
+    
+    @Autowired
+    private JdbcTemplate jdbcTemplate;
+    @Autowired 
+    private GroupService groupService;
+    @Autowired 
+    private UserDao userDao;
+    
+    private ComponentRegistry baseRegistry;
+
+    @Before
+    public void init() {
+        ComponentRegistryTestDatabase.resetAndCreateAllTables(jdbcTemplate);
+        createUserRecord();
+        baseRegistry = componentRegistryFactory.getBaseRegistry(DummyPrincipal.DUMMY_CREDENTIALS);
+    }
+
+    private String expectedUserId(String principal) {
+        return getUserDao().getByPrincipalName(principal).getId().toString();
+    }
+    private ComponentDescription component1;
+    private ComponentDescription component2;
+    private ProfileDescription profile1;
+    private ProfileDescription profile2;
+    private ComponentDescription component3;
+    private ProfileDescription profile3;
+    private Comment profile1Comment1;
+    private Comment profile1Comment2;
+    private Comment component1Comment3;
+    private Comment component1Comment4;
+    private Comment profile3Comment5;
+    private Comment component3Comment7;
+
+    private void fillUpPublicItems() throws Exception {
+
+        profile1 = RegistryTestHelper.addProfile(baseRegistry, "profile2", true);
+        profile2 = RegistryTestHelper.addProfile(baseRegistry, "profile1", true);
+        component1 = RegistryTestHelper.addComponent(baseRegistry,
+                "component2", true);
+        component2 = RegistryTestHelper.addComponent(baseRegistry,
+                "component1", true);
+        profile1Comment2 = RegistryTestHelper.addComment(baseRegistry, "comment2",
+                ProfileDescription.PROFILE_PREFIX + "profile1",
+                "JUnit@test.com");
+        profile1Comment1 = RegistryTestHelper.addComment(baseRegistry, "comment1",
+                ProfileDescription.PROFILE_PREFIX + "profile1",
+                "JUnit@test.com");
+        component1Comment3 = RegistryTestHelper.addComment(baseRegistry, "comment3",
+                ComponentDescription.COMPONENT_PREFIX + "component1",
+                "JUnit@test.com");
+        component1Comment4 = RegistryTestHelper.addComment(baseRegistry, "comment4",
+                ComponentDescription.COMPONENT_PREFIX + "component1",
+                "JUnit@test.com");
+    }
+
+    private void fillUpPrivateItems() throws Exception {
+        profile3 = RegistryTestHelper.addProfile(baseRegistry, "profile3", false);
+        component3 = RegistryTestHelper.addComponent(baseRegistry,
+                "component3", false);
+        profile3Comment5 = RegistryTestHelper.addComment(baseRegistry, "comment5",
+                ProfileDescription.PROFILE_PREFIX + "profile3",
+                "JUnit@test.com");
+        component3Comment7 = RegistryTestHelper.addComment(baseRegistry, "comment7",
+                ComponentDescription.COMPONENT_PREFIX + "component3",
+                "JUnit@test.com");
+    }
+    
+     protected void createAntherUserRecord() {
+	RegistryUser user = new RegistryUser();
+	user.setName("Another database test user");
+	user.setPrincipalName("anotherPrincipal");
+	userDao.save(user);
+    }
+     
+    private void MakeGroupA(){
+        groupService.createNewGroup("group A", DummyPrincipal.DUMMY_PRINCIPAL.getName());
+    }
+    
+     private void fillUpGroupA() throws ParseException, JAXBException, ItemNotFoundException{
+         
+        MakeGroupA();
+        
+        RegistryTestHelper.addProfile(baseRegistry, "profile-1", false);
+        RegistryTestHelper.addComponent(baseRegistry, "component-1", false);
+        RegistryTestHelper.addComponent(baseRegistry, "component-2", false);
+        
+        Ownership ownership = new Ownership();
+        ownership.setComponentId(ProfileDescription.PROFILE_PREFIX+"profile-1");
+        ownership.setGroupId(1);
+        ownership.setUserId(0);
+        groupService.addOwnership(ownership);
+        
+        ownership.setComponentId(ComponentDescription.COMPONENT_PREFIX+"component-1");
+        ownership.setGroupId(1);
+        ownership.setUserId(0);
+        groupService.addOwnership(ownership);
+        
+        ownership.setComponentId(ComponentDescription.COMPONENT_PREFIX+"component-2");
+        ownership.setGroupId(1);
+        ownership.setUserId(0);
+        groupService.addOwnership(ownership);
+        
+    }
+     
+     
+    
+    private void MakeGroupB() throws ItemNotFoundException{
+        createAntherUserRecord();
+        groupService.createNewGroup("group B", "anotherPrincipal");
+        groupService.makeMember(DummyPrincipal.DUMMY_PRINCIPAL.getName(), "group B");
+    }
+    
+     private void fillUpGroupB() throws ParseException, JAXBException, ItemNotFoundException{
+         
+        MakeGroupB();
+        
+        RegistryTestHelper.addProfile(baseRegistry, "Bprofile-1", false);
+        RegistryTestHelper.addComponent(baseRegistry, "Bcomponent-1", false);
+        RegistryTestHelper.addComponent(baseRegistry, "Bcomponent-2", false);
+        
+        Ownership ownership = new Ownership();
+        ownership.setComponentId(ProfileDescription.PROFILE_PREFIX+"Bprofile-1");
+        ownership.setGroupId(2);
+        ownership.setUserId(0);
+        groupService.addOwnership(ownership);
+        
+        ownership.setComponentId(ComponentDescription.COMPONENT_PREFIX+"Bcomponent-1");
+        ownership.setGroupId(2);
+        ownership.setUserId(0);
+        groupService.addOwnership(ownership);
+        
+        ownership.setComponentId(ComponentDescription.COMPONENT_PREFIX+"Bcomponent-2");
+        ownership.setGroupId(2);
+        ownership.setUserId(0);
+        groupService.addOwnership(ownership);
+        
+    }
+    
+ //    Response createNewGroup(String groupName) throws IOException;
+    
+    @Test
+    public void testCreateNewGroup() {
+        System.out.println("test createNewGroup");
+        ClientResponse cr = this.getAuthenticatedResource(getResource()
+                .path("/registry/groups/create").queryParam("groupName", "newGroup"))
+                .accept(MediaType.TEXT_XML).post(ClientResponse.class);
+        assertEquals(200, cr.getStatus());
+        assertEquals("Group with the name newGroup is created and given an id 1", cr.getEntity(String.class));
+    }
+    
+    
+//  List<Group> getGroupsOwnedByUser(String pricipalName) throws IOException;
+    
+    @Test
+    public void testGetGroupsOwnedByUser() {
+        System.out.println("test GetGroupsOwnedByUser");
+        ClientResponse cr = this.getAuthenticatedResource(getResource()
+                .path("/registry/groups/create").queryParam("groupName", "newGroup1"))
+                .accept(MediaType.TEXT_XML).post(ClientResponse.class);
+        assertEquals(200, cr.getStatus());
+        ClientResponse cr1 = this.getAuthenticatedResource(getResource()
+                .path("/registry/groups/create").queryParam("groupName", "newGroup2"))
+                .accept(MediaType.TEXT_XML).post(ClientResponse.class);
+        assertEquals(200, cr1.getStatus());
+        
+        // test itself
+        
+       List<Group> result = this.getAuthenticatedResource(getResource()
+                .path("/registry/groups/principal").queryParam("principalName", DummyPrincipal.DUMMY_PRINCIPAL.getName()))
+                .accept(MediaType.APPLICATION_XML).get(GROUP_LIST_GENERICTYPE);
+        
+       assertEquals(2, result.size());
+       assertEquals("newGroup1", result.get(0).getName());
+       assertEquals("newGroup2", result.get(1).getName());
+    }
+    
+    
+//    List<Group> getGroupsTheCurrentUserIsAMemberOf();   
+    
+    @Test
+    public void testGetGroupsTheCurrentUserIsAMemberOf() throws ItemNotFoundException{
+        System.out.println("test getGroupsTheCurrentUserIsAMemberOfr");
+        
+        MakeGroupA();
+        MakeGroupB();
+        
+        // test itself
+        
+       List<Group> result = this.getAuthenticatedResource(getResource()
+                .path("/registry/groups/usermembership"))
+                .accept(MediaType.APPLICATION_XML).get(GROUP_LIST_GENERICTYPE);
+        
+       assertEquals(1, result.size());
+       assertEquals("group B", result.get(0).getName());
+    }
+//   
+//    List<Group> getGroupsTheItemIsAMemberOf(String itemId);
+   
+    @Test
+    public void testGetGroupsTheItemIsAMemberOf() throws ParseException, JAXBException, ItemNotFoundException{
+        System.out.println("test getGroupsTheItemIsAMemberOf");
+        
+        fillUpGroupA();
+        fillUpGroupB();
+        // test itself
+        
+       List<Group> result = this.getAuthenticatedResource(getResource()
+                .path("/registry/items/"+ComponentDescription.COMPONENT_PREFIX+"component-1/groups"))
+                .accept(MediaType.APPLICATION_XML).get(GROUP_LIST_GENERICTYPE);
+        
+       assertEquals(1, result.size());
+       assertEquals("group A", result.get(0).getName());
+       
+       result = this.getAuthenticatedResource(getResource()
+                .path("/registry/items/"+ComponentDescription.COMPONENT_PREFIX+"Bcomponent-1/groups"))
+                .accept(MediaType.APPLICATION_XML).get(GROUP_LIST_GENERICTYPE);
+        
+       assertEquals(1, result.size());
+       assertEquals("group B", result.get(0).getName());
+       
+       result = this.getAuthenticatedResource(getResource()
+                .path("/registry/items/"+ProfileDescription.PROFILE_PREFIX+"Bprofile-1/groups"))
+                .accept(MediaType.APPLICATION_XML).get(GROUP_LIST_GENERICTYPE);
+        
+       assertEquals(1, result.size());
+       assertEquals("group B", result.get(0).getName());
+       
+       result = this.getAuthenticatedResource(getResource()
+                .path("/registry/items/"+ProfileDescription.PROFILE_PREFIX+"profile-1/groups"))
+                .accept(MediaType.APPLICATION_XML).get(GROUP_LIST_GENERICTYPE);
+        
+       assertEquals(1, result.size());
+       assertEquals("group A", result.get(0).getName());
+    }
+    
+
+
+  
+      
+    @Test
+    public void testListGroupNames() throws ItemNotFoundException{
+        System.out.println("test listGroupNames");
+        
+        MakeGroupA();
+        MakeGroupB();
+        
+        // test itself
+        
+       ClientResponse cr  = this.getAuthenticatedResource(getResource()
+                .path("/registry/groups/names")).accept(MediaType.APPLICATION_XML).get(ClientResponse.class);
+       assertEquals(200, cr.getStatus());
+       List<String> result = cr.getEntity(ComponentRegistryRestService.StringsWrapper.class).strings;
+       assertEquals(2, result.size());
+       assertEquals("group A", result.get(0));
+       assertEquals("group B", result.get(1));
+    }
+    
+//
+//    Response isOwner(String groupName) throws IOException;
+    
+    @Test
+    public void testIsOwner() throws ItemNotFoundException{
+        System.out.println("test isOwner");
+        
+        MakeGroupA();
+        MakeGroupB();
+        
+        // test itself
+        
+       ClientResponse cr  = this.getAuthenticatedResource(getResource()
+                .path("/registry/groups/ownership").queryParam("groupName", "group A")).accept(MediaType.APPLICATION_XML).get(ClientResponse.class);
+       assertEquals(200, cr.getStatus());
+       String result = cr.getEntity(String.class);
+       assertEquals("true", result);
+       
+       cr  = this.getAuthenticatedResource(getResource()
+                .path("/registry/groups/ownership").queryParam("groupName", "group B")).accept(MediaType.APPLICATION_XML).get(ClientResponse.class);
+       assertEquals(200, cr.getStatus());
+       result = cr.getEntity(String.class);
+       assertEquals("false", result);
+    }
+    
+    
+//
+//    Response makeGroupMember(String groupName, String principalName) throws IOException;
+    
+    @Test
+    public void testMakeGroupMember() throws ItemNotFoundException{
+        System.out.println("test makeGroupMember");
+        
+        MakeGroupA();
+        MakeGroupB();
+        
+        // test itself
+        
+       //MultivaluedMap<String, String> params  = new  MultivaluedHashMap<String, String>(); 
+       ClientResponse cr  = this.getAuthenticatedResource(getResource()
+                .path("/registry/groups/makemember").queryParam("groupName", "group A").queryParam("principalName", "anotherPrincipal")).accept(MediaType.APPLICATION_XML).post(ClientResponse.class);
+       assertEquals(200, cr.getStatus());
+       
+       assertTrue(groupService.userGroupMember("anotherPrincipal", "1"));
+       
+               ;
+       cr  = this.getAuthenticatedResource(getResource()
+                .path("/registry/groups/makemember").queryParam("groupName", "group B").queryParam("principalName", "anotherPrincipal")).accept(MediaType.APPLICATION_XML).post(ClientResponse.class);
+       assertEquals(403, cr.getStatus());
+    }
+    
+//
+//   Response listProfiles(String groupId) throws IOException;
+    
+    @Test
+    public void testListProfilesAndComponents() throws Exception{
+        System.out.println("test listProfilesAndComponents");
+        
+        fillUpGroupA();
+        
+        // test itself
+        
+       ClientResponse cr  = this.getAuthenticatedResource(getResource()
+                .path("/registry/groups/profiles").queryParam("groupId", "1")).accept(MediaType.APPLICATION_XML).get(ClientResponse.class);
+       assertEquals(200, cr.getStatus());
+       List<String> result = cr.getEntity(ComponentRegistryRestService.StringsWrapper.class).strings;
+       assertEquals(1, result.size());
+       assertEquals(ProfileDescription.PROFILE_PREFIX+"profile-1", result.get(0));
+       
+       cr  = this.getAuthenticatedResource(getResource()
+                .path("/registry/groups/components").queryParam("groupId", "1")).accept(MediaType.APPLICATION_XML).get(ClientResponse.class);
+       assertEquals(200, cr.getStatus());
+       result = cr.getEntity(ComponentRegistryRestService.StringsWrapper.class).strings;
+       assertEquals(2, result.size());
+       assertEquals(ComponentDescription.COMPONENT_PREFIX+"component-1", result.get(0));
+       assertEquals(ComponentDescription.COMPONENT_PREFIX+"component-2", result.get(1));
+    }
+    
+
+ 
+//
+//    Response getGroupNameById(String groupId) throws IOException;
+    
+    @Test
+    public void testGetGroupNamebyId() throws Exception{
+        System.out.println("test getGroupNamebyId");
+        
+        MakeGroupA();
+        MakeGroupB();
+        // test itself
+        
+       ClientResponse cr  = this.getAuthenticatedResource(getResource()
+                .path("/registry/groups/nameById").queryParam("groupId", "1")).accept(MediaType.APPLICATION_XML).get(ClientResponse.class);
+       assertEquals(200, cr.getStatus());
+       String result = cr.getEntity(String.class);
+       assertEquals("group A", result);
+       
+      cr  = this.getAuthenticatedResource(getResource()
+                .path("/registry/groups/nameById").queryParam("groupId", "2")).accept(MediaType.APPLICATION_XML).get(ClientResponse.class);
+       assertEquals(200, cr.getStatus());
+       result = cr.getEntity(String.class);
+       assertEquals("group B", result);
+    }
+    
+//
+//    Response getGroupIdByName(String groupName) throws IOException;
+    
+    @Test
+    public void testGetIdByGroupName() throws Exception{
+        System.out.println("test getIdByGroupName");
+        
+        MakeGroupA();
+        MakeGroupB();
+        // test itself
+        
+       ClientResponse cr  = this.getAuthenticatedResource(getResource()
+                .path("/registry/groups/idByName").queryParam("groupName", "group B")).accept(MediaType.APPLICATION_XML).get(ClientResponse.class);
+       assertEquals(200, cr.getStatus());
+       String result = cr.getEntity(String.class);
+       assertEquals("2", result);
+       
+      cr  = this.getAuthenticatedResource(getResource()
+                .path("/registry/groups/idByName").queryParam("groupName", "group A")).accept(MediaType.APPLICATION_XML).get(ClientResponse.class);
+       assertEquals(200, cr.getStatus());
+       result = cr.getEntity(String.class);
+       assertEquals("1", result);
+    }
+    
+     
+//    Response transferItemOwnershipToGroup(String itemId, long groupId) throws IOException;   
+//   
+
+
+}
