Return-Path: X-Original-To: apmail-directory-dev-archive@www.apache.org Delivered-To: apmail-directory-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id DD4449FDE for ; Fri, 18 Nov 2011 10:27:28 +0000 (UTC) Received: (qmail 65518 invoked by uid 500); 18 Nov 2011 10:27:28 -0000 Delivered-To: apmail-directory-dev-archive@directory.apache.org Received: (qmail 65479 invoked by uid 500); 18 Nov 2011 10:27:28 -0000 Mailing-List: contact dev-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Apache Directory Developers List" Delivered-To: mailing list dev@directory.apache.org Received: (qmail 65472 invoked by uid 99); 18 Nov 2011 10:27:28 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 18 Nov 2011 10:27:28 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of pajbam@gmail.com designates 74.125.82.44 as permitted sender) Received: from [74.125.82.44] (HELO mail-ww0-f44.google.com) (74.125.82.44) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 18 Nov 2011 10:27:11 +0000 Received: by wwe5 with SMTP id 5so4931606wwe.1 for ; Fri, 18 Nov 2011 02:26:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=sender:from:mime-version:content-type:subject:date:in-reply-to:to :references:message-id:x-mailer; bh=LdDJe/ZZeYLOVmdcZAD+U6BhA4M2Bl1/u9c09rM0V7A=; b=xsaLQ7X09Z//8ZvijbhLgkSJdx0tRpAhi17qfX9O1AqPaLCJL520PsISBKK7kX3cfk JBGngwCUR38QqdEZuTr0FUcx9raN6bsV/HB+szEjG0l2mu7MbMqrJJN72nf/oJxuZ8Pw j7oOlbAn5JZk2UmI9C4Vl/08vHWFz8qyZzixI= Received: by 10.216.137.193 with SMTP id y43mr374201wei.108.1321612011460; Fri, 18 Nov 2011 02:26:51 -0800 (PST) Received: from [10.0.1.2] (def92-4-82-225-58-213.fbx.proxad.net. [82.225.58.213]) by mx.google.com with ESMTPS id dy1sm157131wib.18.2011.11.18.02.26.45 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 18 Nov 2011 02:26:49 -0800 (PST) Sender: Pierre-Arnaud Marcelot From: Pierre-Arnaud Marcelot Mime-Version: 1.0 (Apple Message framework v1251.1) Content-Type: multipart/alternative; boundary="Apple-Mail=_C65DD922-A737-44EF-A602-6825C462238C" Subject: Re: svn commit: r1203217 - in /directory/apacheds/trunk: ./ component-hub/ component-hub/src/ component-hub/src/main/ component-hub/src/main/java/ component-hub/src/main/java/org/ component-hub/src/main/java/org/apache/ component-hub/src/main/java/or Date: Fri, 18 Nov 2011 11:26:41 +0100 In-Reply-To: To: "Apache Directory Developers List" References: <32AEB46D-35A3-40C9-BB00-BD4D958E1E54@marcelot.net> Message-Id: <49CE29AA-B9C0-4795-A541-71DC3FF4534E@marcelot.net> X-Mailer: Apple Mail (2.1251.1) X-Virus-Checked: Checked by ClamAV on apache.org --Apple-Mail=_C65DD922-A737-44EF-A602-6825C462238C Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=windows-1252 On 18 nov. 2011, at 11:14, G=F6kt=FCrk Gezer wrote: >=20 > On Nov 18, 2011 12:03 PM, "Pierre-Arnaud Marcelot" = wrote: > > > > On 18 nov. 2011, at 10:54, G=F6kt=FCrk Gezer wrote: > >> > >> Hi Pierre, > >> > >> On Nov 18, 2011 11:50 AM, "Pierre-Arnaud Marcelot" = wrote: > >> > > >> > Hi G=F6kt=FCrk, > >> > > >> > As I was merging modifications from trunk to the OSGI branch, I = noticed this commit was done on trunk instead of the OSGI branch. > >> > Was this on purpose? > >> This is what Emmanuel wanted. He did not want to deal with merging. = Actually my things are all seperated from the main code for now. It can = be merged back easily. > > > > Hum=85 I see. > > But it has a lot to do with the OSGI branch, right? >=20 > Not until componenthub is finished. I mean it uses osgi but does not = effect the code. > > > > Are we dropping the OSGI branch? > > > I don't think so. We need that branch 2-3 days later. > > Am I missing something? > > > I feel like that sometimes :) Letme finish hub and then we replicate = the apacheds-trunk as apacheds-osgi-brunch. So nobody deals with merging = for 2 days :) >=20 My merge is almost done (2 very small conflicts resolved) and the tests = are running at the moment to verify nothing is broken. I will focus back on OSGI with Studio and try to find a fix for the = Equinox issue, so I need an up-to-date ApacheDS code. > > Regards, > > Pierre-Arnaud > >> > >> > > >> > Regards, > >> > Pierre-Arnaud > >> > > >> > On 17 nov. 2011, at 16:21, gokturk@apache.org wrote: > >> > > >> > > Author: gokturk > >> > > Date: Thu Nov 17 15:21:39 2011 > >> > > New Revision: 1203217 > >> > > > >> > > URL: http://svn.apache.org/viewvc?rev=3D1203217&view=3Drev > >> > > Log: > >> > > First work on ApacheDS ComponentHub ( the IPojo based main = plug-in layer). > >> > > > >> > > TODO: > >> > > * Implement ComponentManager for ComponentHub's clients to = manage component instances,schema and configuration > >> > > * Implement entry cache to preserve component instance = configuration across server sessions. > >> > > * Add test cases for "customuser" typed components. > >> > > ...... > >> > > * Create InterceptorHubClient to manage interceptors using = plug-in layer. > >> > > > >> > > > >> > > Added: > >> > > directory/apacheds/trunk/component-hub/ > >> > > directory/apacheds/trunk/component-hub/pom.xml > >> > > directory/apacheds/trunk/component-hub/src/ > >> > > directory/apacheds/trunk/component-hub/src/main/ > >> > > directory/apacheds/trunk/component-hub/src/main/java/ > >> > > directory/apacheds/trunk/component-hub/src/main/java/org/ > >> > > = directory/apacheds/trunk/component-hub/src/main/java/org/apache/ > >> > > = directory/apacheds/trunk/component-hub/src/main/java/org/apache/directory/= > >> > > = directory/apacheds/trunk/component-hub/src/main/java/org/apache/directory/= server/ > >> > > = directory/apacheds/trunk/component-hub/src/main/java/org/apache/directory/= server/component/ > >> > > = directory/apacheds/trunk/component-hub/src/main/java/org/apache/directory/= server/component/ADSComponent.java > >> > > = directory/apacheds/trunk/component-hub/src/main/java/org/apache/directory/= server/component/ADSComponentInstance.java > >> > > = directory/apacheds/trunk/component-hub/src/main/java/org/apache/directory/= server/component/ADSConstants.java > >> > > = directory/apacheds/trunk/component-hub/src/main/java/org/apache/directory/= server/component/handler/ > >> > > = directory/apacheds/trunk/component-hub/src/main/java/org/apache/directory/= server/component/handler/ADSComponent.java > >> > > = directory/apacheds/trunk/component-hub/src/main/java/org/apache/directory/= server/component/handler/ADSComponentHandler.java > >> > > = directory/apacheds/trunk/component-hub/src/main/java/org/apache/directory/= server/component/hub/ > >> > > = directory/apacheds/trunk/component-hub/src/main/java/org/apache/directory/= server/component/hub/ComponentHub.java > >> > > = directory/apacheds/trunk/component-hub/src/main/java/org/apache/directory/= server/component/hub/listener/ > >> > > = directory/apacheds/trunk/component-hub/src/main/java/org/apache/directory/= server/component/hub/listener/AbstractHubListener.java > >> > > = directory/apacheds/trunk/component-hub/src/main/java/org/apache/directory/= server/component/hub/listener/HubListener.java > >> > > = directory/apacheds/trunk/component-hub/src/main/java/org/apache/directory/= server/component/schema/ > >> > > = directory/apacheds/trunk/component-hub/src/main/java/org/apache/directory/= server/component/schema/ADSComponentSchema.java > >> > > = directory/apacheds/trunk/component-hub/src/main/java/org/apache/directory/= server/component/schema/ComponentOIDGenerator.java > >> > > = directory/apacheds/trunk/component-hub/src/main/java/org/apache/directory/= server/component/schema/ComponentSchemaGenerator.java > >> > > = directory/apacheds/trunk/component-hub/src/main/java/org/apache/directory/= server/component/schema/UserComponentSchemaGenerator.java > >> > > Modified: > >> > > directory/apacheds/trunk/pom.xml > >> > > > >> > > Added: directory/apacheds/trunk/component-hub/pom.xml > >> > > URL: = http://svn.apache.org/viewvc/directory/apacheds/trunk/component-hub/pom.xm= l?rev=3D1203217&view=3Dauto > >> > > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > >> > > --- directory/apacheds/trunk/component-hub/pom.xml (added) > >> > > +++ directory/apacheds/trunk/component-hub/pom.xml Thu Nov 17 = 15:21:39 2011 > >> > > @@ -0,0 +1,97 @@ > >> > > + > >> > > + > >> > > + > >> > > + > >> > > + > >> > > + 4.0.0 > >> > > + > >> > > + org.apache.directory.server > >> > > + apacheds-parent > >> > > + 2.0.0-M4-SNAPSHOT > >> > > + > >> > > + > >> > > + apacheds-component-hub > >> > > + ApacheDS Component Hub > >> > > + bundle > >> > > + Provides main plugin-layer for = ApacheDS > >> > > + > >> > > + > >> > > + > >> > > + > >> > > + org.apache.directory.server > >> > > + apacheds-core-api > >> > > + > >> > > + > >> > > + > >> > > + org.apache.directory.shared > >> > > + shared-ldap-model > >> > > + > >> > > + > >> > > + > >> > > + org.apache.felix > >> > > + = org.apache.felix.ipojo.annotations > >> > > + 1.8.0 > >> > > + > >> > > + > >> > > + > >> > > + org.apache.felix > >> > > + = org.apache.felix.ipojo.handler.whiteboard > >> > > + 1.6.0 > >> > > + > >> > > + > >> > > + > >> > > + org.osgi > >> > > + org.osgi.core > >> > > + 4.3.0 > >> > > + > >> > > + > >> > > + > >> > > + > >> > > + > >> > > + > >> > > + > >> > > + org.apache.felix > >> > > + maven-bundle-plugin > >> > > + true > >> > > + true > >> > > + > >> > > + META-INF > >> > > + > >> > > + = ${project.groupId}.component.hub > >> > > + > >> > > + > >> > > + > >> > > + > >> > > + > >> > > + org.apache.felix > >> > > + maven-ipojo-plugin > >> > > + 1.8.0 > >> > > + > >> > > + > >> > > + > >> > > + ipojo-bundle > >> > > + > >> > > + > >> > > + > >> > > + > >> > > + > >> > > + > >> > > + > >> > > + > >> > > > >> > > Added: = directory/apacheds/trunk/component-hub/src/main/java/org/apache/directory/= server/component/ADSComponent.java > >> > > URL: = http://svn.apache.org/viewvc/directory/apacheds/trunk/component-hub/src/ma= in/java/org/apache/directory/server/component/ADSComponent.java?rev=3D1203= 217&view=3Dauto > >> > > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > >> > > --- = directory/apacheds/trunk/component-hub/src/main/java/org/apache/directory/= server/component/ADSComponent.java (added) > >> > > +++ = directory/apacheds/trunk/component-hub/src/main/java/org/apache/directory/= server/component/ADSComponent.java Thu Nov 17 15:21:39 2011 > >> > > @@ -0,0 +1,49 @@ > >> > > +/* > >> > > + * Licensed to the Apache Software Foundation (ASF) under one > >> > > + * or more contributor license agreements. See the NOTICE = file > >> > > + * distributed with this work for additional information > >> > > + * regarding copyright ownership. The ASF licenses this file > >> > > + * to you under the Apache License, Version 2.0 (the > >> > > + * "License"); you may not use this file except in compliance > >> > > + * with the License. You may obtain a copy of the License at > >> > > + * > >> > > + * http://www.apache.org/licenses/LICENSE-2.0 > >> > > + * > >> > > + * Unless required by applicable law or agreed to in writing, > >> > > + * software distributed under the License is distributed on = an > >> > > + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY > >> > > + * KIND, either express or implied. See the License for the > >> > > + * specific language governing permissions and limitations > >> > > + * under the License. > >> > > + * > >> > > + */ > >> > > +package org.apache.directory.server.component; > >> > > + > >> > > +import java.util.List; > >> > > + > >> > > +import org.apache.directory.shared.ldap.model.ldif.LdifReader; > >> > > +import org.apache.felix.ipojo.ComponentFactory; > >> > > + > >> > > +/** > >> > > + * Class that represents a component for ApacheDS use. > >> > > + * > >> > > + * @author Apache = Directory Project > >> > > + */ > >> > > +public class ADSComponent > >> > > +{ > >> > > + private ComponentFactory factory; > >> > > + > >> > > + private String componentType =3D "user"; > >> > > + > >> > > + private String componentSchemaDn; > >> > > + > >> > > + private List instances; > >> > > + > >> > > + private LdifReader cacheHandle; > >> > > + > >> > > + public ComponentFactory getFactory() > >> > > + { > >> > > + return factory; > >> > > + } > >> > > + > >> > > +} > >> > > > >> > > Added: = directory/apacheds/trunk/component-hub/src/main/java/org/apache/directory/= server/component/ADSComponentInstance.java > >> > > URL: = http://svn.apache.org/viewvc/directory/apacheds/trunk/component-hub/src/ma= in/java/org/apache/directory/server/component/ADSComponentInstance.java?re= v=3D1203217&view=3Dauto > >> > > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > >> > > --- = directory/apacheds/trunk/component-hub/src/main/java/org/apache/directory/= server/component/ADSComponentInstance.java (added) > >> > > +++ = directory/apacheds/trunk/component-hub/src/main/java/org/apache/directory/= server/component/ADSComponentInstance.java Thu Nov 17 15:21:39 2011 > >> > > @@ -0,0 +1,39 @@ > >> > > +/* > >> > > + * Licensed to the Apache Software Foundation (ASF) under one > >> > > + * or more contributor license agreements. See the NOTICE = file > >> > > + * distributed with this work for additional information > >> > > + * regarding copyright ownership. The ASF licenses this file > >> > > + * to you under the Apache License, Version 2.0 (the > >> > > + * "License"); you may not use this file except in compliance > >> > > + * with the License. You may obtain a copy of the License at > >> > > + * > >> > > + * http://www.apache.org/licenses/LICENSE-2.0 > >> > > + * > >> > > + * Unless required by applicable law or agreed to in writing, > >> > > + * software distributed under the License is distributed on = an > >> > > + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY > >> > > + * KIND, either express or implied. See the License for the > >> > > + * specific language governing permissions and limitations > >> > > + * under the License. > >> > > + * > >> > > + */ > >> > > +package org.apache.directory.server.component; > >> > > + > >> > > +import org.apache.directory.shared.ldap.model.ldif.LdifEntry; > >> > > + > >> > > +/** > >> > > + * Class that represents an individual instance of an = ADSComponent > >> > > + * > >> > > + * @author Apache = Directory Project > >> > > + */ > >> > > +public class ADSComponentInstance > >> > > +{ > >> > > + private LdifEntry instanceEntry; > >> > > + > >> > > + private String configHookDn; > >> > > + > >> > > + private Object instance; > >> > > + > >> > > + private ADSComponent parentComponent; > >> > > + > >> > > +} > >> > > > >> > > Added: = directory/apacheds/trunk/component-hub/src/main/java/org/apache/directory/= server/component/ADSConstants.java > >> > > URL: = http://svn.apache.org/viewvc/directory/apacheds/trunk/component-hub/src/ma= in/java/org/apache/directory/server/component/ADSConstants.java?rev=3D1203= 217&view=3Dauto > >> > > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > >> > > --- = directory/apacheds/trunk/component-hub/src/main/java/org/apache/directory/= server/component/ADSConstants.java (added) > >> > > +++ = directory/apacheds/trunk/component-hub/src/main/java/org/apache/directory/= server/component/ADSConstants.java Thu Nov 17 15:21:39 2011 > >> > > @@ -0,0 +1,136 @@ > >> > > +/* > >> > > + * Licensed to the Apache Software Foundation (ASF) under one > >> > > + * or more contributor license agreements. See the NOTICE = file > >> > > + * distributed with this work for additional information > >> > > + * regarding copyright ownership. The ASF licenses this file > >> > > + * to you under the Apache License, Version 2.0 (the > >> > > + * "License"); you may not use this file except in compliance > >> > > + * with the License. You may obtain a copy of the License at > >> > > + * > >> > > + * http://www.apache.org/licenses/LICENSE-2.0 > >> > > + * > >> > > + * Unless required by applicable law or agreed to in writing, > >> > > + * software distributed under the License is distributed on = an > >> > > + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY > >> > > + * KIND, either express or implied. See the License for the > >> > > + * specific language governing permissions and limitations > >> > > + * under the License. > >> > > + * > >> > > + */ > >> > > +package org.apache.directory.server.component; > >> > > + > >> > > + > >> > > +import java.util.Dictionary; > >> > > +import java.util.Hashtable; > >> > > + > >> > > + > >> > > +/** > >> > > + * Class to hold constants for ApacheDS component management. > >> > > + * > >> > > + * @author Apache = Directory Project > >> > > + */ > >> > > +public class ADSConstants > >> > > +{ > >> > > + > >> > > + /* > >> > > + * base directory path for component cache > >> > > + */ > >> > > + public static final String ADS_CACHE_BASE_DIR =3D = "adscache"; > >> > > + > >> > > + /* > >> > > + * default file name for caching schemas inside for = components > >> > > + */ > >> > > + public static final String ADS_CACHE_SCHEMA_FILE =3D = "schema.ldif"; > >> > > + > >> > > + /* > >> > > + * default file name for caching instance entries inside = for components > >> > > + */ > >> > > + public static final String ADS_CACHE_INSTANCES_FILE =3D = "instances.ldif"; > >> > > + > >> > > + /* > >> > > + * default file name for caching version information for = components > >> > > + */ > >> > > + public static final String ADS_CACHE_VERSION_FILE =3D = "version"; > >> > > + > >> > > + /* > >> > > + * IPojo Handler name for ADSComponent annotation. > >> > > + */ > >> > > + public static final String ADS_COMPONENT_HANDLER_NS =3D = "org.apache.directory.server.component.handler"; > >> > > + > >> > > + /* > >> > > + * IPojo Handler name for ADSComponent annotation. > >> > > + */ > >> > > + public static final String ADS_COMPONENT_HANDLER_NAME =3D = "ADSComponentHandler"; > >> > > + > >> > > + /* > >> > > + * IPojo Handler name for ADSComponent annotation. > >> > > + */ > >> > > + public static final String ADS_COMPONENT_HANDLER_FULLNAME = =3D "org.apache.directory.server.component.handler:ADSComponentHandler"; > >> > > + > >> > > + /* > >> > > + * iPOJO Component Type and Instance declaration header. > >> > > + */ > >> > > + public static final String IPOJO_HEADER =3D = "iPOJO-Components"; > >> > > + > >> > > + /* > >> > > + * Base OID value for ApacheDS component schemas. > >> > > + */ > >> > > + public static final String ADS_COMPONENT_BASE_OID =3D = "1.3.6.1.4.1.18060.0.4.4"; > >> > > + > >> > > + /* > >> > > + * Component type name of user defined components. > >> > > + */ > >> > > + public static final String ADS_COMPONENT_TYPE_USER =3D = "user"; > >> > > + > >> > > + /* > >> > > + * Base DN for @ADSComponent(componentType=3D"user") = component schema elements. > >> > > + */ > >> > > + public static final String ADS_USER_COMPONENTS_SCHEMA_DN =3D= "cn=3Dusercomponents,ou=3Dschema"; > >> > > + > >> > > + /* > >> > > + * Hash table for mapping property type name to its syntax = in ApacheDS > >> > > + */ > >> > > + public static Dictionary syntaxMappings; > >> > > + > >> > > + /* > >> > > + * Hash table for mapping property type name to its = equality matching rule in ApacheDS > >> > > + */ > >> > > + public static Dictionary equalityMappings; > >> > > + > >> > > + /* > >> > > + * Hash table for mapping property type name to its = ordering rule in ApacheDS > >> > > + */ > >> > > + public static Dictionary orderingMappings; > >> > > + > >> > > + /* > >> > > + * Hash table for mapping property type name to its = substring matching in ApacheDS > >> > > + */ > >> > > + public static Dictionary = substringMappings; > >> > > + > >> > > + /** > >> > > + * Static constructor that initializes the values of the = type mapping Hash tables. > >> > > + */ > >> > > + static > >> > > + { > >> > > + syntaxMappings =3D new Hashtable(); > >> > > + syntaxMappings.put( "int", = "1.3.6.1.4.1.1466.115.121.1.27" ); > >> > > + syntaxMappings.put( "java.lang.String", = "1.3.6.1.4.1.1466.115.121.1.15" ); > >> > > + syntaxMappings.put( "boolean", = "1.3.6.1.4.1.1466.115.121.1.7" ); > >> > > + > >> > > + equalityMappings =3D new Hashtable(); > >> > > + equalityMappings.put( "int", "integerMatch" ); > >> > > + equalityMappings.put( "java.lang.String", = "caseExactMatch" ); > >> > > + equalityMappings.put( "boolean", "booleanMatch" ); > >> > > + > >> > > + orderingMappings =3D new Hashtable(); > >> > > + orderingMappings.put( "int", "integerOrderingMatch" ); > >> > > + orderingMappings.put( "java.lang.String", = "caseExactOrderingMatch" ); > >> > > + orderingMappings.put( "boolean", = "caseIgnoreOrderingMatch" ); > >> > > + > >> > > + substringMappings =3D new Hashtable(); > >> > > + substringMappings.put( "int", = "numericStringSubstringsMatch" ); > >> > > + substringMappings.put( "java.lang.String", = "caseExactSubstringsMatch" ); > >> > > + substringMappings.put( "boolean", = "caseIgnoreSubstringsMatch" ); > >> > > + } > >> > > + > >> > > +} > >> > > > >> > > Added: = directory/apacheds/trunk/component-hub/src/main/java/org/apache/directory/= server/component/handler/ADSComponent.java > >> > > URL: = http://svn.apache.org/viewvc/directory/apacheds/trunk/component-hub/src/ma= in/java/org/apache/directory/server/component/handler/ADSComponent.java?re= v=3D1203217&view=3Dauto > >> > > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > >> > > --- = directory/apacheds/trunk/component-hub/src/main/java/org/apache/directory/= server/component/handler/ADSComponent.java (added) > >> > > +++ = directory/apacheds/trunk/component-hub/src/main/java/org/apache/directory/= server/component/handler/ADSComponent.java Thu Nov 17 15:21:39 2011 > >> > > @@ -0,0 +1,31 @@ > >> > > +/* > >> > > + * Licensed to the Apache Software Foundation (ASF) under one > >> > > + * or more contributor license agreements. See the NOTICE = file > >> > > + * distributed with this work for additional information > >> > > + * regarding copyright ownership. The ASF licenses this file > >> > > + * to you under the Apache License, Version 2.0 (the > >> > > + * "License"); you may not use this file except in compliance > >> > > + * with the License. You may obtain a copy of the License at > >> > > + * > >> > > + * http://www.apache.org/licenses/LICENSE-2.0 > >> > > + * > >> > > + * Unless required by applicable law or agreed to in writing, > >> > > + * software distributed under the License is distributed on = an > >> > > + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY > >> > > + * KIND, either express or implied. See the License for the > >> > > + * specific language governing permissions and limitations > >> > > + * under the License. > >> > > + * > >> > > + */ > >> > > +package org.apache.directory.server.component.handler; > >> > > + > >> > > + > >> > > +/** > >> > > + * Used to annotate ApacheDS components with their component = type. > >> > > + * > >> > > + * @author Apache = Directory Project > >> > > + */ > >> > > +public @interface ADSComponent > >> > > +{ > >> > > + String componentType() default "user"; > >> > > +} > >> > > > >> > > Added: = directory/apacheds/trunk/component-hub/src/main/java/org/apache/directory/= server/component/handler/ADSComponentHandler.java > >> > > URL: = http://svn.apache.org/viewvc/directory/apacheds/trunk/component-hub/src/ma= in/java/org/apache/directory/server/component/handler/ADSComponentHandler.= java?rev=3D1203217&view=3Dauto > >> > > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > >> > > --- = directory/apacheds/trunk/component-hub/src/main/java/org/apache/directory/= server/component/handler/ADSComponentHandler.java (added) > >> > > +++ = directory/apacheds/trunk/component-hub/src/main/java/org/apache/directory/= server/component/handler/ADSComponentHandler.java Thu Nov 17 15:21:39 = 2011 > >> > > @@ -0,0 +1,65 @@ > >> > > +/* > >> > > + * Licensed to the Apache Software Foundation (ASF) under one > >> > > + * or more contributor license agreements. See the NOTICE = file > >> > > + * distributed with this work for additional information > >> > > + * regarding copyright ownership. The ASF licenses this file > >> > > + * to you under the Apache License, Version 2.0 (the > >> > > + * "License"); you may not use this file except in compliance > >> > > + * with the License. You may obtain a copy of the License at > >> > > + * > >> > > + * http://www.apache.org/licenses/LICENSE-2.0 > >> > > + * > >> > > + * Unless required by applicable law or agreed to in writing, > >> > > + * software distributed under the License is distributed on = an > >> > > + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY > >> > > + * KIND, either express or implied. See the License for the > >> > > + * specific language governing permissions and limitations > >> > > + * under the License. > >> > > + * > >> > > + */ > >> > > +package org.apache.directory.server.component.handler; > >> > > + > >> > > + > >> > > +import java.util.Dictionary; > >> > > + > >> > > +import org.apache.felix.ipojo.ConfigurationException; > >> > > +import org.apache.felix.ipojo.PrimitiveHandler; > >> > > +import org.apache.felix.ipojo.annotations.Handler; > >> > > +import org.apache.felix.ipojo.metadata.Element; > >> > > + > >> > > + > >> > > +/** > >> > > + * IPojo handler for ADSComponent annotation. > >> > > + * It does not supposed to do anything. It is just to validate = the custom-annotated component. > >> > > + * > >> > > + * > >> > > + * @author Apache = Directory Project > >> > > + */ > >> > > +@Handler(namespace =3D = "org.apache.directory.server.component.handler", name =3D = "ADSComponent") > >> > > +public class ADSComponentHandler extends PrimitiveHandler > >> > > +{ > >> > > + > >> > > + @Override > >> > > + public void configure( Element metadata, Dictionary = configuration ) throws ConfigurationException > >> > > + { > >> > > + // TODO Auto-generated method stub > >> > > + > >> > > + } > >> > > + > >> > > + > >> > > + @Override > >> > > + public void stop() > >> > > + { > >> > > + // TODO Auto-generated method stub > >> > > + > >> > > + } > >> > > + > >> > > + > >> > > + @Override > >> > > + public void start() > >> > > + { > >> > > + // TODO Auto-generated method stub > >> > > + > >> > > + } > >> > > + > >> > > +} > >> > > > >> > > Added: = directory/apacheds/trunk/component-hub/src/main/java/org/apache/directory/= server/component/hub/ComponentHub.java > >> > > URL: = http://svn.apache.org/viewvc/directory/apacheds/trunk/component-hub/src/ma= in/java/org/apache/directory/server/component/hub/ComponentHub.java?rev=3D= 1203217&view=3Dauto > >> > > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > >> > > --- = directory/apacheds/trunk/component-hub/src/main/java/org/apache/directory/= server/component/hub/ComponentHub.java (added) > >> > > +++ = directory/apacheds/trunk/component-hub/src/main/java/org/apache/directory/= server/component/hub/ComponentHub.java Thu Nov 17 15:21:39 2011 > >> > > @@ -0,0 +1,418 @@ > >> > > +/* > >> > > + * Licensed to the Apache Software Foundation (ASF) under one > >> > > + * or more contributor license agreements. See the NOTICE = file > >> > > + * distributed with this work for additional information > >> > > + * regarding copyright ownership. The ASF licenses this file > >> > > + * to you under the Apache License, Version 2.0 (the > >> > > + * "License"); you may not use this file except in compliance > >> > > + * with the License. You may obtain a copy of the License at > >> > > + * > >> > > + * http://www.apache.org/licenses/LICENSE-2.0 > >> > > + * > >> > > + * Unless required by applicable law or agreed to in writing, > >> > > + * software distributed under the License is distributed on = an > >> > > + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY > >> > > + * KIND, either express or implied. See the License for the > >> > > + * specific language governing permissions and limitations > >> > > + * under the License. > >> > > + * > >> > > + */ > >> > > +package org.apache.directory.server.component.hub; > >> > > + > >> > > + > >> > > +import java.util.ArrayList; > >> > > +import java.util.Dictionary; > >> > > +import java.util.Enumeration; > >> > > +import java.util.Hashtable; > >> > > +import java.util.List; > >> > > + > >> > > +import org.apache.directory.server.component.ADSComponent; > >> > > +import org.apache.directory.server.component.ADSConstants; > >> > > +import = org.apache.directory.server.component.hub.listener.HubListener; > >> > > +import = org.apache.directory.server.component.schema.ComponentSchemaGenerator; > >> > > +import = org.apache.directory.server.component.schema.UserComponentSchemaGenerator;= > >> > > +import org.apache.felix.ipojo.Factory; > >> > > +import org.apache.felix.ipojo.annotations.Component; > >> > > +import org.apache.felix.ipojo.annotations.Invalidate; > >> > > +import org.apache.felix.ipojo.annotations.Requires; > >> > > +import org.apache.felix.ipojo.annotations.Validate; > >> > > +import org.apache.felix.ipojo.metadata.Element; > >> > > +import org.apache.felix.ipojo.parser.ManifestMetadataParser; > >> > > +import org.apache.felix.ipojo.parser.ParseException; > >> > > +import org.apache.felix.ipojo.whiteboard.Wbp; > >> > > +import org.apache.felix.ipojo.whiteboard.Whiteboards; > >> > > +import org.osgi.framework.ServiceReference; > >> > > +import org.osgi.service.log.LogService; > >> > > + > >> > > + > >> > > +/** > >> > > + * An IPojo component that listens for incoming factories and = instances. > >> > > + * Creating or destroying corresponding ADSComponent from = them. > >> > > + * > >> > > + * > >> > > + * @author Apache = Directory Project > >> > > + */ > >> > > +@Component > >> > > +@Whiteboards(whiteboards =3D > >> > > + { > >> > > + @Wbp(onArrival =3D "onFactoryArrival", > >> > > + onDeparture =3D "onFactoryDeparture", > >> > > + filter =3D = "(objectClass=3Dorg.apache.felix.ipojo.Factory)"), > >> > > + @Wbp(onArrival =3D "onInstanceArrival", > >> > > + onDeparture =3D "onInstanceDeparture", > >> > > + filter =3D = "(objectClass=3Dorg.apache.felix.ipojo.architecture.Architecture)") > >> > > +}) > >> > > +public class ComponentHub > >> > > +{ > >> > > + /* > >> > > + * boolean value to check for deferred writes to schema = partition > >> > > + */ > >> > > + private boolean schemaReady =3D false; > >> > > + > >> > > + /* > >> > > + * boolean value to check for deferred writes to config = partition > >> > > + */ > >> > > + private boolean configReady =3D false; > >> > > + > >> > > + /* > >> > > + * Map to keep "component type" -> "components" mapping. > >> > > + */ > >> > > + private Dictionary> = componentMap; > >> > > + > >> > > + /* > >> > > + * List to keep all active ApacheDS components. > >> > > + */ > >> > > + private List components; > >> > > + > >> > > + /* > >> > > + * Map to keep "component type" -> "schema generator" = mapping. > >> > > + */ > >> > > + private Dictionary = schemaGenerators; > >> > > + > >> > > + /* > >> > > + * Map to keep "component type" -> "listeners" mapping > >> > > + */ > >> > > + private Dictionary> = listenersMap; > >> > > + > >> > > + /* > >> > > + * OSGI Logger > >> > > + */ > >> > > + @Requires > >> > > + private LogService logger; > >> > > + > >> > > + > >> > > + public ComponentHub() > >> > > + { > >> > > + componentMap =3D new Hashtable>(); > >> > > + components =3D new ArrayList(); > >> > > + > >> > > + schemaGenerators =3D new Hashtable(); > >> > > + schemaGenerators.put( = ADSConstants.ADS_COMPONENT_TYPE_USER, new UserComponentSchemaGenerator() = ); > >> > > + > >> > > + listenersMap =3D new Hashtable>(); > >> > > + } > >> > > + > >> > > + > >> > > + /** > >> > > + * Called when ADSComponentHub instance is validated by = IPojo > >> > > + * > >> > > + */ > >> > > + @Validate > >> > > + public void hubValidated() > >> > > + { > >> > > + logger.log( LogService.LOG_INFO, "ADSComponentHub = validated." ); > >> > > + } > >> > > + > >> > > + > >> > > + /** > >> > > + * Called when ADSComponentHub instance is invalidated by = IPojo > >> > > + * > >> > > + */ > >> > > + @Invalidate > >> > > + public void hubInvalidated() > >> > > + { > >> > > + logger.log( LogService.LOG_INFO, "ADSComponentHub = validated." ); > >> > > + } > >> > > + > >> > > + > >> > > + /** > >> > > + * Factory arrival callback, registered by whiteboard = handler. > >> > > + * > >> > > + * @param ref Reference to IPojo Factory > >> > > + */ > >> > > + public void onFactoryArrival( ServiceReference ref ) > >> > > + { > >> > > + Factory arrivingFactory =3D ( Factory ) = ref.getBundle().getBundleContext().getService( ref ); > >> > > + if ( !checkIfADSComponent( arrivingFactory ) ) > >> > > + { > >> > > + return; > >> > > + } > >> > > + > >> > > + try > >> > > + { > >> > > + String componentType =3D parseComponentType( = arrivingFactory ); > >> > > + > >> > > + List listenersByType =3D = listenersMap.get( componentType ); > >> > > + > >> > > + // Fire the 'factory arrived' event on listeners. > >> > > + if ( listenersByType !=3D null ) > >> > > + { > >> > > + for ( HubListener listener : listenersByType ) > >> > > + { > >> > > + listener.onFactoryArrival( arrivingFactory = ); > >> > > + } > >> > > + } > >> > > + > >> > > + //Actual ADSComponent creation > >> > > + ADSComponent component =3D generateADSComponent( = componentType, arrivingFactory ); > >> > > + > >> > > + // Iterate over listeners for 'component created' = event. Apply the changes applied by them. > >> > > + if ( listenersByType !=3D null ) > >> > > + { > >> > > + for ( HubListener listener : listenersByType ) > >> > > + { > >> > > + ADSComponent _comp =3D = listener.onComponentCreation( component ); > >> > > + if ( _comp !=3D null ) > >> > > + { > >> > > + component =3D _comp; > >> > > + } > >> > > + } > >> > > + } > >> > > + > >> > > + //Keep the newly created ADSComponent reference. > >> > > + components.add( component ); > >> > > + > >> > > + List componentsByType =3D = componentMap.get( componentType ); > >> > > + if ( componentsByType =3D=3D null ) > >> > > + { > >> > > + List newCompList =3D new = ArrayList(); > >> > > + newCompList.add( component ); > >> > > + componentMap.put( componentType, newCompList = ); > >> > > + } > >> > > + else > >> > > + { > >> > > + componentsByType.add( component ); > >> > > + } > >> > > + > >> > > + } > >> > > + catch ( ParseException e ) > >> > > + { > >> > > + e.printStackTrace(); > >> > > + } > >> > > + > >> > > + } > >> > > + > >> > > + > >> > > + /** > >> > > + * Factory departure callback, registered by whiteboard = handler. > >> > > + * > >> > > + * @param ref Reference to IPojo Factory > >> > > + */ > >> > > + public void onFactoryDeparture( ServiceReference ref ) > >> > > + { > >> > > + Factory leavingFactory =3D ( Factory ) = ref.getBundle().getBundleContext().getService( ref ); > >> > > + if ( !checkIfADSComponent( leavingFactory ) ) > >> > > + { > >> > > + return; > >> > > + } > >> > > + > >> > > + try > >> > > + { > >> > > + String componentType =3D parseComponentType( = leavingFactory ); > >> > > + > >> > > + List listenersByType =3D = listenersMap.get( componentType ); > >> > > + > >> > > + // Fire the 'factory leaving' event on listeners. > >> > > + if ( listenersByType !=3D null ) > >> > > + { > >> > > + for ( HubListener listener : listenersByType ) > >> > > + { > >> > > + listener.onFactoryDeparture( = leavingFactory ); > >> > > + } > >> > > + } > >> > > + > >> > > + ADSComponent associatedComp =3D null; > >> > > + for ( ADSComponent _comp : components ) > >> > > + { > >> > > + if ( _comp.getFactory().getName().equals( = leavingFactory.getName() ) ) > >> > > + { > >> > > + associatedComp =3D _comp; > >> > > + break; > >> > > + } > >> > > + } > >> > > + > >> > > + if ( associatedComp =3D=3D null ) > >> > > + { > >> > > + logger.log( LogService.LOG_INFO, "Couldn't = found an associated ADSComponent for factory:" > >> > > + + leavingFactory.getName() ); > >> > > + return; > >> > > + } > >> > > + > >> > > + // Iterate over listeners for 'component deleting' = event. > >> > > + if ( listenersByType !=3D null ) > >> > > + { > >> > > + for ( HubListener listener : listenersByType ) > >> > > + { > >> > > + listener.onComponentDeletion( = associatedComp ); > >> > > + } > >> > > + } > >> > > + > >> > > + // All clients are notified now cache and delete = the ADSComponent existence on ApacheDS > >> > > + cacheAndReleaseADSComponent( associatedComp ); > >> > > + > >> > > + } > >> > > + catch ( ParseException e ) > >> > > + { > >> > > + e.printStackTrace(); > >> > > + } > >> > > + } > >> > > + > >> > > + > >> > > + /** > >> > > + * IPojo instance arrival callback, registered by = whiteboard handler. > >> > > + * > >> > > + * @param ref Reference to IPojo instance > >> > > + */ > >> > > + public void onInstanceArrival( ServiceReference ref ) > >> > > + { > >> > > + > >> > > + } > >> > > + > >> > > + > >> > > + /** > >> > > + * IPojo instance departure callback, registered by = whiteboard handler. > >> > > + * > >> > > + * @param ref Reference to IPojo instance > >> > > + */ > >> > > + public void onInstanceDeparture( ServiceReference ref ) > >> > > + { > >> > > + > >> > > + } > >> > > + > >> > > + > >> > > + /** > >> > > + * Check whether the argument is ADSComponent annotated. > >> > > + * > >> > > + * @param factory > >> > > + * @return > >> > > + */ > >> > > + private boolean checkIfADSComponent( Factory factory ) > >> > > + { > >> > > + List handlers =3D = factory.getRequiredHandlers(); > >> > > + for ( String handlerName : handlers ) > >> > > + { > >> > > + if ( handlerName.equals( = ADSConstants.ADS_COMPONENT_HANDLER_FULLNAME ) ) > >> > > + { > >> > > + return true; > >> > > + } > >> > > + } > >> > > + > >> > > + return false; > >> > > + } > >> > > + > >> > > + > >> > > + private String parseComponentType( Factory factory ) = throws ParseException > >> > > + { > >> > > + Dictionary bundleHeaders =3D = factory.getBundleContext().getBundle().getHeaders(); > >> > > + String ipojoHeader =3D ( String ) bundleHeaders.get( = ADSConstants.IPOJO_HEADER ); > >> > > + > >> > > + if ( ipojoHeader =3D=3D null ) > >> > > + { > >> > > + throw new ParseException( "Null ipojo header = returned for factory: " + factory.getName() ); > >> > > + } > >> > > + > >> > > + ManifestMetadataParser parser =3D new = ManifestMetadataParser(); > >> > > + parser.parseHeader( ipojoHeader ); > >> > > + > >> > > + Element[] componentMetas =3D = parser.getComponentsMetadata(); > >> > > + > >> > > + for ( Element componentMeta : componentMetas ) > >> > > + { > >> > > + String compName =3D componentMeta.getAttribute( = "name" ); > >> > > + if ( compName.equals( factory.getName() ) ) > >> > > + { > >> > > + Element[] adsElements =3D = componentMeta.getElements( > >> > > + ADSConstants.ADS_COMPONENT_HANDLER_NAME, > >> > > + ADSConstants.ADS_COMPONENT_HANDLER_NS ); > >> > > + > >> > > + if ( adsElements =3D=3D null || = adsElements.length =3D=3D 0 ) > >> > > + { > >> > > + throw new ParseException( "ADSComponent = element couldn't be found for factory: " > >> > > + + factory.getName() ); > >> > > + } > >> > > + > >> > > + return adsElements[0].getAttribute( = "componentType" ); > >> > > + } > >> > > + } > >> > > + > >> > > + return null; > >> > > + } > >> > > + > >> > > + > >> > > + /** > >> > > + * Generates a new ADSComponent with its schema and cache = handle. > >> > > + * > >> > > + * @param componentType Type of a component being created > >> > > + * @param factory a factory reference to create a = ADSComponent for. > >> > > + * @return > >> > > + */ > >> > > + private ADSComponent generateADSComponent( String = componentType, Factory factory ) > >> > > + { > >> > > + return null; > >> > > + } > >> > > + > >> > > + > >> > > + /** > >> > > + * Cache the ADSComponent existence on ApacheDS with all = of its DIT entries. And then release it from hub. > >> > > + * > >> > > + * @param leavingComp ADSComponent reference to cache and = release. > >> > > + */ > >> > > + private void cacheAndReleaseADSComponent( ADSComponent = leavingComp ) > >> > > + { > >> > > + > >> > > + } > >> > > + > >> > > + > >> > > + /** > >> > > + * Registers a HubListener for specified component type. > >> > > + * > >> > > + * @param componentType component type to get = notifications for. > >> > > + * @param listener HubListener implementation > >> > > + */ > >> > > + public void registerListener( String componentType, = HubListener listener ) > >> > > + { > >> > > + List listenersForComp =3D = listenersMap.get( componentType ); > >> > > + if ( listenersForComp =3D=3D null ) > >> > > + { > >> > > + ArrayList list =3D new = ArrayList(); > >> > > + list.add( listener ); > >> > > + listenersMap.put( componentType, list ); > >> > > + } > >> > > + else > >> > > + { > >> > > + if ( !listenersForComp.contains( listener ) ) > >> > > + { > >> > > + listenersForComp.add( listener ); > >> > > + } > >> > > + } > >> > > + } > >> > > + > >> > > + > >> > > + /** > >> > > + * Removes the specified listener from the notification = chain. > >> > > + * > >> > > + * @param listener HubListener implementation > >> > > + */ > >> > > + public void removeListener( HubListener listener ) > >> > > + { > >> > > + Enumeration> it =3D = listenersMap.elements(); > >> > > + while ( it.hasMoreElements() ) > >> > > + { > >> > > + List list =3D it.nextElement(); > >> > > + if ( list.contains( listener ) ) > >> > > + { > >> > > + list.remove( listener ); > >> > > + } > >> > > + } > >> > > + } > >> > > +} > >> > > > >> > > Added: = directory/apacheds/trunk/component-hub/src/main/java/org/apache/directory/= server/component/hub/listener/AbstractHubListener.java > >> > > URL: = http://svn.apache.org/viewvc/directory/apacheds/trunk/component-hub/src/ma= in/java/org/apache/directory/server/component/hub/listener/AbstractHubList= ener.java?rev=3D1203217&view=3Dauto > >> > > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > >> > > --- = directory/apacheds/trunk/component-hub/src/main/java/org/apache/directory/= server/component/hub/listener/AbstractHubListener.java (added) > >> > > +++ = directory/apacheds/trunk/component-hub/src/main/java/org/apache/directory/= server/component/hub/listener/AbstractHubListener.java Thu Nov 17 = 15:21:39 2011 > >> > > @@ -0,0 +1,76 @@ > >> > > +/* > >> > > + * Licensed to the Apache Software Foundation (ASF) under one > >> > > + * or more contributor license agreements. See the NOTICE = file > >> > > + * distributed with this work for additional information > >> > > + * regarding copyright ownership. The ASF licenses this file > >> > > + * to you under the Apache License, Version 2.0 (the > >> > > + * "License"); you may not use this file except in compliance > >> > > + * with the License. You may obtain a copy of the License at > >> > > + * > >> > > + * http://www.apache.org/licenses/LICENSE-2.0 > >> > > + * > >> > > + * Unless required by applicable law or agreed to in writing, > >> > > + * software distributed under the License is distributed on = an > >> > > + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY > >> > > + * KIND, either express or implied. See the License for the > >> > > + * specific language governing permissions and limitations > >> > > + * under the License. > >> > > + * > >> > > + */ > >> > > +package org.apache.directory.server.component.hub.listener; > >> > > + > >> > > + > >> > > +import org.apache.directory.server.component.ADSComponent; > >> > > +import org.apache.felix.ipojo.Factory; > >> > > + > >> > > + > >> > > +/** > >> > > + * Abstract HubListener implementation. Override the intended = methods to receive notifications. > >> > > + * > >> > > + * @author Apache = Directory Project > >> > > + */ > >> > > +public abstract class AbstractHubListener implements = HubListener > >> > > +{ > >> > > + > >> > > + /* > >> > > + * (non-Javadoc) > >> > > + * @see = org.apache.directory.server.component.hub.listener.HubListener#onFactoryAr= rival(org.apache.felix.ipojo.Factory) > >> > > + */ > >> > > + @Override > >> > > + public void onFactoryArrival( Factory factory ) > >> > > + { > >> > > + } > >> > > + > >> > > + > >> > > + /* > >> > > + * (non-Javadoc) > >> > > + * @see = org.apache.directory.server.component.hub.listener.HubListener#onFactoryDe= parture(org.apache.felix.ipojo.Factory) > >> > > + */ > >> > > + @Override > >> > > + public void onFactoryDeparture( Factory factory ) > >> > > + { > >> > > + > >> > > + } > >> > > + > >> > > + > >> > > + /* > >> > > + * (non-Javadoc) > >> > > + * @see = org.apache.directory.server.component.hub.listener.HubListener#onComponent= Creation(org.apache.directory.server.component.ADSComponent) > >> > > + */ > >> > > + @Override > >> > > + public ADSComponent onComponentCreation( ADSComponent = component ) > >> > > + { > >> > > + return null; > >> > > + } > >> > > + > >> > > + > >> > > + /* > >> > > + * (non-Javadoc) > >> > > + * @see = org.apache.directory.server.component.hub.listener.HubListener#onComponent= Deletion(org.apache.directory.server.component.ADSComponent) > >> > > + */ > >> > > + @Override > >> > > + public void onComponentDeletion( ADSComponent component ) > >> > > + { > >> > > + } > >> > > + > >> > > +} > >> > > > >> > > Added: = directory/apacheds/trunk/component-hub/src/main/java/org/apache/directory/= server/component/hub/listener/HubListener.java > >> > > URL: = http://svn.apache.org/viewvc/directory/apacheds/trunk/component-hub/src/ma= in/java/org/apache/directory/server/component/hub/listener/HubListener.jav= a?rev=3D1203217&view=3Dauto > >> > > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > >> > > --- = directory/apacheds/trunk/component-hub/src/main/java/org/apache/directory/= server/component/hub/listener/HubListener.java (added) > >> > > +++ = directory/apacheds/trunk/component-hub/src/main/java/org/apache/directory/= server/component/hub/listener/HubListener.java Thu Nov 17 15:21:39 2011 > >> > > @@ -0,0 +1,73 @@ > >> > > +/* > >> > > + * Licensed to the Apache Software Foundation (ASF) under one > >> > > + * or more contributor license agreements. See the NOTICE = file > >> > > + * distributed with this work for additional information > >> > > + * regarding copyright ownership. The ASF licenses this file > >> > > + * to you under the Apache License, Version 2.0 (the > >> > > + * "License"); you may not use this file except in compliance > >> > > + * with the License. You may obtain a copy of the License at > >> > > + * > >> > > + * http://www.apache.org/licenses/LICENSE-2.0 > >> > > + * > >> > > + * Unless required by applicable law or agreed to in writing, > >> > > + * software distributed under the License is distributed on = an > >> > > + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY > >> > > + * KIND, either express or implied. See the License for the > >> > > + * specific language governing permissions and limitations > >> > > + * under the License. > >> > > + * > >> > > + */ > >> > > +package org.apache.directory.server.component.hub.listener; > >> > > + > >> > > + > >> > > +import org.apache.directory.server.component.ADSComponent; > >> > > +import org.apache.felix.ipojo.Factory; > >> > > +import org.apache.felix.ipojo.architecture.Architecture; > >> > > + > >> > > + > >> > > +/** > >> > > + * Interface for the classes those want to be notified of = ComponentHub. > >> > > + * Listeners can bind themselves using = ComponentHub.registerListener() method, > >> > > + * and can remove themselves using = ComponentHub.removeListener() method. > >> > > + * TODO HubListener. > >> > > + * > >> > > + * @author Apache = Directory Project > >> > > + */ > >> > > +public interface HubListener > >> > > +{ > >> > > + /** > >> > > + * Notified when a new factory is sniffed by Hub. > >> > > + * > >> > > + * @param factory arriving factory > >> > > + */ > >> > > + public void onFactoryArrival( Factory factory ); > >> > > + > >> > > + > >> > > + /** > >> > > + * Notified when a factory leaving the container. > >> > > + * > >> > > + * @param factory departuring factory > >> > > + */ > >> > > + public void onFactoryDeparture( Factory factory ); > >> > > + > >> > > + > >> > > + /** > >> > > + * Notified when a new ADSComponent is created. > >> > > + * Listener can change the newly created ADSComponent by = returning changed ADSComponent.(Be cautious) > >> > > + * > >> > > + * @param component newly created ADSComponent > >> > > + * @return the overrided version of the ADSComponent or = null if no change is intended. > >> > > + */ > >> > > + public ADSComponent onComponentCreation( ADSComponent = component ); > >> > > + > >> > > + > >> > > + /** > >> > > + * Notified when a new ADSComponent is about to be = disposed. > >> > > + * Called before component disposal begins. > >> > > + * > >> > > + * @param component disposing created ADSComponent > >> > > + * @return the overrided version of the ADSComponent or = null if no change is intended. > >> > > + */ > >> > > + public void onComponentDeletion( ADSComponent component ); > >> > > + > >> > > +} > >> > > > >> > > Added: = directory/apacheds/trunk/component-hub/src/main/java/org/apache/directory/= server/component/schema/ADSComponentSchema.java > >> > > URL: = http://svn.apache.org/viewvc/directory/apacheds/trunk/component-hub/src/ma= in/java/org/apache/directory/server/component/schema/ADSComponentSchema.ja= va?rev=3D1203217&view=3Dauto > >> > > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > >> > > --- = directory/apacheds/trunk/component-hub/src/main/java/org/apache/directory/= server/component/schema/ADSComponentSchema.java (added) > >> > > +++ = directory/apacheds/trunk/component-hub/src/main/java/org/apache/directory/= server/component/schema/ADSComponentSchema.java Thu Nov 17 15:21:39 2011 > >> > > @@ -0,0 +1,103 @@ > >> > > +/* > >> > > + * Licensed to the Apache Software Foundation (ASF) under one > >> > > + * or more contributor license agreements. See the NOTICE = file > >> > > + * distributed with this work for additional information > >> > > + * regarding copyright ownership. The ASF licenses this file > >> > > + * to you under the Apache License, Version 2.0 (the > >> > > + * "License"); you may not use this file except in compliance > >> > > + * with the License. You may obtain a copy of the License at > >> > > + * > >> > > + * http://www.apache.org/licenses/LICENSE-2.0 > >> > > + * > >> > > + * Unless required by applicable law or agreed to in writing, > >> > > + * software distributed under the License is distributed on = an > >> > > + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY > >> > > + * KIND, either express or implied. See the License for the > >> > > + * specific language governing permissions and limitations > >> > > + * under the License. > >> > > + * > >> > > + */ > >> > > +package org.apache.directory.server.component.schema; > >> > > + > >> > > + > >> > > +import java.util.ArrayList; > >> > > +import java.util.List; > >> > > + > >> > > +import org.apache.directory.shared.ldap.model.ldif.LdifEntry; > >> > > + > >> > > + > >> > > +/** > >> > > + * Class that represents an ADSComponent's schema definition. > >> > > + * > >> > > + * @author Apache = Directory Project > >> > > + */ > >> > > +public class ADSComponentSchema > >> > > +{ > >> > > + /* > >> > > + * Schema elements (attribs,ocs) for component. > >> > > + */ > >> > > + private List schemaElements =3D null; > >> > > + > >> > > + /* > >> > > + * True if the @schemaElements contains complete schema = definition with schema entry. > >> > > + */ > >> > > + private boolean completeSchema =3D false; > >> > > + > >> > > + /* > >> > > + * Schema name which @schemaElements will go under. > >> > > + */ > >> > > + private String parentSchemaDn =3D null; > >> > > + > >> > > + > >> > > + public ADSComponentSchema( String name, List = elements ) > >> > > + { > >> > > + this( name, elements, false ); > >> > > + } > >> > > + > >> > > + > >> > > + public ADSComponentSchema( String parentSchema, = List elements, boolean complete ) > >> > > + { > >> > > + parentSchemaDn =3D parentSchema; > >> > > + schemaElements =3D elements; > >> > > + completeSchema =3D complete; > >> > > + } > >> > > + > >> > > + > >> > > + /** > >> > > + * Getter for completeSchema > >> > > + * > >> > > + * @return true if schema is complete with schema entry. > >> > > + */ > >> > > + public boolean ifCompleteSchema() > >> > > + { > >> > > + return completeSchema; > >> > > + } > >> > > + > >> > > + > >> > > + /** > >> > > + * Returns name of the schema > >> > > + * > >> > > + * @return name of the schema > >> > > + */ > >> > > + public String getParentSchemaName() > >> > > + { > >> > > + return parentSchemaDn; > >> > > + } > >> > > + > >> > > + > >> > > + /** > >> > > + * Gets the clone of the schema elements. > >> > > + * > >> > > + * @return clone of the schema elements. > >> > > + */ > >> > > + public List getSchemaElements() > >> > > + { > >> > > + if ( schemaElements =3D=3D null ) > >> > > + { > >> > > + return null; > >> > > + } > >> > > + > >> > > + return new ArrayList( schemaElements ); > >> > > + } > >> > > + > >> > > +} > >> > > > >> > > Added: = directory/apacheds/trunk/component-hub/src/main/java/org/apache/directory/= server/component/schema/ComponentOIDGenerator.java > >> > > URL: = http://svn.apache.org/viewvc/directory/apacheds/trunk/component-hub/src/ma= in/java/org/apache/directory/server/component/schema/ComponentOIDGenerator= .java?rev=3D1203217&view=3Dauto > >> > > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > >> > > --- = directory/apacheds/trunk/component-hub/src/main/java/org/apache/directory/= server/component/schema/ComponentOIDGenerator.java (added) > >> > > +++ = directory/apacheds/trunk/component-hub/src/main/java/org/apache/directory/= server/component/schema/ComponentOIDGenerator.java Thu Nov 17 15:21:39 = 2011 > >> > > @@ -0,0 +1,88 @@ > >> > > +/* > >> > > + * Licensed to the Apache Software Foundation (ASF) under one > >> > > + * or more contributor license agreements. See the NOTICE = file > >> > > + * distributed with this work for additional information > >> > > + * regarding copyright ownership. The ASF licenses this file > >> > > + * to you under the Apache License, Version 2.0 (the > >> > > + * "License"); you may not use this file except in compliance > >> > > + * with the License. You may obtain a copy of the License at > >> > > + * > >> > > + * http://www.apache.org/licenses/LICENSE-2.0 > >> > > + * > >> > > + * Unless required by applicable law or agreed to in writing, > >> > > + * software distributed under the License is distributed on = an > >> > > + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY > >> > > + * KIND, either express or implied. See the License for the > >> > > + * specific language governing permissions and limitations > >> > > + * under the License. > >> > > + * > >> > > + */ > >> > > +package org.apache.directory.server.component.schema; > >> > > + > >> > > + > >> > > +import org.apache.directory.server.component.ADSConstants; > >> > > + > >> > > + > >> > > +/** > >> > > + * This is a simple incremental generator for OID assignments = of custom generated schemas. > >> > > + * Ensuring consistency among different servers on the cluster = will be replication layer's duty. > >> > > + * TODO ADSComponentOIDGenerator. > >> > > + * > >> > > + * @author Apache = Directory Project > >> > > + */ > >> > > +public class ComponentOIDGenerator > >> > > +{ > >> > > + /* > >> > > + * Base OID to generate sequential OIDs against. > >> > > + */ > >> > > + private static String baseOID =3D null; > >> > > + > >> > > + /* > >> > > + * Counters to keep track. > >> > > + */ > >> > > + private static int componentCounter; > >> > > + private static int ocCounter; > >> > > + private static int attribCounter; > >> > > + > >> > > + static > >> > > + { > >> > > + baseOID =3D ADSConstants.ADS_COMPONENT_BASE_OID; > >> > > + > >> > > + componentCounter =3D 0; > >> > > + ocCounter =3D 0; > >> > > + attribCounter =3D 0; > >> > > + } > >> > > + > >> > > + > >> > > + /** > >> > > + * Returns OID for component > >> > > + * > >> > > + * @return oid for component > >> > > + */ > >> > > + public static synchronized String generateComponentOID() > >> > > + { > >> > > + return baseOID + "." + ( ++componentCounter ); > >> > > + } > >> > > + > >> > > + > >> > > + /** > >> > > + * Returns OID for object class under specified component = base OID. > >> > > + * > >> > > + * @return oid for object class > >> > > + */ > >> > > + public static synchronized String generateOCOID( String = componentBase ) > >> > > + { > >> > > + return componentBase + ".1." + ( ++ocCounter ); > >> > > + } > >> > > + > >> > > + > >> > > + /** > >> > > + * Returns OID for attribute under specified component = base OID. > >> > > + * > >> > > + * @return oid for attribute > >> > > + */ > >> > > + public static synchronized String generateAttribOID( = String componentBase ) > >> > > + { > >> > > + return componentBase + ".2." + ( ++attribCounter ); > >> > > + } > >> > > +} > >> > > > >> > > Added: = directory/apacheds/trunk/component-hub/src/main/java/org/apache/directory/= server/component/schema/ComponentSchemaGenerator.java > >> > > URL: = http://svn.apache.org/viewvc/directory/apacheds/trunk/component-hub/src/ma= in/java/org/apache/directory/server/component/schema/ComponentSchemaGenera= tor.java?rev=3D1203217&view=3Dauto > >> > > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > >> > > --- = directory/apacheds/trunk/component-hub/src/main/java/org/apache/directory/= server/component/schema/ComponentSchemaGenerator.java (added) > >> > > +++ = directory/apacheds/trunk/component-hub/src/main/java/org/apache/directory/= server/component/schema/ComponentSchemaGenerator.java Thu Nov 17 = 15:21:39 2011 > >> > > @@ -0,0 +1,44 @@ > >> > > +/* > >> > > + * Licensed to the Apache Software Foundation (ASF) under one > >> > > + * or more contributor license agreements. See the NOTICE = file > >> > > + * distributed with this work for additional information > >> > > + * regarding copyright ownership. The ASF licenses this file > >> > > + * to you under the Apache License, Version 2.0 (the > >> > > + * "License"); you may not use this file except in compliance > >> > > + * with the License. You may obtain a copy of the License at > >> > > + * > >> > > + * http://www.apache.org/licenses/LICENSE-2.0 > >> > > + * > >> > > + * Unless required by applicable law or agreed to in writing, > >> > > + * software distributed under the License is distributed on = an > >> > > + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY > >> > > + * KIND, either express or implied. See the License for the > >> > > + * specific language governing permissions and limitations > >> > > + * under the License. > >> > > + * > >> > > + */ > >> > > +package org.apache.directory.server.component.schema; > >> > > + > >> > > + > >> > > +import org.apache.felix.ipojo.Factory; > >> > > + > >> > > + > >> > > +/** > >> > > + * Interface for classes generating schemas for component = types. > >> > > + * > >> > > + * @author Apache = Directory Project > >> > > + */ > >> > > +public interface ComponentSchemaGenerator > >> > > +{ > >> > > + /** > >> > > + * Generates a schema for representing all of factory's = configurables. > >> > > + * Returned schema is in right order to add it to LDAP = without any sorting. > >> > > + * > >> > > + * If factory does not need a custom schema, it does not = generate a schema for > >> > > + * it, just returns the name of stock schema instead. > >> > > + * > >> > > + * @param factory Factory reference to generate schema = for. > >> > > + * @return Schema in the form of LdifEntry list. > >> > > + */ > >> > > + public ADSComponentSchema generateOrGetSchemaElements( = Factory factory ); > >> > > +} > >> > > > >> > > Added: = directory/apacheds/trunk/component-hub/src/main/java/org/apache/directory/= server/component/schema/UserComponentSchemaGenerator.java > >> > > URL: = http://svn.apache.org/viewvc/directory/apacheds/trunk/component-hub/src/ma= in/java/org/apache/directory/server/component/schema/UserComponentSchemaGe= nerator.java?rev=3D1203217&view=3Dauto > >> > > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > >> > > --- = directory/apacheds/trunk/component-hub/src/main/java/org/apache/directory/= server/component/schema/UserComponentSchemaGenerator.java (added) > >> > > +++ = directory/apacheds/trunk/component-hub/src/main/java/org/apache/directory/= server/component/schema/UserComponentSchemaGenerator.java Thu Nov 17 = 15:21:39 2011 > >> > > @@ -0,0 +1,157 @@ > >> > > +/* > >> > > + * Licensed to the Apache Software Foundation (ASF) under one > >> > > + * or more contributor license agreements. See the NOTICE = file > >> > > + * distributed with this work for additional information > >> > > + * regarding copyright ownership. The ASF licenses this file > >> > > + * to you under the Apache License, Version 2.0 (the > >> > > + * "License"); you may not use this file except in compliance > >> > > + * with the License. You may obtain a copy of the License at > >> > > + * > >> > > + * http://www.apache.org/licenses/LICENSE-2.0 > >> > > + * > >> > > + * Unless required by applicable law or agreed to in writing, > >> > > + * software distributed under the License is distributed on = an > >> > > + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY > >> > > + * KIND, either express or implied. See the License for the > >> > > + * specific language governing permissions and limitations > >> > > + * under the License. > >> > > + * > >> > > + */ > >> > > +package org.apache.directory.server.component.schema; > >> > > + > >> > > + > >> > > +import java.util.ArrayList; > >> > > +import java.util.List; > >> > > + > >> > > +import org.apache.directory.server.component.ADSConstants; > >> > > +import = org.apache.directory.shared.ldap.model.exception.LdapInvalidAttributeValue= Exception; > >> > > +import = org.apache.directory.shared.ldap.model.exception.LdapInvalidDnException; > >> > > +import = org.apache.directory.shared.ldap.model.ldif.LdapLdifException; > >> > > +import org.apache.directory.shared.ldap.model.ldif.LdifEntry; > >> > > +import org.apache.felix.ipojo.Factory; > >> > > +import = org.apache.felix.ipojo.architecture.PropertyDescription; > >> > > +import org.slf4j.Logger; > >> > > +import org.slf4j.LoggerFactory; > >> > > + > >> > > + > >> > > +public class UserComponentSchemaGenerator implements = ComponentSchemaGenerator > >> > > +{ > >> > > + > >> > > + private static final Logger LOG =3D = LoggerFactory.getLogger( UserComponentSchemaGenerator.class ); > >> > > + > >> > > + > >> > > + @Override > >> > > + public ADSComponentSchema generateOrGetSchemaElements( = Factory componentFactory ) > >> > > + { > >> > > + List schemaElements =3D new = ArrayList(); > >> > > + > >> > > + String componentName =3D componentFactory.getName(); > >> > > + if ( componentName.contains( "." ) ) > >> > > + { > >> > > + componentName =3D componentName.substring( = componentName.lastIndexOf( '.' ) + 1 ); > >> > > + } > >> > > + > >> > > + String schemaDn =3D = ADSConstants.ADS_USER_COMPONENTS_SCHEMA_DN; > >> > > + > >> > > + String attribsDn =3D "ou=3DattributeTypes," + = schemaDn; > >> > > + String ocsDn =3D "ou=3DobjectClasses," + schemaDn; > >> > > + > >> > > + //Will hold the m-must attributes while iterating over = properties of the component > >> > > + List ocAttribs =3D new ArrayList(); > >> > > + > >> > > + // Creating schema elements with proper order and = pushing them into the list > >> > > + try > >> > > + { > >> > > + > >> > > + String componentBaseOID =3D = ComponentOIDGenerator.generateComponentOID(); > >> > > + > >> > > + for ( PropertyDescription prop : = componentFactory.getComponentDescription().getProperties() ) > >> > > + { > >> > > + > >> > > + //Must be lower case, alphanumeric only > >> > > + String propname =3D prop.getName(); > >> > > + > >> > > + String proptype =3D prop.getType(); > >> > > + String propoid =3D = ComponentOIDGenerator.generateAttribOID( componentBaseOID ); > >> > > + String propdn =3D "m-oid=3D" + propoid + "," + = attribsDn; > >> > > + > >> > > + if ( !( proptype.equals( "int" ) || = proptype.equals( "java.lang.String" ) || proptype > >> > > + .equals( "boolean" ) ) ) > >> > > + { > >> > > + LOG.info( "Property found with an = incompatible type: " > >> > > + + propname + ":" + proptype ); > >> > > + continue; > >> > > + } > >> > > + > >> > > + String syntax =3D = ADSConstants.syntaxMappings.get( proptype ); > >> > > + String equality =3D = ADSConstants.equalityMappings.get( proptype ); > >> > > + String ordering =3D = ADSConstants.orderingMappings.get( proptype ); > >> > > + String substr =3D = ADSConstants.substringMappings.get( proptype ); > >> > > + > >> > > + schemaElements.add( new LdifEntry( propdn, > >> > > + "objectclass:metaAttributeType", > >> > > + "objectclass:metaTop", > >> > > + "objectclass:top", > >> > > + "m-oid:" + propoid, > >> > > + "m-name:" + propname, > >> > > + "m-description:Property of component type = " + componentName, > >> > > + "m-equality:" + equality, > >> > > + "m-ordering:" + ordering, > >> > > + "m-substr:" + substr, > >> > > + "m-syntax:" + syntax, > >> > > + "m-length:0", > >> > > + "m-singleValue:TRUE" ) ); > >> > > + > >> > > + if ( prop.isMandatory() ) > >> > > + { > >> > > + ocAttribs.add( "m-must:" + propname ); > >> > > + } > >> > > + else > >> > > + { > >> > > + ocAttribs.add( "m-may:" + propname ); > >> > > + } > >> > > + > >> > > + } > >> > > + > >> > > + schemaElements.add( new LdifEntry( ocsDn, > >> > > + "objectclass:organizationalUnit", > >> > > + "objectClass:top", > >> > > + "ou:objectClasses" ) ); > >> > > + > >> > > + String ocoid =3D = ComponentOIDGenerator.generateOCOID( componentBaseOID ); > >> > > + String ocDn =3D "m-oid=3D" + ocoid + "," + ocsDn; > >> > > + > >> > > + ocAttribs.add( 0, "m-may:cached" ); > >> > > + ocAttribs.add( 0, "m-must:ins" ); > >> > > + ocAttribs.add( 0, "m-must:active" ); > >> > > + ocAttribs.add( 0, "m-supObjectClass: top" ); > >> > > + ocAttribs.add( 0, "m-description:Object Class for = generating instances of:" + componentName ); > >> > > + ocAttribs.add( 0, "m-name:" + componentName ); > >> > > + ocAttribs.add( 0, "m-oid:" + ocoid ); > >> > > + ocAttribs.add( 0, "objectclass: top" ); > >> > > + ocAttribs.add( 0, "objectclass: metaTop" ); > >> > > + ocAttribs.add( 0, "objectclass: metaObjectClass" = ); > >> > > + > >> > > + schemaElements.add( new LdifEntry( ocDn, = ocAttribs.toArray() ) ); > >> > > + > >> > > + } > >> > > + catch ( LdapInvalidAttributeValueException e ) > >> > > + { > >> > > + LOG.info( "ADSSchemaManager#generateSchema: = Error(LdapInvalidAttributeValueException) while creating LdifEntry for: = " > >> > > + + componentFactory ); > >> > > + } > >> > > + catch ( LdapInvalidDnException e ) > >> > > + { > >> > > + LOG.info( "ADSSchemaManager#generateSchema: = Error(LdapInvalidDnException) while creating LdifEntry for: " > >> > > + + componentFactory ); > >> > > + } > >> > > + catch ( LdapLdifException e ) > >> > > + { > >> > > + LOG.info( "ADSSchemaManager#generateSchema: = Error(LdapLdifException) while creating LdifEntry for: " > >> > > + + componentFactory ); > >> > > + } > >> > > + > >> > > + return new ADSComponentSchema( = ADSConstants.ADS_USER_COMPONENTS_SCHEMA_DN, schemaElements ); > >> > > + } > >> > > + > >> > > +} > >> > > > >> > > Modified: directory/apacheds/trunk/pom.xml > >> > > URL: = http://svn.apache.org/viewvc/directory/apacheds/trunk/pom.xml?rev=3D120321= 7&r1=3D1203216&r2=3D1203217&view=3Ddiff > >> > > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > >> > > --- directory/apacheds/trunk/pom.xml (original) > >> > > +++ directory/apacheds/trunk/pom.xml Thu Nov 17 15:21:39 2011 > >> > > @@ -151,6 +151,7 @@ > >> > > apache-felix > >> > > dependencies > >> > > service-osgi > >> > > + component-hub > >> > > > >> > > > >> > > > >> > > > >> > > > >> > > > > > --Apple-Mail=_C65DD922-A737-44EF-A602-6825C462238C Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=windows-1252


On Nov 18, 2011 12:03 PM, "Pierre-Arnaud Marcelot" <pa@marcelot.net> wrote:
>
> On 18 nov. 2011, at 10:54, G=F6kt=FCrk Gezer wrote:
>>
>> Hi Pierre,
>>
>> On Nov 18, 2011 11:50 AM, "Pierre-Arnaud Marcelot" <pa@marcelot.net> wrote:
>> >
>> > Hi G=F6kt=FCrk,
>> >
>> > As I was merging modifications from trunk to the OSGI = branch, I noticed this commit was done on trunk instead of the OSGI = branch.
>> > Was this on purpose?
>> This is what Emmanuel wanted. He did not want to deal with = merging. Actually my things are all seperated from the main code for = now. It can be merged back easily.
>
> Hum=85 I see.
> But it has a lot to do with the OSGI branch, right?

Not until = componenthub is finished. I mean it uses osgi but does not effect the = code.
>
> Are we dropping the OSGI branch?
>
I don't think so. We need that branch 2-3 days later.
> Am I missing something?
>
I feel like that sometimes :) Letme finish hub and then we replicate the = apacheds-trunk as apacheds-osgi-brunch. So nobody deals with merging for = 2 days :)

My merge is almost done (2 very small = conflicts resolved) and the tests are running at the moment to verify = nothing is broken.

I will focus back on OSGI = with Studio and try to find a fix for the Equinox issue, so I need an = up-to-date ApacheDS code.

> Regards,
> Pierre-Arnaud
>>
>> >
>> > Regards,
>> > Pierre-Arnaud
>> >
>> > On 17 nov. 2011, at 16:21, gokturk@apache.org wrote:
>> >
>> > > Author: gokturk
>> > > Date: Thu Nov 17 15:21:39 2011
>> > > New Revision: 1203217
>> > >
>> > > URL: http://= svn.apache.org/viewvc?rev=3D1203217&view=3Drev
>> > > Log:
>> > > First work on ApacheDS ComponentHub ( the IPojo based = main plug-in layer).
>> > >
>> > > TODO:
>> > > * Implement ComponentManager for ComponentHub's = clients to manage component instances,schema and configuration
>> > > * Implement entry cache to preserve component = instance configuration across server sessions.
>> > > * Add test cases for "customuser" typed = components.
>> > > ......
>> > > * Create InterceptorHubClient to manage interceptors = using plug-in layer.
>> > >
>> > >
>> > > Added:
>> > >   =  directory/apacheds/trunk/component-hub/
>> > >   =  directory/apacheds/trunk/component-hub/pom.xml
>> > >   =  directory/apacheds/trunk/component-hub/src/
>> > >   =  directory/apacheds/trunk/component-hub/src/main/
>> > >   =  directory/apacheds/trunk/component-hub/src/main/java/
>> > >   =  directory/apacheds/trunk/component-hub/src/main/java/org/
>> > >   =  directory/apacheds/trunk/component-hub/src/main/java/org/apache/
= >> > >   =  directory/apacheds/trunk/component-hub/src/main/java/org/apache/dire= ctory/
>> > >   =  directory/apacheds/trunk/component-hub/src/main/java/org/apache/dire= ctory/server/
>> > >   =  directory/apacheds/trunk/component-hub/src/main/java/org/apache/dire= ctory/server/component/
>> > >   =  directory/apacheds/trunk/component-hub/src/main/java/org/apache/dire= ctory/server/component/ADSComponent.java
>> > >   =  directory/apacheds/trunk/component-hub/src/main/java/org/apache/dire= ctory/server/component/ADSComponentInstance.java
>> > >   =  directory/apacheds/trunk/component-hub/src/main/java/org/apache/dire= ctory/server/component/ADSConstants.java
>> > >   =  directory/apacheds/trunk/component-hub/src/main/java/org/apache/dire= ctory/server/component/handler/
>> > >   =  directory/apacheds/trunk/component-hub/src/main/java/org/apache/dire= ctory/server/component/handler/ADSComponent.java
>> > >   =  directory/apacheds/trunk/component-hub/src/main/java/org/apache/dire= ctory/server/component/handler/ADSComponentHandler.java
>> > >   =  directory/apacheds/trunk/component-hub/src/main/java/org/apache/dire= ctory/server/component/hub/
>> > >   =  directory/apacheds/trunk/component-hub/src/main/java/org/apache/dire= ctory/server/component/hub/ComponentHub.java
>> > >   =  directory/apacheds/trunk/component-hub/src/main/java/org/apache/dire= ctory/server/component/hub/listener/
>> > >   =  directory/apacheds/trunk/component-hub/src/main/java/org/apache/dire= ctory/server/component/hub/listener/AbstractHubListener.java
>> > >   =  directory/apacheds/trunk/component-hub/src/main/java/org/apache/dire= ctory/server/component/hub/listener/HubListener.java
>> > >   =  directory/apacheds/trunk/component-hub/src/main/java/org/apache/dire= ctory/server/component/schema/
>> > >   =  directory/apacheds/trunk/component-hub/src/main/java/org/apache/dire= ctory/server/component/schema/ADSComponentSchema.java
>> > >   =  directory/apacheds/trunk/component-hub/src/main/java/org/apache/dire= ctory/server/component/schema/ComponentOIDGenerator.java
>> > >   =  directory/apacheds/trunk/component-hub/src/main/java/org/apache/dire= ctory/server/component/schema/ComponentSchemaGenerator.java
>> > >   =  directory/apacheds/trunk/component-hub/src/main/java/org/apache/dire= ctory/server/component/schema/UserComponentSchemaGenerator.java
>> > > Modified:
>> > >    directory/apacheds/trunk/pom.xml
>> > >
>> > > Added: = directory/apacheds/trunk/component-hub/pom.xml
>> > > URL: http://svn.apache.org/viewvc/dire= ctory/apacheds/trunk/component-hub/pom.xml?rev=3D1203217&view=3Dauto
>> > > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D
>> > > --- directory/apacheds/trunk/component-hub/pom.xml = (added)
>> > > +++ directory/apacheds/trunk/component-hub/pom.xml = Thu Nov 17 15:21:39 2011
>> > > @@ -0,0 +1,97 @@
>> > > +<?xml version=3D"1.0" encoding=3D"UTF-8"?>
>> > > +
>> > > +<!--
>> > > +  Licensed to the Apache Software Foundation = (ASF) under one
>> > > +  or more contributor license agreements. =  See the NOTICE file
>> > > +  distributed with this work for additional = information
>> > > +  regarding copyright ownership.  The ASF = licenses this file
>> > > +  to you under the Apache License, Version 2.0 = (the
>> > > +  "License"); you may not use this file except = in compliance
>> > > +  with the License.  You may obtain a copy = of the License at
>> > > +
>> > > +  
http://www.apache.org/= licenses/LICENSE-2.0
>> > > +
>> > > +  Unless required by applicable law or agreed = to in writing,
>> > > +  software distributed under the License is = distributed on an
>> > > +  "AS IS" BASIS, WITHOUT WARRANTIES OR = CONDITIONS OF ANY
>> > > +  KIND, either express or implied.  See = the License for the
>> > > +  specific language governing permissions and = limitations
>> > > +  under the License.
>> > > +-->
>> > > +
>> > > +<project xmlns=3D"http://maven.apache.org/POM/4.0= .0" xmlns:xsi=3D"http://www.w3.org/2001/= XMLSchema-instance" xsi:schemaLocation=3D"http://maven.apache.org/POM/4.0= .0 http://maven.apache.org/= maven-v4_0_0.xsd">
>> > > + =  <modelVersion>4.0.0</modelVersion>
>> > > +  <parent>
>> > > +   =  <groupId>org.apache.directory.server</groupId>
>> > > +   =  <artifactId>apacheds-parent</artifactId>
>> > > +   =  <version>2.0.0-M4-SNAPSHOT</version>
>> > > +  </parent>
>> > > +
>> > > + =  <artifactId>apacheds-component-hub</artifactId>
>> > > +  <name>ApacheDS Component = Hub</name>
>> > > +  <packaging>bundle</packaging>
>> > > +  <description>Provides main plugin-layer = for ApacheDS</description>
>> > > +
>> > > +  <dependencies>
>> > > +
>> > > +    <dependency>
>> > > +     =  <groupId>org.apache.directory.server</groupId>
>> > > +     =  <artifactId>apacheds-core-api</artifactId>
>> > > +    </dependency>
>> > > +
>> > > +    <dependency>
>> > > +     =  <groupId>org.apache.directory.shared</groupId>
>> > > +     =  <artifactId>shared-ldap-model</artifactId>
>> > > +    </dependency>
>> > > +
>> > > +    <dependency>
>> > > +     =  <groupId>org.apache.felix</groupId>
>> > > +     =  <artifactId>org.apache.felix.ipojo.annotations</artifactId&= gt;
>> > > +     =  <version>1.8.0</version>
>> > > +    </dependency>
>> > > +
>> > > +    <dependency>
>> > > +     =  <groupId>org.apache.felix</groupId>
>> > > +     =  <artifactId>org.apache.felix.ipojo.handler.whiteboard</arti= factId>
>> > > +     =  <version>1.6.0</version>
>> > > +    </dependency>
>> > > +
>> > > +    <dependency>
>> > > +     =  <groupId>org.osgi</groupId>
>> > > +     =  <artifactId>org.osgi.core</artifactId>
>> > > +     =  <version>4.3.0</version>
>> > > +    </dependency>
>> > > +
>> > > +  </dependencies>
>> > > +
>> > > +  <build>
>> > > +    <plugins>
>> > > +      <plugin>
>> > > +       =  <groupId>org.apache.felix</groupId>
>> > > +       =  <artifactId>maven-bundle-plugin</artifactId>
>> > > +       =  <inherited>true</inherited>
>> > > +       =  <extensions>true</extensions>
>> > > +       =  <configuration>
>> > > +         =  <manifestLocation>META-INF</manifestLocation>
>> > > +         =  <instructions>
>> > > +           =  <Bundle-SymbolicName>${project.groupId}.component.hub</Bund= le-SymbolicName>
>> > > +         =  </instructions>
>> > > +       =  </configuration>
>> > > +      </plugin>
>> > > +
>> > > +      <plugin>
>> > > +       =  <groupId>org.apache.felix</groupId>
>> > > +       =  <artifactId>maven-ipojo-plugin</artifactId>
>> > > +       =  <version>1.8.0</version>
>> > > +        <executions>
>> > > +         =  <execution>
>> > > +           =  <goals>
>> > > +             =  <goal>ipojo-bundle</goal>
>> > > +           =  </goals>
>> > > +         =  </execution>
>> > > +        </executions>
>> > > +      </plugin>
>> > > +    </plugins>
>> > > +  </build>
>> > > +</project>
>> > > +
>> > >
>> > > Added: = directory/apacheds/trunk/component-hub/src/main/java/org/apache/directory/= server/component/ADSComponent.java
>> > > URL: http://svn.apache.org/viewvc/directory/apache= ds/trunk/component-hub/src/main/java/org/apache/directory/server/component= /ADSComponent.java?rev=3D1203217&view=3Dauto
>> > > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D
>> > > --- = directory/apacheds/trunk/component-hub/src/main/java/org/apache/directory/= server/component/ADSComponent.java (added)
>> > > +++ = directory/apacheds/trunk/component-hub/src/main/java/org/apache/directory/= server/component/ADSComponent.java Thu Nov 17 15:21:39 2011
>> > > @@ -0,0 +1,49 @@
>> > > +/*
>> > > + *  Licensed to the Apache Software Foundation = (ASF) under one
>> > > + *  or more contributor license agreements. =  See the NOTICE file
>> > > + *  distributed with this work for additional = information
>> > > + *  regarding copyright ownership.  The = ASF licenses this file
>> > > + *  to you under the Apache License, Version = 2.0 (the
>> > > + *  "License"); you may not use this file = except in compliance
>> > > + *  with the License.  You may obtain a = copy of the License at
>> > > + *
>> > > + *    http://www.apache.org/= licenses/LICENSE-2.0
>> > > + *
>> > > + *  Unless required by applicable law or agreed = to in writing,
>> > > + *  software distributed under the License is = distributed on an
>> > > + *  "AS IS" BASIS, WITHOUT WARRANTIES OR = CONDITIONS OF ANY
>> > > + *  KIND, either express or implied.  See = the License for the
>> > > + *  specific language governing permissions and = limitations
>> > > + *  under the License.
>> > > + *
>> > > + */
>> > > +package org.apache.directory.server.component;
>> > > +
>> > > +import java.util.List;
>> > > +
>> > > +import = org.apache.directory.shared.ldap.model.ldif.LdifReader;
>> > > +import org.apache.felix.ipojo.ComponentFactory;
>> > > +
>> > > +/**
>> > > + * Class that represents a component for ApacheDS = use.
>> > > + *
>> > > + * @author <a href=3D"mailto:dev@directory.apache.org">= Apache Directory Project</a>
>> > > + */
>> > > +public class ADSComponent
>> > > +{
>> > > +    private ComponentFactory factory;
>> > > +
>> > > +    private String componentType =3D = "user";
>> > > +
>> > > +    private String componentSchemaDn;
>> > > +
>> > > +    private = List<ADSComponentInstance> instances;
>> > > +
>> > > +    private LdifReader cacheHandle;
>> > > +
>> > > +    public ComponentFactory = getFactory()
>> > > +    {
>> > > +        return factory;
>> > > +    }
>> > > +
>> > > +}
>> > >
>> > > Added: = directory/apacheds/trunk/component-hub/src/main/java/org/apache/directory/= server/component/ADSComponentInstance.java
>> > > URL: http://svn.apache.org/viewvc/director= y/apacheds/trunk/component-hub/src/main/java/org/apache/directory/server/c= omponent/ADSComponentInstance.java?rev=3D1203217&view=3Dauto
>> > > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D
>> > > --- = directory/apacheds/trunk/component-hub/src/main/java/org/apache/directory/= server/component/ADSComponentInstance.java (added)
>> > > +++ = directory/apacheds/trunk/component-hub/src/main/java/org/apache/directory/= server/component/ADSComponentInstance.java Thu Nov 17 15:21:39 2011
>> > > @@ -0,0 +1,39 @@
>> > > +/*
>> > > + *  Licensed to the Apache Software Foundation = (ASF) under one
>> > > + *  or more contributor license agreements. =  See the NOTICE file
>> > > + *  distributed with this work for additional = information
>> > > + *  regarding copyright ownership.  The = ASF licenses this file
>> > > + *  to you under the Apache License, Version = 2.0 (the
>> > > + *  "License"); you may not use this file = except in compliance
>> > > + *  with the License.  You may obtain a = copy of the License at
>> > > + *
>> > > + *    http://www.apache.org/= licenses/LICENSE-2.0
>> > > + *
>> > > + *  Unless required by applicable law or agreed = to in writing,
>> > > + *  software distributed under the License is = distributed on an
>> > > + *  "AS IS" BASIS, WITHOUT WARRANTIES OR = CONDITIONS OF ANY
>> > > + *  KIND, either express or implied.  See = the License for the
>> > > + *  specific language governing permissions and = limitations
>> > > + *  under the License.
>> > > + *
>> > > + */
>> > > +package org.apache.directory.server.component;
>> > > +
>> > > +import = org.apache.directory.shared.ldap.model.ldif.LdifEntry;
>> > > +
>> > > +/**
>> > > + * Class that represents an individual instance of = an ADSComponent
>> > > + *
>> > > + * @author <a href=3D"mailto:dev@directory.apache.org">= Apache Directory Project</a>
>> > > + */
>> > > +public class ADSComponentInstance
>> > > +{
>> > > +    private LdifEntry instanceEntry;
>> > > +
>> > > +    private String configHookDn;
>> > > +
>> > > +    private Object instance;
>> > > +
>> > > +    private ADSComponent = parentComponent;
>> > > +
>> > > +}
>> > >
>> > > Added: = directory/apacheds/trunk/component-hub/src/main/java/org/apache/directory/= server/component/ADSConstants.java
>> > > URL: http://svn.apache.org/viewvc/directory/apache= ds/trunk/component-hub/src/main/java/org/apache/directory/server/component= /ADSConstants.java?rev=3D1203217&view=3Dauto
>> > > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D
>> > > --- = directory/apacheds/trunk/component-hub/src/main/java/org/apache/directory/= server/component/ADSConstants.java (added)
>> > > +++ = directory/apacheds/trunk/component-hub/src/main/java/org/apache/directory/= server/component/ADSConstants.java Thu Nov 17 15:21:39 2011
>> > > @@ -0,0 +1,136 @@
>> > > +/*
>> > > + *  Licensed to the Apache Software Foundation = (ASF) under one
>> > > + *  or more contributor license agreements. =  See the NOTICE file
>> > > + *  distributed with this work for additional = information
>> > > + *  regarding copyright ownership.  The = ASF licenses this file
>> > > + *  to you under the Apache License, Version = 2.0 (the
>> > > + *  "License"); you may not use this file = except in compliance
>> > > + *  with the License.  You may obtain a = copy of the License at
>> > > + *
>> > > + *    http://www.apache.org/= licenses/LICENSE-2.0
>> > > + *
>> > > + *  Unless required by applicable law or agreed = to in writing,
>> > > + *  software distributed under the License is = distributed on an
>> > > + *  "AS IS" BASIS, WITHOUT WARRANTIES OR = CONDITIONS OF ANY
>> > > + *  KIND, either express or implied.  See = the License for the
>> > > + *  specific language governing permissions and = limitations
>> > > + *  under the License.
>> > > + *
>> > > + */
>> > > +package org.apache.directory.server.component;
>> > > +
>> > > +
>> > > +import java.util.Dictionary;
>> > > +import java.util.Hashtable;
>> > > +
>> > > +
>> > > +/**
>> > > + * Class to hold constants for ApacheDS component = management.
>> > > + *
>> > > + * @author <a href=3D"mailto:dev@directory.apache.org">= Apache Directory Project</a>
>> > > + */
>> > > +public class ADSConstants
>> > > +{
>> > > +
>> > > +    /*
>> > > +     * base directory path for component = cache
>> > > +     */
>> > > +    public static final String = ADS_CACHE_BASE_DIR =3D "adscache";
>> > > +
>> > > +    /*
>> > > +     * default file name for caching = schemas inside for components
>> > > +     */
>> > > +    public static final String = ADS_CACHE_SCHEMA_FILE =3D "schema.ldif";
>> > > +
>> > > +    /*
>> > > +     * default file name for caching = instance entries inside for components
>> > > +     */
>> > > +    public static final String = ADS_CACHE_INSTANCES_FILE =3D "instances.ldif";
>> > > +
>> > > +    /*
>> > > +     * default file name for caching = version information for components
>> > > +     */
>> > > +    public static final String = ADS_CACHE_VERSION_FILE =3D "version";
>> > > +
>> > > +    /*
>> > > +     * IPojo Handler name for ADSComponent = annotation.
>> > > +     */
>> > > +    public static final String = ADS_COMPONENT_HANDLER_NS =3D = "org.apache.directory.server.component.handler";
>> > > +
>> > > +    /*
>> > > +     * IPojo Handler name for ADSComponent = annotation.
>> > > +     */
>> > > +    public static final String = ADS_COMPONENT_HANDLER_NAME =3D "ADSComponentHandler";
>> > > +
>> > > +    /*
>> > > +     * IPojo Handler name for ADSComponent = annotation.
>> > > +     */
>> > > +    public static final String = ADS_COMPONENT_HANDLER_FULLNAME =3D = "org.apache.directory.server.component.handler:ADSComponentHandler";
>> > > +
>> > > +    /*
>> > > +     * iPOJO Component Type and Instance = declaration header.
>> > > +     */
>> > > +    public static final String = IPOJO_HEADER =3D "iPOJO-Components";
>> > > +
>> > > +    /*
>> > > +     * Base OID value for ApacheDS = component schemas.
>> > > +     */
>> > > +    public static final String = ADS_COMPONENT_BASE_OID =3D "1.3.6.1.4.1.18060.0.4.4";
>> > > +
>> > > +    /*
>> > > +     * Component type name of user defined = components.
>> > > +     */
>> > > +    public static final String = ADS_COMPONENT_TYPE_USER =3D "user";
>> > > +
>> > > +    /*
>> > > +     * Base DN for = @ADSComponent(componentType=3D"user") component schema elements.
>> > > +     */
>> > > +    public static final String = ADS_USER_COMPONENTS_SCHEMA_DN =3D "cn=3Dusercomponents,ou=3Dschema";
>> > > +
>> > > +    /*
>> > > +     * Hash table for mapping property = type name to its syntax in ApacheDS
>> > > +     */
>> > > +    public static Dictionary<String, = String> syntaxMappings;
>> > > +
>> > > +    /*
>> > > +     * Hash table for mapping property = type name to its equality matching rule in ApacheDS
>> > > +     */
>> > > +    public static Dictionary<String, = String> equalityMappings;
>> > > +
>> > > +    /*
>> > > +     * Hash table for mapping property = type name to its ordering rule in ApacheDS
>> > > +     */
>> > > +    public static Dictionary<String, = String> orderingMappings;
>> > > +
>> > > +    /*
>> > > +     * Hash table for mapping property = type name to its substring matching in ApacheDS
>> > > +     */
>> > > +    public static Dictionary<String, = String> substringMappings;
>> > > +
>> > > +    /**
>> > > +     * Static constructor that initializes = the values of the type mapping Hash tables.
>> > > +     */
>> > > +    static
>> > > +    {
>> > > +        syntaxMappings =3D new = Hashtable<String, String>();
>> > > +        syntaxMappings.put( = "int", "1.3.6.1.4.1.1466.115.121.1.27" );
>> > > +        syntaxMappings.put( = "java.lang.String", "1.3.6.1.4.1.1466.115.121.1.15" );
>> > > +        syntaxMappings.put( = "boolean", "1.3.6.1.4.1.1466.115.121.1.7" );
>> > > +
>> > > +        equalityMappings =3D new = Hashtable<String, String>();
>> > > +        equalityMappings.put( = "int", "integerMatch" );
>> > > +        equalityMappings.put( = "java.lang.String", "caseExactMatch" );
>> > > +        equalityMappings.put( = "boolean", "booleanMatch" );
>> > > +
>> > > +        orderingMappings =3D new = Hashtable<String, String>();
>> > > +        orderingMappings.put( = "int", "integerOrderingMatch" );
>> > > +        orderingMappings.put( = "java.lang.String", "caseExactOrderingMatch" );
>> > > +        orderingMappings.put( = "boolean", "caseIgnoreOrderingMatch" );
>> > > +
>> > > +        substringMappings =3D = new Hashtable<String, String>();
>> > > +        substringMappings.put( = "int", "numericStringSubstringsMatch" );
>> > > +        substringMappings.put( = "java.lang.String", "caseExactSubstringsMatch" );
>> > > +        substringMappings.put( = "boolean", "caseIgnoreSubstringsMatch" );
>> > > +    }
>> > > +
>> > > +}
>> > >
>> > > Added: = directory/apacheds/trunk/component-hub/src/main/java/org/apache/directory/= server/component/handler/ADSComponent.java
>> > > URL: http://svn.apache.org/viewvc/director= y/apacheds/trunk/component-hub/src/main/java/org/apache/directory/server/c= omponent/handler/ADSComponent.java?rev=3D1203217&view=3Dauto
>> > > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D
>> > > --- = directory/apacheds/trunk/component-hub/src/main/java/org/apache/directory/= server/component/handler/ADSComponent.java (added)
>> > > +++ = directory/apacheds/trunk/component-hub/src/main/java/org/apache/directory/= server/component/handler/ADSComponent.java Thu Nov 17 15:21:39 2011
>> > > @@ -0,0 +1,31 @@
>> > > +/*
>> > > + *  Licensed to the Apache Software Foundation = (ASF) under one
>> > > + *  or more contributor license agreements. =  See the NOTICE file
>> > > + *  distributed with this work for additional = information
>> > > + *  regarding copyright ownership.  The = ASF licenses this file
>> > > + *  to you under the Apache License, Version = 2.0 (the
>> > > + *  "License"); you may not use this file = except in compliance
>> > > + *  with the License.  You may obtain a = copy of the License at
>> > > + *
>> > > + *    http://www.apache.org/= licenses/LICENSE-2.0
>> > > + *
>> > > + *  Unless required by applicable law or agreed = to in writing,
>> > > + *  software distributed under the License is = distributed on an
>> > > + *  "AS IS" BASIS, WITHOUT WARRANTIES OR = CONDITIONS OF ANY
>> > > + *  KIND, either express or implied.  See = the License for the
>> > > + *  specific language governing permissions and = limitations
>> > > + *  under the License.
>> > > + *
>> > > + */
>> > > +package = org.apache.directory.server.component.handler;
>> > > +
>> > > +
>> > > +/**
>> > > + * Used to annotate ApacheDS components with their = component type.
>> > > + *
>> > > + * @author <a href=3D"mailto:dev@directory.apache.org">= Apache Directory Project</a>
>> > > + */
>> > > +public @interface ADSComponent
>> > > +{
>> > > +    String componentType() default = "user";
>> > > +}
>> > >
>> > > Added: = directory/apacheds/trunk/component-hub/src/main/java/org/apache/directory/= server/component/handler/ADSComponentHandler.java
>> > > URL: http://svn.apache.org/viewvc/d= irectory/apacheds/trunk/component-hub/src/main/java/org/apache/directory/s= erver/component/handler/ADSComponentHandler.java?rev=3D1203217&view=3D= auto
>> > > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D
>> > > --- = directory/apacheds/trunk/component-hub/src/main/java/org/apache/directory/= server/component/handler/ADSComponentHandler.java (added)
>> > > +++ = directory/apacheds/trunk/component-hub/src/main/java/org/apache/directory/= server/component/handler/ADSComponentHandler.java Thu Nov 17 15:21:39 = 2011
>> > > @@ -0,0 +1,65 @@
>> > > +/*
>> > > + *  Licensed to the Apache Software Foundation = (ASF) under one
>> > > + *  or more contributor license agreements. =  See the NOTICE file
>> > > + *  distributed with this work for additional = information
>> > > + *  regarding copyright ownership.  The = ASF licenses this file
>> > > + *  to you under the Apache License, Version = 2.0 (the
>> > > + *  "License"); you may not use this file = except in compliance
>> > > + *  with the License.  You may obtain a = copy of the License at
>> > > + *
>> > > + *    http://www.apache.org/= licenses/LICENSE-2.0
>> > > + *
>> > > + *  Unless required by applicable law or agreed = to in writing,
>> > > + *  software distributed under the License is = distributed on an
>> > > + *  "AS IS" BASIS, WITHOUT WARRANTIES OR = CONDITIONS OF ANY
>> > > + *  KIND, either express or implied.  See = the License for the
>> > > + *  specific language governing permissions and = limitations
>> > > + *  under the License.
>> > > + *
>> > > + */
>> > > +package = org.apache.directory.server.component.handler;
>> > > +
>> > > +
>> > > +import java.util.Dictionary;
>> > > +
>> > > +import = org.apache.felix.ipojo.ConfigurationException;
>> > > +import org.apache.felix.ipojo.PrimitiveHandler;
>> > > +import = org.apache.felix.ipojo.annotations.Handler;
>> > > +import org.apache.felix.ipojo.metadata.Element;
>> > > +
>> > > +
>> > > +/**
>> > > + * IPojo handler for ADSComponent annotation.
>> > > + * It does not supposed to do anything. It is just = to validate the custom-annotated component.
>> > > + *
>> > > + *
>> > > + * @author <a href=3D"mailto:dev@directory.apache.org">= Apache Directory Project</a>
>> > > + */
>> > > +@Handler(namespace =3D = "org.apache.directory.server.component.handler", name =3D = "ADSComponent")
>> > > +public class ADSComponentHandler extends = PrimitiveHandler
>> > > +{
>> > > +
>> > > +    @Override
>> > > +    public void configure( Element = metadata, Dictionary configuration ) throws ConfigurationException
>> > > +    {
>> > > +        // TODO Auto-generated = method stub
>> > > +
>> > > +    }
>> > > +
>> > > +
>> > > +    @Override
>> > > +    public void stop()
>> > > +    {
>> > > +        // TODO Auto-generated = method stub
>> > > +
>> > > +    }
>> > > +
>> > > +
>> > > +    @Override
>> > > +    public void start()
>> > > +    {
>> > > +        // TODO Auto-generated = method stub
>> > > +
>> > > +    }
>> > > +
>> > > +}
>> > >
>> > > Added: = directory/apacheds/trunk/component-hub/src/main/java/org/apache/directory/= server/component/hub/ComponentHub.java
>> > > URL: http://svn.apache.org/viewvc/directory/ap= acheds/trunk/component-hub/src/main/java/org/apache/directory/server/compo= nent/hub/ComponentHub.java?rev=3D1203217&view=3Dauto
>> > > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D
>> > > --- = directory/apacheds/trunk/component-hub/src/main/java/org/apache/directory/= server/component/hub/ComponentHub.java (added)
>> > > +++ = directory/apacheds/trunk/component-hub/src/main/java/org/apache/directory/= server/component/hub/ComponentHub.java Thu Nov 17 15:21:39 2011
>> > > @@ -0,0 +1,418 @@
>> > > +/*
>> > > + *  Licensed to the Apache Software Foundation = (ASF) under one
>> > > + *  or more contributor license agreements. =  See the NOTICE file
>> > > + *  distributed with this work for additional = information
>> > > + *  regarding copyright ownership.  The = ASF licenses this file
>> > > + *  to you under the Apache License, Version = 2.0 (the
>> > > + *  "License"); you may not use this file = except in compliance
>> > > + *  with the License.  You may obtain a = copy of the License at
>> > > + *
>> > > + *    http://www.apache.org/= licenses/LICENSE-2.0
>> > > + *
>> > > + *  Unless required by applicable law or agreed = to in writing,
>> > > + *  software distributed under the License is = distributed on an
>> > > + *  "AS IS" BASIS, WITHOUT WARRANTIES OR = CONDITIONS OF ANY
>> > > + *  KIND, either express or implied.  See = the License for the
>> > > + *  specific language governing permissions and = limitations
>> > > + *  under the License.
>> > > + *
>> > > + */
>> > > +package = org.apache.directory.server.component.hub;
>> > > +
>> > > +
>> > > +import java.util.ArrayList;
>> > > +import java.util.Dictionary;
>> > > +import java.util.Enumeration;
>> > > +import java.util.Hashtable;
>> > > +import java.util.List;
>> > > +
>> > > +import = org.apache.directory.server.component.ADSComponent;
>> > > +import = org.apache.directory.server.component.ADSConstants;
>> > > +import = org.apache.directory.server.component.hub.listener.HubListener;
>> > > +import = org.apache.directory.server.component.schema.ComponentSchemaGenerator;
= >> > > +import = org.apache.directory.server.component.schema.UserComponentSchemaGenerator;=
>> > > +import org.apache.felix.ipojo.Factory;
>> > > +import = org.apache.felix.ipojo.annotations.Component;
>> > > +import = org.apache.felix.ipojo.annotations.Invalidate;
>> > > +import = org.apache.felix.ipojo.annotations.Requires;
>> > > +import = org.apache.felix.ipojo.annotations.Validate;
>> > > +import org.apache.felix.ipojo.metadata.Element;
>> > > +import = org.apache.felix.ipojo.parser.ManifestMetadataParser;
>> > > +import = org.apache.felix.ipojo.parser.ParseException;
>> > > +import org.apache.felix.ipojo.whiteboard.Wbp;
>> > > +import = org.apache.felix.ipojo.whiteboard.Whiteboards;
>> > > +import org.osgi.framework.ServiceReference;
>> > > +import org.osgi.service.log.LogService;
>> > > +
>> > > +
>> > > +/**
>> > > + * An IPojo component that listens for incoming = factories and instances.
>> > > + * Creating or destroying corresponding ADSComponent = from them.
>> > > + *
>> > > + *
>> > > + * @author <a href=3D"mailto:dev@directory.apache.org">= Apache Directory Project</a>
>> > > + */
>> > > +@Component
>> > > +@Whiteboards(whiteboards =3D
>> > > +    {
>> > > +        @Wbp(onArrival =3D = "onFactoryArrival",
>> > > +           =  onDeparture =3D "onFactoryDeparture",
>> > > +            filter =3D = "(objectClass=3Dorg.apache.felix.ipojo.Factory)"),
>> > > +        @Wbp(onArrival =3D = "onInstanceArrival",
>> > > +           =  onDeparture =3D "onInstanceDeparture",
>> > > +            filter =3D = "(objectClass=3Dorg.apache.felix.ipojo.architecture.Architecture)")
>> > > +})
>> > > +public class ComponentHub
>> > > +{
>> > > +    /*
>> > > +     * boolean value to check for deferred = writes to schema partition
>> > > +     */
>> > > +    private boolean schemaReady =3D = false;
>> > > +
>> > > +    /*
>> > > +     * boolean value to check for deferred = writes to config partition
>> > > +     */
>> > > +    private boolean configReady =3D = false;
>> > > +
>> > > +    /*
>> > > +     * Map to keep "component type" -> = "components" mapping.
>> > > +     */
>> > > +    private Dictionary<String, = List<ADSComponent>> componentMap;
>> > > +
>> > > +    /*
>> > > +     * List to keep all active ApacheDS = components.
>> > > +     */
>> > > +    private List<ADSComponent> = components;
>> > > +
>> > > +    /*
>> > > +     * Map to keep "component type" -> = "schema generator" mapping.
>> > > +     */
>> > > +    private Dictionary<String, = ComponentSchemaGenerator> schemaGenerators;
>> > > +
>> > > +    /*
>> > > +     * Map to keep "component type" -> = "listeners" mapping
>> > > +     */
>> > > +    private Dictionary<String, = List<HubListener>> listenersMap;
>> > > +
>> > > +    /*
>> > > +     * OSGI Logger
>> > > +     */
>> > > +    @Requires
>> > > +    private LogService logger;
>> > > +
>> > > +
>> > > +    public ComponentHub()
>> > > +    {
>> > > +        componentMap =3D new = Hashtable<String, List<ADSComponent>>();
>> > > +        components =3D new = ArrayList<ADSComponent>();
>> > > +
>> > > +        schemaGenerators =3D new = Hashtable<String, ComponentSchemaGenerator>();
>> > > +        schemaGenerators.put( = ADSConstants.ADS_COMPONENT_TYPE_USER, new UserComponentSchemaGenerator() = );
>> > > +
>> > > +        listenersMap =3D new = Hashtable<String, List<HubListener>>();
>> > > +    }
>> > > +
>> > > +
>> > > +    /**
>> > > +     * Called when ADSComponentHub = instance is validated by IPojo
>> > > +     *
>> > > +     */
>> > > +    @Validate
>> > > +    public void hubValidated()
>> > > +    {
>> > > +        logger.log( = LogService.LOG_INFO, "ADSComponentHub validated." );
>> > > +    }
>> > > +
>> > > +
>> > > +    /**
>> > > +     * Called when ADSComponentHub = instance is invalidated by IPojo
>> > > +     *
>> > > +     */
>> > > +    @Invalidate
>> > > +    public void hubInvalidated()
>> > > +    {
>> > > +        logger.log( = LogService.LOG_INFO, "ADSComponentHub validated." );
>> > > +    }
>> > > +
>> > > +
>> > > +    /**
>> > > +     * Factory arrival callback, = registered by whiteboard handler.
>> > > +     *
>> > > +     * @param ref Reference to IPojo = Factory
>> > > +     */
>> > > +    public void onFactoryArrival( = ServiceReference ref )
>> > > +    {
>> > > +        Factory arrivingFactory = =3D ( Factory ) ref.getBundle().getBundleContext().getService( ref = );
>> > > +        if ( = !checkIfADSComponent( arrivingFactory ) )
>> > > +        {
>> > > +           =  return;
>> > > +        }
>> > > +
>> > > +        try
>> > > +        {
>> > > +            String = componentType =3D parseComponentType( arrivingFactory );
>> > > +
>> > > +           =  List<HubListener> listenersByType =3D listenersMap.get( = componentType );
>> > > +
>> > > +            // Fire = the 'factory arrived' event on listeners.
>> > > +            if ( = listenersByType !=3D null )
>> > > +            {
>> > > +               =  for ( HubListener listener : listenersByType )
>> > > +               =  {
>> > > +               =      listener.onFactoryArrival( arrivingFactory );
>> > > +               =  }
>> > > +            }
>> > > +
>> > > +            //Actual = ADSComponent creation
>> > > +           =  ADSComponent component =3D generateADSComponent( componentType, = arrivingFactory );
>> > > +
>> > > +            // Iterate = over listeners for 'component created' event. Apply the changes applied = by them.
>> > > +            if ( = listenersByType !=3D null )
>> > > +            {
>> > > +               =  for ( HubListener listener : listenersByType )
>> > > +               =  {
>> > > +               =      ADSComponent _comp =3D listener.onComponentCreation( = component );
>> > > +               =      if ( _comp !=3D null )
>> > > +               =      {
>> > > +               =          component =3D _comp;
>> > > +               =      }
>> > > +               =  }
>> > > +            }
>> > > +
>> > > +            //Keep the = newly created ADSComponent reference.
>> > > +           =  components.add( component );
>> > > +
>> > > +           =  List<ADSComponent> componentsByType =3D componentMap.get( = componentType );
>> > > +            if ( = componentsByType =3D=3D null )
>> > > +            {
>> > > +               =  List<ADSComponent> newCompList =3D new = ArrayList<ADSComponent>();
>> > > +               =  newCompList.add( component );
>> > > +               =  componentMap.put( componentType, newCompList );
>> > > +            }
>> > > +            else
>> > > +            {
>> > > +               =  componentsByType.add( component );
>> > > +            }
>> > > +
>> > > +        }
>> > > +        catch ( ParseException e = )
>> > > +        {
>> > > +           =  e.printStackTrace();
>> > > +        }
>> > > +
>> > > +    }
>> > > +
>> > > +
>> > > +    /**
>> > > +     * Factory departure callback, = registered by whiteboard handler.
>> > > +     *
>> > > +     * @param ref Reference to IPojo = Factory
>> > > +     */
>> > > +    public void onFactoryDeparture( = ServiceReference ref )
>> > > +    {
>> > > +        Factory leavingFactory =3D= ( Factory ) ref.getBundle().getBundleContext().getService( ref );
>> > > +        if ( = !checkIfADSComponent( leavingFactory ) )
>> > > +        {
>> > > +           =  return;
>> > > +        }
>> > > +
>> > > +        try
>> > > +        {
>> > > +            String = componentType =3D parseComponentType( leavingFactory );
>> > > +
>> > > +           =  List<HubListener> listenersByType =3D listenersMap.get( = componentType );
>> > > +
>> > > +            // Fire = the 'factory leaving' event on listeners.
>> > > +            if ( = listenersByType !=3D null )
>> > > +            {
>> > > +               =  for ( HubListener listener : listenersByType )
>> > > +               =  {
>> > > +               =      listener.onFactoryDeparture( leavingFactory );
>> > > +               =  }
>> > > +            }
>> > > +
>> > > +           =  ADSComponent associatedComp =3D null;
>> > > +            for ( = ADSComponent _comp : components )
>> > > +            {
>> > > +               =  if ( _comp.getFactory().getName().equals( leavingFactory.getName() = ) )
>> > > +               =  {
>> > > +               =      associatedComp =3D _comp;
>> > > +               =      break;
>> > > +               =  }
>> > > +            }
>> > > +
>> > > +            if ( = associatedComp =3D=3D null )
>> > > +            {
>> > > +               =  logger.log( LogService.LOG_INFO, "Couldn't found an associated = ADSComponent for factory:"
>> > > +               =      + leavingFactory.getName() );
>> > > +               =  return;
>> > > +            }
>> > > +
>> > > +            // Iterate = over listeners for 'component deleting' event.
>> > > +            if ( = listenersByType !=3D null )
>> > > +            {
>> > > +               =  for ( HubListener listener : listenersByType )
>> > > +               =  {
>> > > +               =      listener.onComponentDeletion( associatedComp );
>> > > +               =  }
>> > > +            }
>> > > +
>> > > +            // All = clients are notified now cache and delete the ADSComponent existence on = ApacheDS
>> > > +           =  cacheAndReleaseADSComponent( associatedComp );
>> > > +
>> > > +        }
>> > > +        catch ( ParseException e = )
>> > > +        {
>> > > +           =  e.printStackTrace();
>> > > +        }
>> > > +    }
>> > > +
>> > > +
>> > > +    /**
>> > > +     * IPojo instance arrival callback, = registered by whiteboard handler.
>> > > +     *
>> > > +     * @param ref Reference to IPojo = instance
>> > > +     */
>> > > +    public void onInstanceArrival( = ServiceReference ref )
>> > > +    {
>> > > +
>> > > +    }
>> > > +
>> > > +
>> > > +    /**
>> > > +     * IPojo instance departure callback, = registered by whiteboard handler.
>> > > +     *
>> > > +     * @param ref Reference to IPojo = instance
>> > > +     */
>> > > +    public void onInstanceDeparture( = ServiceReference ref )
>> > > +    {
>> > > +
>> > > +    }
>> > > +
>> > > +
>> > > +    /**
>> > > +     * Check whether the argument is = ADSComponent annotated.
>> > > +     *
>> > > +     * @param factory
>> > > +     * @return
>> > > +     */
>> > > +    private boolean checkIfADSComponent( = Factory factory )
>> > > +    {
>> > > +        List<String> = handlers =3D factory.getRequiredHandlers();
>> > > +        for ( String handlerName = : handlers )
>> > > +        {
>> > > +            if ( = handlerName.equals( ADSConstants.ADS_COMPONENT_HANDLER_FULLNAME ) )
>> > > +            {
>> > > +               =  return true;
>> > > +            }
>> > > +        }
>> > > +
>> > > +        return false;
>> > > +    }
>> > > +
>> > > +
>> > > +    private String parseComponentType( = Factory factory ) throws ParseException
>> > > +    {
>> > > +        Dictionary bundleHeaders = =3D factory.getBundleContext().getBundle().getHeaders();
>> > > +        String ipojoHeader =3D ( = String ) bundleHeaders.get( ADSConstants.IPOJO_HEADER );
>> > > +
>> > > +        if ( ipojoHeader =3D=3D = null )
>> > > +        {
>> > > +            throw new = ParseException( "Null ipojo header returned for factory: " + = factory.getName() );
>> > > +        }
>> > > +
>> > > +        ManifestMetadataParser = parser =3D new ManifestMetadataParser();
>> > > +        parser.parseHeader( = ipojoHeader );
>> > > +
>> > > +        Element[] componentMetas = =3D parser.getComponentsMetadata();
>> > > +
>> > > +        for ( Element = componentMeta : componentMetas )
>> > > +        {
>> > > +            String = compName =3D componentMeta.getAttribute( "name" );
>> > > +            if ( = compName.equals( factory.getName() ) )
>> > > +            {
>> > > +               =  Element[] adsElements =3D componentMeta.getElements(
>> > > +               =      ADSConstants.ADS_COMPONENT_HANDLER_NAME,
>> > > +               =      ADSConstants.ADS_COMPONENT_HANDLER_NS );
>> > > +
>> > > +               =  if ( adsElements =3D=3D null || adsElements.length =3D=3D 0 )
>> > > +               =  {
>> > > +               =      throw new ParseException( "ADSComponent element = couldn't be found for factory: "
>> > > +               =          + factory.getName() );
>> > > +               =  }
>> > > +
>> > > +               =  return adsElements[0].getAttribute( "componentType" );
>> > > +            }
>> > > +        }
>> > > +
>> > > +        return null;
>> > > +    }
>> > > +
>> > > +
>> > > +    /**
>> > > +     * Generates a new ADSComponent with = its schema and cache handle.
>> > > +     *
>> > > +     * @param componentType Type of a = component being created
>> > > +     * @param factory a factory reference = to create a ADSComponent for.
>> > > +     * @return
>> > > +     */
>> > > +    private ADSComponent = generateADSComponent( String componentType, Factory factory )
>> > > +    {
>> > > +        return null;
>> > > +    }
>> > > +
>> > > +
>> > > +    /**
>> > > +     * Cache the ADSComponent existence on = ApacheDS with all of its DIT entries. And then release it from hub.
>> > > +     *
>> > > +     * @param leavingComp ADSComponent = reference to cache and release.
>> > > +     */
>> > > +    private void = cacheAndReleaseADSComponent( ADSComponent leavingComp )
>> > > +    {
>> > > +
>> > > +    }
>> > > +
>> > > +
>> > > +    /**
>> > > +     * Registers a HubListener for = specified component type.
>> > > +     *
>> > > +     * @param componentType component type = to get notifications for.
>> > > +     * @param listener HubListener = implementation
>> > > +     */
>> > > +    public void registerListener( String = componentType, HubListener listener )
>> > > +    {
>> > > +        List<HubListener> = listenersForComp =3D listenersMap.get( componentType );
>> > > +        if ( listenersForComp =3D=3D= null )
>> > > +        {
>> > > +           =  ArrayList<HubListener> list =3D new = ArrayList<HubListener>();
>> > > +            list.add( = listener );
>> > > +           =  listenersMap.put( componentType, list );
>> > > +        }
>> > > +        else
>> > > +        {
>> > > +            if ( = !listenersForComp.contains( listener ) )
>> > > +            {
>> > > +               =  listenersForComp.add( listener );
>> > > +            }
>> > > +        }
>> > > +    }
>> > > +
>> > > +
>> > > +    /**
>> > > +     * Removes the specified listener from = the notification chain.
>> > > +     *
>> > > +     * @param listener HubListener = implementation
>> > > +     */
>> > > +    public void removeListener( = HubListener listener )
>> > > +    {
>> > > +       =  Enumeration<List<HubListener>> it =3D = listenersMap.elements();
>> > > +        while ( = it.hasMoreElements() )
>> > > +        {
>> > > +           =  List<HubListener> list =3D it.nextElement();
>> > > +            if ( = list.contains( listener ) )
>> > > +            {
>> > > +               =  list.remove( listener );
>> > > +            }
>> > > +        }
>> > > +    }
>> > > +}
>> > >
>> > > Added: = directory/apacheds/trunk/component-hub/src/main/java/org/apache/directory/= server/component/hub/listener/AbstractHubListener.java
>> > > URL: http://svn.apache.org/vie= wvc/directory/apacheds/trunk/component-hub/src/main/java/org/apache/direct= ory/server/component/hub/listener/AbstractHubListener.java?rev=3D1203217&a= mp;view=3Dauto
>> > > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D
>> > > --- = directory/apacheds/trunk/component-hub/src/main/java/org/apache/directory/= server/component/hub/listener/AbstractHubListener.java (added)
>> > > +++ = directory/apacheds/trunk/component-hub/src/main/java/org/apache/directory/= server/component/hub/listener/AbstractHubListener.java Thu Nov 17 = 15:21:39 2011
>> > > @@ -0,0 +1,76 @@
>> > > +/*
>> > > + *  Licensed to the Apache Software Foundation = (ASF) under one
>> > > + *  or more contributor license agreements. =  See the NOTICE file
>> > > + *  distributed with this work for additional = information
>> > > + *  regarding copyright ownership.  The = ASF licenses this file
>> > > + *  to you under the Apache License, Version = 2.0 (the
>> > > + *  "License"); you may not use this file = except in compliance
>> > > + *  with the License.  You may obtain a = copy of the License at
>> > > + *
>> > > + *    http://www.apache.org/= licenses/LICENSE-2.0
>> > > + *
>> > > + *  Unless required by applicable law or agreed = to in writing,
>> > > + *  software distributed under the License is = distributed on an
>> > > + *  "AS IS" BASIS, WITHOUT WARRANTIES OR = CONDITIONS OF ANY
>> > > + *  KIND, either express or implied.  See = the License for the
>> > > + *  specific language governing permissions and = limitations
>> > > + *  under the License.
>> > > + *
>> > > + */
>> > > +package = org.apache.directory.server.component.hub.listener;
>> > > +
>> > > +
>> > > +import = org.apache.directory.server.component.ADSComponent;
>> > > +import org.apache.felix.ipojo.Factory;
>> > > +
>> > > +
>> > > +/**
>> > > + * Abstract HubListener implementation. Override the = intended methods to receive notifications.
>> > > + *
>> > > + * @author <a href=3D"mailto:dev@directory.apache.org">= Apache Directory Project</a>
>> > > + */
>> > > +public abstract class AbstractHubListener implements = HubListener
>> > > +{
>> > > +
>> > > +    /*
>> > > +     * (non-Javadoc)
>> > > +     * @see = org.apache.directory.server.component.hub.listener.HubListener#onFactoryAr= rival(org.apache.felix.ipojo.Factory)
>> > > +     */
>> > > +    @Override
>> > > +    public void onFactoryArrival( Factory = factory )
>> > > +    {
>> > > +    }
>> > > +
>> > > +
>> > > +    /*
>> > > +     * (non-Javadoc)
>> > > +     * @see = org.apache.directory.server.component.hub.listener.HubListener#onFactoryDe= parture(org.apache.felix.ipojo.Factory)
>> > > +     */
>> > > +    @Override
>> > > +    public void onFactoryDeparture( = Factory factory )
>> > > +    {
>> > > +
>> > > +    }
>> > > +
>> > > +
>> > > +    /*
>> > > +     * (non-Javadoc)
>> > > +     * @see = org.apache.directory.server.component.hub.listener.HubListener#onComponent= Creation(org.apache.directory.server.component.ADSComponent)
>> > > +     */
>> > > +    @Override
>> > > +    public ADSComponent = onComponentCreation( ADSComponent component )
>> > > +    {
>> > > +        return null;
>> > > +    }
>> > > +
>> > > +
>> > > +    /*
>> > > +     * (non-Javadoc)
>> > > +     * @see = org.apache.directory.server.component.hub.listener.HubListener#onComponent= Deletion(org.apache.directory.server.component.ADSComponent)
>> > > +     */
>> > > +    @Override
>> > > +    public void onComponentDeletion( = ADSComponent component )
>> > > +    {
>> > > +    }
>> > > +
>> > > +}
>> > >
>> > > Added: = directory/apacheds/trunk/component-hub/src/main/java/org/apache/directory/= server/component/hub/listener/HubListener.java
>> > > URL: http://svn.apache.org/viewvc/dire= ctory/apacheds/trunk/component-hub/src/main/java/org/apache/directory/serv= er/component/hub/listener/HubListener.java?rev=3D1203217&view=3Dauto
>> > > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D
>> > > --- = directory/apacheds/trunk/component-hub/src/main/java/org/apache/directory/= server/component/hub/listener/HubListener.java (added)
>> > > +++ = directory/apacheds/trunk/component-hub/src/main/java/org/apache/directory/= server/component/hub/listener/HubListener.java Thu Nov 17 15:21:39 = 2011
>> > > @@ -0,0 +1,73 @@
>> > > +/*
>> > > + *  Licensed to the Apache Software Foundation = (ASF) under one
>> > > + *  or more contributor license agreements. =  See the NOTICE file
>> > > + *  distributed with this work for additional = information
>> > > + *  regarding copyright ownership.  The = ASF licenses this file
>> > > + *  to you under the Apache License, Version = 2.0 (the
>> > > + *  "License"); you may not use this file = except in compliance
>> > > + *  with the License.  You may obtain a = copy of the License at
>> > > + *
>> > > + *    
http://www.apache.org/= licenses/LICENSE-2.0
>> > > + *
>> > > + *  Unless required by applicable law or agreed = to in writing,
>> > > + *  software distributed under the License is = distributed on an
>> > > + *  "AS IS" BASIS, WITHOUT WARRANTIES OR = CONDITIONS OF ANY
>> > > + *  KIND, either express or implied.  See = the License for the
>> > > + *  specific language governing permissions and = limitations
>> > > + *  under the License.
>> > > + *
>> > > + */
>> > > +package = org.apache.directory.server.component.hub.listener;
>> > > +
>> > > +
>> > > +import = org.apache.directory.server.component.ADSComponent;
>> > > +import org.apache.felix.ipojo.Factory;
>> > > +import = org.apache.felix.ipojo.architecture.Architecture;
>> > > +
>> > > +
>> > > +/**
>> > > + * Interface for the classes those want to be = notified of ComponentHub.
>> > > + * Listeners can bind themselves using = ComponentHub.registerListener() method,
>> > > + * and can remove themselves using = ComponentHub.removeListener() method.
>> > > + * TODO HubListener.
>> > > + *
>> > > + * @author <a href=3D"mailto:dev@directory.apache.org">= Apache Directory Project</a>
>> > > + */
>> > > +public interface HubListener
>> > > +{
>> > > +    /**
>> > > +     * Notified when a new factory is = sniffed by Hub.
>> > > +     *
>> > > +     * @param factory arriving factory
>> > > +     */
>> > > +    public void onFactoryArrival( Factory = factory );
>> > > +
>> > > +
>> > > +    /**
>> > > +     * Notified when a factory leaving the = container.
>> > > +     *
>> > > +     * @param factory departuring = factory
>> > > +     */
>> > > +    public void onFactoryDeparture( = Factory factory );
>> > > +
>> > > +
>> > > +    /**
>> > > +     * Notified when a new ADSComponent is = created.
>> > > +     * Listener can change the newly = created ADSComponent by returning changed ADSComponent.(Be cautious)
>> > > +     *
>> > > +     * @param component newly created = ADSComponent
>> > > +     * @return the overrided version of = the ADSComponent or null if no change is intended.
>> > > +     */
>> > > +    public ADSComponent = onComponentCreation( ADSComponent component );
>> > > +
>> > > +
>> > > +    /**
>> > > +     * Notified when a new ADSComponent is = about to be disposed.
>> > > +     * Called before component disposal = begins.
>> > > +     *
>> > > +     * @param component disposing created = ADSComponent
>> > > +     * @return the overrided version of = the ADSComponent or null if no change is intended.
>> > > +     */
>> > > +    public void onComponentDeletion( = ADSComponent component );
>> > > +
>> > > +}
>> > >
>> > > Added: = directory/apacheds/trunk/component-hub/src/main/java/org/apache/directory/= server/component/schema/ADSComponentSchema.java
>> > > URL: http://svn.apache.org/viewvc/dir= ectory/apacheds/trunk/component-hub/src/main/java/org/apache/directory/ser= ver/component/schema/ADSComponentSchema.java?rev=3D1203217&view=3Dauto=
>> > > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D
>> > > --- = directory/apacheds/trunk/component-hub/src/main/java/org/apache/directory/= server/component/schema/ADSComponentSchema.java (added)
>> > > +++ = directory/apacheds/trunk/component-hub/src/main/java/org/apache/directory/= server/component/schema/ADSComponentSchema.java Thu Nov 17 15:21:39 = 2011
>> > > @@ -0,0 +1,103 @@
>> > > +/*
>> > > + *  Licensed to the Apache Software Foundation = (ASF) under one
>> > > + *  or more contributor license agreements. =  See the NOTICE file
>> > > + *  distributed with this work for additional = information
>> > > + *  regarding copyright ownership.  The = ASF licenses this file
>> > > + *  to you under the Apache License, Version = 2.0 (the
>> > > + *  "License"); you may not use this file = except in compliance
>> > > + *  with the License.  You may obtain a = copy of the License at
>> > > + *
>> > > + *    http://www.apache.org/= licenses/LICENSE-2.0
>> > > + *
>> > > + *  Unless required by applicable law or agreed = to in writing,
>> > > + *  software distributed under the License is = distributed on an
>> > > + *  "AS IS" BASIS, WITHOUT WARRANTIES OR = CONDITIONS OF ANY
>> > > + *  KIND, either express or implied.  See = the License for the
>> > > + *  specific language governing permissions and = limitations
>> > > + *  under the License.
>> > > + *
>> > > + */
>> > > +package = org.apache.directory.server.component.schema;
>> > > +
>> > > +
>> > > +import java.util.ArrayList;
>> > > +import java.util.List;
>> > > +
>> > > +import = org.apache.directory.shared.ldap.model.ldif.LdifEntry;
>> > > +
>> > > +
>> > > +/**
>> > > + * Class that represents an ADSComponent's schema = definition.
>> > > + *
>> > > + * @author <a href=3D"mailto:dev@directory.apache.org">= Apache Directory Project</a>
>> > > + */
>> > > +public class ADSComponentSchema
>> > > +{
>> > > +    /*
>> > > +     * Schema elements (attribs,ocs) for = component.
>> > > +     */
>> > > +    private List<LdifEntry> = schemaElements =3D null;
>> > > +
>> > > +    /*
>> > > +     * True if the @schemaElements = contains complete schema definition with schema entry.
>> > > +     */
>> > > +    private boolean completeSchema =3D = false;
>> > > +
>> > > +    /*
>> > > +     * Schema name which @schemaElements = will go under.
>> > > +     */
>> > > +    private String parentSchemaDn =3D = null;
>> > > +
>> > > +
>> > > +    public ADSComponentSchema( String = name, List<LdifEntry> elements )
>> > > +    {
>> > > +        this( name, elements, = false );
>> > > +    }
>> > > +
>> > > +
>> > > +    public ADSComponentSchema( String = parentSchema, List<LdifEntry> elements, boolean complete )
>> > > +    {
>> > > +        parentSchemaDn =3D = parentSchema;
>> > > +        schemaElements =3D = elements;
>> > > +        completeSchema =3D = complete;
>> > > +    }
>> > > +
>> > > +
>> > > +    /**
>> > > +     * Getter for completeSchema
>> > > +     *
>> > > +     * @return true if schema is complete = with schema entry.
>> > > +     */
>> > > +    public boolean ifCompleteSchema()
>> > > +    {
>> > > +        return = completeSchema;
>> > > +    }
>> > > +
>> > > +
>> > > +    /**
>> > > +     * Returns name of the schema
>> > > +     *
>> > > +     * @return name of the schema
>> > > +     */
>> > > +    public String = getParentSchemaName()
>> > > +    {
>> > > +        return = parentSchemaDn;
>> > > +    }
>> > > +
>> > > +
>> > > +    /**
>> > > +     * Gets the clone of the schema = elements.
>> > > +     *
>> > > +     * @return clone of the schema = elements.
>> > > +     */
>> > > +    public List<LdifEntry> = getSchemaElements()
>> > > +    {
>> > > +        if ( schemaElements =3D=3D= null )
>> > > +        {
>> > > +            return = null;
>> > > +        }
>> > > +
>> > > +        return new = ArrayList<LdifEntry>( schemaElements );
>> > > +    }
>> > > +
>> > > +}
>> > >
>> > > Added: = directory/apacheds/trunk/component-hub/src/main/java/org/apache/directory/= server/component/schema/ComponentOIDGenerator.java
>> > > URL: http://svn.apache.org/viewvc/= directory/apacheds/trunk/component-hub/src/main/java/org/apache/directory/= server/component/schema/ComponentOIDGenerator.java?rev=3D1203217&view=3D= auto
>> > > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D
>> > > --- = directory/apacheds/trunk/component-hub/src/main/java/org/apache/directory/= server/component/schema/ComponentOIDGenerator.java (added)
>> > > +++ = directory/apacheds/trunk/component-hub/src/main/java/org/apache/directory/= server/component/schema/ComponentOIDGenerator.java Thu Nov 17 15:21:39 = 2011
>> > > @@ -0,0 +1,88 @@
>> > > +/*
>> > > + *  Licensed to the Apache Software Foundation = (ASF) under one
>> > > + *  or more contributor license agreements. =  See the NOTICE file
>> > > + *  distributed with this work for additional = information
>> > > + *  regarding copyright ownership.  The = ASF licenses this file
>> > > + *  to you under the Apache License, Version = 2.0 (the
>> > > + *  "License"); you may not use this file = except in compliance
>> > > + *  with the License.  You may obtain a = copy of the License at
>> > > + *
>> > > + *    http://www.apache.org/= licenses/LICENSE-2.0
>> > > + *
>> > > + *  Unless required by applicable law or agreed = to in writing,
>> > > + *  software distributed under the License is = distributed on an
>> > > + *  "AS IS" BASIS, WITHOUT WARRANTIES OR = CONDITIONS OF ANY
>> > > + *  KIND, either express or implied.  See = the License for the
>> > > + *  specific language governing permissions and = limitations
>> > > + *  under the License.
>> > > + *
>> > > + */
>> > > +package = org.apache.directory.server.component.schema;
>> > > +
>> > > +
>> > > +import = org.apache.directory.server.component.ADSConstants;
>> > > +
>> > > +
>> > > +/**
>> > > + * This is a simple incremental generator for OID = assignments of custom generated schemas.
>> > > + * Ensuring consistency among different servers on = the cluster will be replication layer's duty.
>> > > + * TODO ADSComponentOIDGenerator.
>> > > + *
>> > > + * @author <a href=3D"mailto:dev@directory.apache.org">= Apache Directory Project</a>
>> > > + */
>> > > +public class ComponentOIDGenerator
>> > > +{
>> > > +    /*
>> > > +     * Base OID to generate sequential = OIDs against.
>> > > +     */
>> > > +    private static String baseOID =3D = null;
>> > > +
>> > > +    /*
>> > > +     * Counters to keep track.
>> > > +     */
>> > > +    private static int = componentCounter;
>> > > +    private static int ocCounter;
>> > > +    private static int attribCounter;
>> > > +
>> > > +    static
>> > > +    {
>> > > +        baseOID =3D = ADSConstants.ADS_COMPONENT_BASE_OID;
>> > > +
>> > > +        componentCounter =3D = 0;
>> > > +        ocCounter =3D 0;
>> > > +        attribCounter =3D 0;
>> > > +    }
>> > > +
>> > > +
>> > > +    /**
>> > > +     * Returns OID for component
>> > > +     *
>> > > +     * @return oid for component
>> > > +     */
>> > > +    public static synchronized String = generateComponentOID()
>> > > +    {
>> > > +        return baseOID + "." + ( = ++componentCounter );
>> > > +    }
>> > > +
>> > > +
>> > > +    /**
>> > > +     * Returns OID for object class under = specified component base OID.
>> > > +     *
>> > > +     * @return oid for object class
>> > > +     */
>> > > +    public static synchronized String = generateOCOID( String componentBase )
>> > > +    {
>> > > +        return componentBase + = ".1." + ( ++ocCounter );
>> > > +    }
>> > > +
>> > > +
>> > > +    /**
>> > > +     * Returns OID for attribute under = specified component base OID.
>> > > +     *
>> > > +     * @return oid for attribute
>> > > +     */
>> > > +    public static synchronized String = generateAttribOID( String componentBase )
>> > > +    {
>> > > +        return componentBase + = ".2." + ( ++attribCounter );
>> > > +    }
>> > > +}
>> > >
>> > > Added: = directory/apacheds/trunk/component-hub/src/main/java/org/apache/directory/= server/component/schema/ComponentSchemaGenerator.java
>> > > URL: http://svn.apache.org/view= vc/directory/apacheds/trunk/component-hub/src/main/java/org/apache/directo= ry/server/component/schema/ComponentSchemaGenerator.java?rev=3D1203217&= ;view=3Dauto
>> > > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D
>> > > --- = directory/apacheds/trunk/component-hub/src/main/java/org/apache/directory/= server/component/schema/ComponentSchemaGenerator.java (added)
>> > > +++ = directory/apacheds/trunk/component-hub/src/main/java/org/apache/directory/= server/component/schema/ComponentSchemaGenerator.java Thu Nov 17 = 15:21:39 2011
>> > > @@ -0,0 +1,44 @@
>> > > +/*
>> > > + *  Licensed to the Apache Software Foundation = (ASF) under one
>> > > + *  or more contributor license agreements. =  See the NOTICE file
>> > > + *  distributed with this work for additional = information
>> > > + *  regarding copyright ownership.  The = ASF licenses this file
>> > > + *  to you under the Apache License, Version = 2.0 (the
>> > > + *  "License"); you may not use this file = except in compliance
>> > > + *  with the License.  You may obtain a = copy of the License at
>> > > + *
>> > > + *    http://www.apache.org/= licenses/LICENSE-2.0
>> > > + *
>> > > + *  Unless required by applicable law or agreed = to in writing,
>> > > + *  software distributed under the License is = distributed on an
>> > > + *  "AS IS" BASIS, WITHOUT WARRANTIES OR = CONDITIONS OF ANY
>> > > + *  KIND, either express or implied.  See = the License for the
>> > > + *  specific language governing permissions and = limitations
>> > > + *  under the License.
>> > > + *
>> > > + */
>> > > +package = org.apache.directory.server.component.schema;
>> > > +
>> > > +
>> > > +import org.apache.felix.ipojo.Factory;
>> > > +
>> > > +
>> > > +/**
>> > > + * Interface for classes generating schemas for = component types.
>> > > + *
>> > > + * @author <a href=3D"mailto:dev@directory.apache.org">= Apache Directory Project</a>
>> > > + */
>> > > +public interface ComponentSchemaGenerator
>> > > +{
>> > > +    /**
>> > > +     * Generates a schema for representing = all of factory's configurables.
>> > > +     * Returned schema is in right order = to add it to LDAP without any sorting.
>> > > +     *
>> > > +     * If factory does not need a custom = schema, it does not generate a schema for
>> > > +     * it, just returns the name of stock = schema instead.
>> > > +     *
>> > > +     * @param factory Factory reference to = generate schema for.
>> > > +     * @return Schema in the form of = LdifEntry list.
>> > > +     */
>> > > +    public ADSComponentSchema = generateOrGetSchemaElements( Factory factory );
>> > > +}
>> > >
>> > > Added: = directory/apacheds/trunk/component-hub/src/main/java/org/apache/directory/= server/component/schema/UserComponentSchemaGenerator.java
>> > > URL: http://svn.apache.org/= viewvc/directory/apacheds/trunk/component-hub/src/main/java/org/apache/dir= ectory/server/component/schema/UserComponentSchemaGenerator.java?rev=3D120= 3217&view=3Dauto
>> > > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D
>> > > --- = directory/apacheds/trunk/component-hub/src/main/java/org/apache/directory/= server/component/schema/UserComponentSchemaGenerator.java (added)
>> > > +++ = directory/apacheds/trunk/component-hub/src/main/java/org/apache/directory/= server/component/schema/UserComponentSchemaGenerator.java Thu Nov 17 = 15:21:39 2011
>> > > @@ -0,0 +1,157 @@
>> > > +/*
>> > > + *  Licensed to the Apache Software Foundation = (ASF) under one
>> > > + *  or more contributor license agreements. =  See the NOTICE file
>> > > + *  distributed with this work for additional = information
>> > > + *  regarding copyright ownership.  The = ASF licenses this file
>> > > + *  to you under the Apache License, Version = 2.0 (the
>> > > + *  "License"); you may not use this file = except in compliance
>> > > + *  with the License.  You may obtain a = copy of the License at
>> > > + *
>> > > + *    http://www.apache.org/= licenses/LICENSE-2.0
>> > > + *
>> > > + *  Unless required by applicable law or agreed = to in writing,
>> > > + *  software distributed under the License is = distributed on an
>> > > + *  "AS IS" BASIS, WITHOUT WARRANTIES OR = CONDITIONS OF ANY
>> > > + *  KIND, either express or implied.  See = the License for the
>> > > + *  specific language governing permissions and = limitations
>> > > + *  under the License.
>> > > + *
>> > > + */
>> > > +package = org.apache.directory.server.component.schema;
>> > > +
>> > > +
>> > > +import java.util.ArrayList;
>> > > +import java.util.List;
>> > > +
>> > > +import = org.apache.directory.server.component.ADSConstants;
>> > > +import = org.apache.directory.shared.ldap.model.exception.LdapInvalidAttributeValue= Exception;
>> > > +import = org.apache.directory.shared.ldap.model.exception.LdapInvalidDnException; >> > > +import = org.apache.directory.shared.ldap.model.ldif.LdapLdifException;
>> > > +import = org.apache.directory.shared.ldap.model.ldif.LdifEntry;
>> > > +import org.apache.felix.ipojo.Factory;
>> > > +import = org.apache.felix.ipojo.architecture.PropertyDescription;
>> > > +import org.slf4j.Logger;
>> > > +import org.slf4j.LoggerFactory;
>> > > +
>> > > +
>> > > +public class UserComponentSchemaGenerator implements = ComponentSchemaGenerator
>> > > +{
>> > > +
>> > > +    private static final Logger LOG =3D = LoggerFactory.getLogger( UserComponentSchemaGenerator.class );
>> > > +
>> > > +
>> > > +    @Override
>> > > +    public ADSComponentSchema = generateOrGetSchemaElements( Factory componentFactory )
>> > > +    {
>> > > +        List<LdifEntry> = schemaElements =3D new ArrayList<LdifEntry>();
>> > > +
>> > > +        String componentName =3D = componentFactory.getName();
>> > > +        if ( = componentName.contains( "." ) )
>> > > +        {
>> > > +           =  componentName =3D componentName.substring( = componentName.lastIndexOf( '.' ) + 1 );
>> > > +        }
>> > > +
>> > > +        String schemaDn =3D = ADSConstants.ADS_USER_COMPONENTS_SCHEMA_DN;
>> > > +
>> > > +        String attribsDn =3D = "ou=3DattributeTypes," + schemaDn;
>> > > +        String ocsDn =3D = "ou=3DobjectClasses," + schemaDn;
>> > > +
>> > > +        //Will hold the m-must = attributes while iterating over properties of the component
>> > > +        List<String> = ocAttribs =3D new ArrayList<String>();
>> > > +
>> > > +        // Creating schema = elements with proper order and pushing them into the list
>> > > +        try
>> > > +        {
>> > > +
>> > > +            String = componentBaseOID =3D ComponentOIDGenerator.generateComponentOID();
>> > > +
>> > > +            for ( = PropertyDescription prop : = componentFactory.getComponentDescription().getProperties() )
>> > > +            {
>> > > +
>> > > +               =  //Must be lower case, alphanumeric only
>> > > +               =  String propname =3D prop.getName();
>> > > +
>> > > +               =  String proptype =3D prop.getType();
>> > > +               =  String propoid =3D ComponentOIDGenerator.generateAttribOID( = componentBaseOID );
>> > > +               =  String propdn =3D "m-oid=3D" + propoid + "," + attribsDn;
>> > > +
>> > > +               =  if ( !( proptype.equals( "int" ) || proptype.equals( = "java.lang.String" ) || proptype
>> > > +               =      .equals( "boolean" ) ) )
>> > > +               =  {
>> > > +               =      LOG.info( "Property found with an incompatible type: =  "
>> > > +               =          + propname + ":" + proptype );
>> > > +               =      continue;
>> > > +               =  }
>> > > +
>> > > +               =  String syntax =3D ADSConstants.syntaxMappings.get( proptype );
>> > > +               =  String equality =3D ADSConstants.equalityMappings.get( proptype = );
>> > > +               =  String ordering =3D ADSConstants.orderingMappings.get( proptype = );
>> > > +               =  String substr =3D ADSConstants.substringMappings.get( proptype = );
>> > > +
>> > > +               =  schemaElements.add( new LdifEntry( propdn,
>> > > +               =      "objectclass:metaAttributeType",
>> > > +               =      "objectclass:metaTop",
>> > > +               =      "objectclass:top",
>> > > +               =      "m-oid:" + propoid,
>> > > +               =      "m-name:" + propname,
>> > > +               =      "m-description:Property of component type " + = componentName,
>> > > +               =      "m-equality:" + equality,
>> > > +               =      "m-ordering:" + ordering,
>> > > +               =      "m-substr:" + substr,
>> > > +               =      "m-syntax:" + syntax,
>> > > +               =      "m-length:0",
>> > > +               =      "m-singleValue:TRUE" ) );
>> > > +
>> > > +               =  if ( prop.isMandatory() )
>> > > +               =  {
>> > > +               =      ocAttribs.add( "m-must:" + propname );
>> > > +               =  }
>> > > +               =  else
>> > > +               =  {
>> > > +               =      ocAttribs.add( "m-may:" + propname );
>> > > +               =  }
>> > > +
>> > > +            }
>> > > +
>> > > +           =  schemaElements.add( new LdifEntry( ocsDn,
>> > > +               =  "objectclass:organizationalUnit",
>> > > +               =  "objectClass:top",
>> > > +               =  "ou:objectClasses" ) );
>> > > +
>> > > +            String = ocoid =3D ComponentOIDGenerator.generateOCOID( componentBaseOID );
>> > > +            String = ocDn =3D "m-oid=3D" + ocoid + "," + ocsDn;
>> > > +
>> > > +           =  ocAttribs.add( 0, "m-may:cached" );
>> > > +           =  ocAttribs.add( 0, "m-must:ins" );
>> > > +           =  ocAttribs.add( 0, "m-must:active" );
>> > > +           =  ocAttribs.add( 0, "m-supObjectClass: top" );
>> > > +           =  ocAttribs.add( 0, "m-description:Object Class for generating = instances of:" + componentName );
>> > > +           =  ocAttribs.add( 0, "m-name:" + componentName );
>> > > +           =  ocAttribs.add( 0, "m-oid:" + ocoid );
>> > > +           =  ocAttribs.add( 0, "objectclass: top" );
>> > > +           =  ocAttribs.add( 0, "objectclass: metaTop" );
>> > > +           =  ocAttribs.add( 0, "objectclass: metaObjectClass" );
>> > > +
>> > > +           =  schemaElements.add( new LdifEntry( ocDn, ocAttribs.toArray() ) = );
>> > > +
>> > > +        }
>> > > +        catch ( = LdapInvalidAttributeValueException e )
>> > > +        {
>> > > +            LOG.info( = "ADSSchemaManager#generateSchema: =  Error(LdapInvalidAttributeValueException) while creating LdifEntry = for:  "
>> > > +               =  + componentFactory );
>> > > +        }
>> > > +        catch ( = LdapInvalidDnException e )
>> > > +        {
>> > > +            LOG.info( = "ADSSchemaManager#generateSchema:  Error(LdapInvalidDnException) = while creating LdifEntry for:  "
>> > > +               =  + componentFactory );
>> > > +        }
>> > > +        catch ( = LdapLdifException e )
>> > > +        {
>> > > +            LOG.info( = "ADSSchemaManager#generateSchema:  Error(LdapLdifException) while = creating LdifEntry for:  "
>> > > +               =  + componentFactory );
>> > > +        }
>> > > +
>> > > +        return new = ADSComponentSchema( ADSConstants.ADS_USER_COMPONENTS_SCHEMA_DN, = schemaElements );
>> > > +    }
>> > > +
>> > > +}
>> > >
>> > > Modified: directory/apacheds/trunk/pom.xml
>> > > URL: http://svn.apac= he.org/viewvc/directory/apacheds/trunk/pom.xml?rev=3D1203217&r1=3D1203= 216&r2=3D1203217&view=3Ddiff
>> > > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D
>> > > --- directory/apacheds/trunk/pom.xml (original)
>> > > +++ directory/apacheds/trunk/pom.xml Thu Nov 17 = 15:21:39 2011
>> > > @@ -151,6 +151,7 @@
>> > >     = <module>apache-felix</module>
>> > >     = <module>dependencies</module>
>> > >     = <module>service-osgi</module>
>> > > +   =  <module>component-hub</module>
>> > >   </modules>
>> > >
>> > >   <build>
>> > >
>> > >
>> >
>
>


= --Apple-Mail=_C65DD922-A737-44EF-A602-6825C462238C--