directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From erodrig...@apache.org
Subject svn commit: r265048 - in /directory/sandbox/trunk/osgi-protocol-providers/trunk: dns/src/main/java/org/apache/dns/ ldap/src/main/java/org/apache/ldap/ ntp/src/main/java/org/apache/ntp/
Date Wed, 31 Aug 2005 14:20:21 GMT
Author: erodriguez
Date: Wed Aug 31 07:20:12 2005
New Revision: 265048

URL: http://svn.apache.org/viewcvs?rev=265048&view=rev
Log:
Formatting:  imports, line breaks, whitespace, or other code convention.

Modified:
    directory/sandbox/trunk/osgi-protocol-providers/trunk/dns/src/main/java/org/apache/dns/Activator.java
    directory/sandbox/trunk/osgi-protocol-providers/trunk/dns/src/main/java/org/apache/dns/DnsConfig.java
    directory/sandbox/trunk/osgi-protocol-providers/trunk/dns/src/main/java/org/apache/dns/DnsServer.java
    directory/sandbox/trunk/osgi-protocol-providers/trunk/dns/src/main/java/org/apache/dns/DnsServerFactory.java
    directory/sandbox/trunk/osgi-protocol-providers/trunk/ldap/src/main/java/org/apache/ldap/Activator.java
    directory/sandbox/trunk/osgi-protocol-providers/trunk/ldap/src/main/java/org/apache/ldap/LdapConfig.java
    directory/sandbox/trunk/osgi-protocol-providers/trunk/ldap/src/main/java/org/apache/ldap/LdapServer.java
    directory/sandbox/trunk/osgi-protocol-providers/trunk/ldap/src/main/java/org/apache/ldap/LdapServerFactory.java
    directory/sandbox/trunk/osgi-protocol-providers/trunk/ntp/src/main/java/org/apache/ntp/Activator.java
    directory/sandbox/trunk/osgi-protocol-providers/trunk/ntp/src/main/java/org/apache/ntp/NtpConfig.java
    directory/sandbox/trunk/osgi-protocol-providers/trunk/ntp/src/main/java/org/apache/ntp/NtpServer.java
    directory/sandbox/trunk/osgi-protocol-providers/trunk/ntp/src/main/java/org/apache/ntp/NtpServerFactory.java

Modified: directory/sandbox/trunk/osgi-protocol-providers/trunk/dns/src/main/java/org/apache/dns/Activator.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/osgi-protocol-providers/trunk/dns/src/main/java/org/apache/dns/Activator.java?rev=265048&r1=265047&r2=265048&view=diff
==============================================================================
--- directory/sandbox/trunk/osgi-protocol-providers/trunk/dns/src/main/java/org/apache/dns/Activator.java
(original)
+++ directory/sandbox/trunk/osgi-protocol-providers/trunk/dns/src/main/java/org/apache/dns/Activator.java
Wed Aug 31 07:20:12 2005
@@ -48,21 +48,20 @@
      * starts this service.
      * @param context the framework context for the bundle.
      */
-    public void start(BundleContext context)
+    public void start( BundleContext context )
     {
-        System.out.println("Starting Apache DNS.");
+        System.out.println( "Starting Apache DNS." );
 
-        tracker = new ServiceTracker(context, ServiceRegistry.class.getName(), null);
+        tracker = new ServiceTracker( context, ServiceRegistry.class.getName(), null );
         tracker.open();
 
         registry = (ServiceRegistry) tracker.getService();
 
-        serverFactory = new DnsServerFactory(registry);
+        serverFactory = new DnsServerFactory( registry );
 
         Dictionary parameters = new Hashtable();
-        parameters.put(ConfigurationAdmin.SERVICE_FACTORYPID, FACTORY_PID);
-        registration = context.registerService(ManagedServiceFactory.class.getName(),
-                serverFactory, parameters);
+        parameters.put( ConfigurationAdmin.SERVICE_FACTORYPID, FACTORY_PID );
+        registration = context.registerService( ManagedServiceFactory.class.getName(), serverFactory,
parameters );
 
         ServiceReference adminRef = null;
         try
@@ -71,38 +70,37 @@
             Configuration[] configs = null;
             try
             {
-                adminRef = context.getServiceReference(ConfigurationAdmin.class.getName());
+                adminRef = context.getServiceReference( ConfigurationAdmin.class.getName()
);
 
                 // Potential start order problem!
-                if (adminRef != null)
+                if ( adminRef != null )
                 {
-                    admin = (ConfigurationAdmin) context.getService(adminRef);
-                    String filter = "(&(service.factoryPid=" + FACTORY_PID + ")"
-                            + "(|(service.bundleLocation=" + context.getBundle().getLocation()
-                            + ")" + "(service.bundleLocation=NULL)"
+                    admin = (ConfigurationAdmin) context.getService( adminRef );
+                    String filter = "(&(service.factoryPid=" + FACTORY_PID + ")" + "(|(service.bundleLocation="
+                            + context.getBundle().getLocation() + ")" + "(service.bundleLocation=NULL)"
                             + "(!(service.bundleLocation=*))))";
-                    configs = admin.listConfigurations(filter);
+                    configs = admin.listConfigurations( filter );
                 }
             }
-            catch (Exception e)
+            catch ( Exception e )
             {
                 e.printStackTrace();
             }
 
-            if (admin == null || configs == null || configs.length == 0)
+            if ( admin == null || configs == null || configs.length == 0 )
             {
-                serverFactory.updated(DnsServerFactory.DEFAULT_PID, DnsConfig.getDefaultConfig());
+                serverFactory.updated( DnsServerFactory.DEFAULT_PID, DnsConfig.getDefaultConfig()
);
             }
         }
-        catch (ConfigurationException ce)
+        catch ( ConfigurationException ce )
         {
             ce.printStackTrace();
         }
         finally
         {
-            if (adminRef != null)
+            if ( adminRef != null )
             {
-                context.ungetService(adminRef);
+                context.ungetService( adminRef );
             }
         }
     }
@@ -111,9 +109,9 @@
      * Implements BundleActivator.stop(). Logs that this service has stopped.
      * @param context the framework context for the bundle.
      */
-    public void stop(BundleContext context)
+    public void stop( BundleContext context )
     {
-        System.out.println("Stopping Apache DNS.");
+        System.out.println( "Stopping Apache DNS." );
 
         registration.unregister();
         registration = null;

Modified: directory/sandbox/trunk/osgi-protocol-providers/trunk/dns/src/main/java/org/apache/dns/DnsConfig.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/osgi-protocol-providers/trunk/dns/src/main/java/org/apache/dns/DnsConfig.java?rev=265048&r1=265047&r2=265048&view=diff
==============================================================================
--- directory/sandbox/trunk/osgi-protocol-providers/trunk/dns/src/main/java/org/apache/dns/DnsConfig.java
(original)
+++ directory/sandbox/trunk/osgi-protocol-providers/trunk/dns/src/main/java/org/apache/dns/DnsConfig.java
Wed Aug 31 07:20:12 2005
@@ -31,23 +31,23 @@
 
     private int port;
 
-    public DnsConfig(Dictionary configuration)
+    public DnsConfig( Dictionary configuration )
     {
-        System.out.println("Got props " + configuration);
+        System.out.println( "Got props " + configuration );
 
-        if (configuration == null)
+        if ( configuration == null )
         {
             configuration = getDefaultConfig();
         }
 
-        port = ((Integer) configuration.get(DNS_PORT_KEY)).intValue();
+        port = ( (Integer) configuration.get( DNS_PORT_KEY ) ).intValue();
 
-        System.out.println("DNS got port " + port);
+        System.out.println( "DNS got port " + port );
     }
 
-    boolean isDifferent(Dictionary config)
+    boolean isDifferent( Dictionary config )
     {
-        if (port == ((Integer) config.get(DNS_PORT_KEY)).intValue())
+        if ( port == ( (Integer) config.get( DNS_PORT_KEY ) ).intValue() )
         {
             return false;
         }
@@ -62,7 +62,7 @@
 
     int getPort()
     {
-        System.out.println("Config returning " + port);
+        System.out.println( "Config returning " + port );
 
         return port;
     }
@@ -71,8 +71,8 @@
     {
         Dictionary defaults = new Hashtable();
 
-        defaults.put(SERVICE_PID, PID);
-        defaults.put(DNS_PORT_KEY, Integer.getInteger(DNS_PORT_KEY, new Integer(DNS_PORT_DEFAULT)));
+        defaults.put( SERVICE_PID, PID );
+        defaults.put( DNS_PORT_KEY, Integer.getInteger( DNS_PORT_KEY, new Integer( DNS_PORT_DEFAULT
) ) );
 
         return defaults;
     }

Modified: directory/sandbox/trunk/osgi-protocol-providers/trunk/dns/src/main/java/org/apache/dns/DnsServer.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/osgi-protocol-providers/trunk/dns/src/main/java/org/apache/dns/DnsServer.java?rev=265048&r1=265047&r2=265048&view=diff
==============================================================================
--- directory/sandbox/trunk/osgi-protocol-providers/trunk/dns/src/main/java/org/apache/dns/DnsServer.java
(original)
+++ directory/sandbox/trunk/osgi-protocol-providers/trunk/dns/src/main/java/org/apache/dns/DnsServer.java
Wed Aug 31 07:20:12 2005
@@ -38,7 +38,7 @@
     private String name;
     private int port = -1;
 
-    public DnsServer(DnsConfig config, ServiceRegistry registry)
+    public DnsServer( DnsConfig config, ServiceRegistry registry )
     {
         this.config = config;
         this.registry = registry;
@@ -53,39 +53,39 @@
 
         try
         {
-            System.out.println(name + " starting on " + port);
+            System.out.println( name + " starting on " + port );
 
             provider = new DnsProtocolProvider();
 
-            udpService = new Service(name, TransportType.DATAGRAM, port);
-            tcpService = new Service(name, TransportType.SOCKET, port);
+            udpService = new Service( name, TransportType.DATAGRAM, port );
+            tcpService = new Service( name, TransportType.SOCKET, port );
 
-            registry.bind(udpService, provider);
-            registry.bind(tcpService, provider);
+            registry.bind( udpService, provider );
+            registry.bind( tcpService, provider );
 
-            System.out.println(name + " listening on port " + port);
+            System.out.println( name + " listening on port " + port );
         }
-        catch (IOException ioe)
+        catch ( IOException ioe )
         {
             ioe.printStackTrace();
         }
     }
 
-    public boolean isDifferent(Dictionary newConfig)
+    public boolean isDifferent( Dictionary newConfig )
     {
-        return config.isDifferent(newConfig);
+        return config.isDifferent( newConfig );
     }
 
     public void destroy()
     {
-        registry.unbind(udpService);
-        registry.unbind(tcpService);
+        registry.unbind( udpService );
+        registry.unbind( tcpService );
 
         registry = null;
         provider = null;
         udpService = null;
         tcpService = null;
 
-        System.out.println(name + " has stopped listening on " + port);
+        System.out.println( name + " has stopped listening on " + port );
     }
 }

Modified: directory/sandbox/trunk/osgi-protocol-providers/trunk/dns/src/main/java/org/apache/dns/DnsServerFactory.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/osgi-protocol-providers/trunk/dns/src/main/java/org/apache/dns/DnsServerFactory.java?rev=265048&r1=265047&r2=265048&view=diff
==============================================================================
--- directory/sandbox/trunk/osgi-protocol-providers/trunk/dns/src/main/java/org/apache/dns/DnsServerFactory.java
(original)
+++ directory/sandbox/trunk/osgi-protocol-providers/trunk/dns/src/main/java/org/apache/dns/DnsServerFactory.java
Wed Aug 31 07:20:12 2005
@@ -35,7 +35,7 @@
 
     Object updateLock = new Object();
 
-    DnsServerFactory(ServiceRegistry registry)
+    DnsServerFactory( ServiceRegistry registry )
     {
         this.registry = registry;
     }
@@ -43,63 +43,63 @@
     public void destroy()
     {
         Iterator it = servers.keySet().iterator();
-        while (it.hasNext())
+        while ( it.hasNext() )
         {
-            deleted((String) it.next());
+            deleted( (String) it.next() );
         }
     }
 
-    public void updated(String pid, Dictionary config) throws ConfigurationException
+    public void updated( String pid, Dictionary config ) throws ConfigurationException
     {
-        int port = ((Integer) config.get(DnsConfig.DNS_PORT_KEY)).intValue();
+        int port = ( (Integer) config.get( DnsConfig.DNS_PORT_KEY ) ).intValue();
 
-        if (port < 1 || port > 0xFFFF)
+        if ( port < 1 || port > 0xFFFF )
         {
-            throw new ConfigurationException(DnsConfig.DNS_PORT_KEY, "invalid value=" + port);
+            throw new ConfigurationException( DnsConfig.DNS_PORT_KEY, "invalid value=" +
port );
         }
 
-        synchronized (updateLock)
+        synchronized ( updateLock )
         {
-            if (DEFAULT_PID.equals(pid) && servers.size() > 0)
+            if ( DEFAULT_PID.equals( pid ) && servers.size() > 0 )
             {
                 return;
             }
 
             // As soon as we get a "non-default"-config, delete default
-            if (!DEFAULT_PID.equals(pid) && (null != servers.get(DEFAULT_PID)))
+            if ( !DEFAULT_PID.equals( pid ) && ( null != servers.get( DEFAULT_PID
) ) )
             {
-                deleted(DEFAULT_PID);
+                deleted( DEFAULT_PID );
             }
 
             // for a given pid-config, do we have the service?
             // if not, create it with the config
-            DnsServer dnsServer = (DnsServer) servers.get(pid);
-            if (dnsServer == null)
+            DnsServer dnsServer = (DnsServer) servers.get( pid );
+            if ( dnsServer == null )
             {
-                dnsServer = new DnsServer(new DnsConfig(config), registry);
-                servers.put(pid, dnsServer);
+                dnsServer = new DnsServer( new DnsConfig( config ), registry );
+                servers.put( pid, dnsServer );
             }
             else
             {
                 // we have the service, so ...
                 // for a given config, is the config different?
-                if (dnsServer.isDifferent(config))
+                if ( dnsServer.isDifferent( config ) )
                 {
                     // the config for this service is different, so ...
                     // destroy the listener and recreate it with the new config.
-                    deleted(pid);
-                    dnsServer = new DnsServer(new DnsConfig(config), registry);
-                    servers.put(pid, dnsServer);
+                    deleted( pid );
+                    dnsServer = new DnsServer( new DnsConfig( config ), registry );
+                    servers.put( pid, dnsServer );
                 }
             }
         }
     }
 
-    public void deleted(String pid)
+    public void deleted( String pid )
     {
-        DnsServer dnsServer = (DnsServer) servers.remove(pid);
+        DnsServer dnsServer = (DnsServer) servers.remove( pid );
 
-        if (dnsServer != null)
+        if ( dnsServer != null )
         {
             dnsServer.destroy();
         }

Modified: directory/sandbox/trunk/osgi-protocol-providers/trunk/ldap/src/main/java/org/apache/ldap/Activator.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/osgi-protocol-providers/trunk/ldap/src/main/java/org/apache/ldap/Activator.java?rev=265048&r1=265047&r2=265048&view=diff
==============================================================================
--- directory/sandbox/trunk/osgi-protocol-providers/trunk/ldap/src/main/java/org/apache/ldap/Activator.java
(original)
+++ directory/sandbox/trunk/osgi-protocol-providers/trunk/ldap/src/main/java/org/apache/ldap/Activator.java
Wed Aug 31 07:20:12 2005
@@ -52,31 +52,29 @@
      * Logs that this service is starting and starts this service.
      * @param context the framework context for the bundle.
      */
-    public void start(BundleContext context) throws BundleException
+    public void start( BundleContext context ) throws BundleException
     {
-        System.out.println("Starting Apache LDAP.");
+        System.out.println( "Starting Apache LDAP." );
 
-        tracker = new ServiceTracker(context, ServiceRegistry.class.getName(), null);
+        tracker = new ServiceTracker( context, ServiceRegistry.class.getName(), null );
         tracker.open();
 
         registry = (ServiceRegistry) tracker.getService();
 
-        ServiceReference storeReference = context.getServiceReference(InitialContextFactory.class
-                .getName());
+        ServiceReference storeReference = context.getServiceReference( InitialContextFactory.class.getName()
);
 
-        InitialContextFactory factory = (InitialContextFactory) context.getService(storeReference);
+        InitialContextFactory factory = (InitialContextFactory) context.getService( storeReference
);
 
         Hashtable env = new Hashtable();
-        loadEnvironment(env);
+        loadEnvironment( env );
 
-        env.put("server.use.factory.instance", factory);
+        env.put( "server.use.factory.instance", factory );
 
-        serverFactory = new LdapServerFactory(registry, env);
+        serverFactory = new LdapServerFactory( registry, env );
 
         Dictionary parameters = new Hashtable();
-        parameters.put(ConfigurationAdmin.SERVICE_FACTORYPID, FACTORY_PID);
-        registration = context.registerService(ManagedServiceFactory.class.getName(),
-                serverFactory, parameters);
+        parameters.put( ConfigurationAdmin.SERVICE_FACTORYPID, FACTORY_PID );
+        registration = context.registerService( ManagedServiceFactory.class.getName(), serverFactory,
parameters );
 
         ServiceReference adminRef = null;
         try
@@ -85,38 +83,37 @@
             Configuration[] configs = null;
             try
             {
-                adminRef = context.getServiceReference(ConfigurationAdmin.class.getName());
+                adminRef = context.getServiceReference( ConfigurationAdmin.class.getName()
);
 
                 // Potential start order problem!
-                if (adminRef != null)
+                if ( adminRef != null )
                 {
-                    admin = (ConfigurationAdmin) context.getService(adminRef);
-                    String filter = "(&(service.factoryPid=" + FACTORY_PID + ")"
-                            + "(|(service.bundleLocation=" + context.getBundle().getLocation()
-                            + ")" + "(service.bundleLocation=NULL)"
+                    admin = (ConfigurationAdmin) context.getService( adminRef );
+                    String filter = "(&(service.factoryPid=" + FACTORY_PID + ")" + "(|(service.bundleLocation="
+                            + context.getBundle().getLocation() + ")" + "(service.bundleLocation=NULL)"
                             + "(!(service.bundleLocation=*))))";
-                    configs = admin.listConfigurations(filter);
+                    configs = admin.listConfigurations( filter );
                 }
             }
-            catch (Exception e)
+            catch ( Exception e )
             {
                 e.printStackTrace();
             }
 
-            if (admin == null || configs == null || configs.length == 0)
+            if ( admin == null || configs == null || configs.length == 0 )
             {
-                serverFactory.updated(LdapServerFactory.DEFAULT_PID, LdapConfig.getDefaultConfig());
+                serverFactory.updated( LdapServerFactory.DEFAULT_PID, LdapConfig.getDefaultConfig()
);
             }
         }
-        catch (ConfigurationException ce)
+        catch ( ConfigurationException ce )
         {
             ce.printStackTrace();
         }
         finally
         {
-            if (adminRef != null)
+            if ( adminRef != null )
             {
-                context.ungetService(adminRef);
+                context.ungetService( adminRef );
             }
         }
     }
@@ -126,9 +123,9 @@
      * Logs that this service has stopped.
      * @param context the framework context for the bundle.
      */
-    public void stop(BundleContext context)
+    public void stop( BundleContext context )
     {
-        System.out.println("Stopping Apache LDAP.");
+        System.out.println( "Stopping Apache LDAP." );
 
         registration.unregister();
         registration = null;
@@ -139,17 +136,17 @@
         registry = null;
     }
 
-    private void loadEnvironment(Hashtable env)
+    private void loadEnvironment( Hashtable env )
     {
-        env.put("java.naming.provider.url", "ou=system");
-        env.put("java.naming.security.principal", "uid=admin,ou=system");
-        env.put("java.naming.security.authentication", "simple");
-        env.put("java.naming.security.credentials", "secret");
-        env.put("java.naming.factory.initial", "org.apache.ldap.server.jndi.CoreContextFactory");
-
-        env.put("asn.1.berlib.provider", "org.apache.ldap.common.berlib.asn1.SnickersProvider");
-        env.put("server.disable.anonymous", "true");
-        env.put("server.net.ldap.port", "389");
-        env.put("server.net.ldaps.port", "636");
+        env.put( "java.naming.provider.url", "ou=system" );
+        env.put( "java.naming.security.principal", "uid=admin,ou=system" );
+        env.put( "java.naming.security.authentication", "simple" );
+        env.put( "java.naming.security.credentials", "secret" );
+        env.put( "java.naming.factory.initial", "org.apache.ldap.server.jndi.CoreContextFactory"
);
+
+        env.put( "asn.1.berlib.provider", "org.apache.ldap.common.berlib.asn1.SnickersProvider"
);
+        env.put( "server.disable.anonymous", "true" );
+        env.put( "server.net.ldap.port", "389" );
+        env.put( "server.net.ldaps.port", "636" );
     }
 }

Modified: directory/sandbox/trunk/osgi-protocol-providers/trunk/ldap/src/main/java/org/apache/ldap/LdapConfig.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/osgi-protocol-providers/trunk/ldap/src/main/java/org/apache/ldap/LdapConfig.java?rev=265048&r1=265047&r2=265048&view=diff
==============================================================================
--- directory/sandbox/trunk/osgi-protocol-providers/trunk/ldap/src/main/java/org/apache/ldap/LdapConfig.java
(original)
+++ directory/sandbox/trunk/osgi-protocol-providers/trunk/ldap/src/main/java/org/apache/ldap/LdapConfig.java
Wed Aug 31 07:20:12 2005
@@ -32,23 +32,23 @@
 
     private int port;
 
-    public LdapConfig(Dictionary configuration)
+    public LdapConfig( Dictionary configuration )
     {
-        System.out.println("Got props " + configuration);
+        System.out.println( "Got props " + configuration );
 
-        if (configuration == null)
+        if ( configuration == null )
         {
             configuration = getDefaultConfig();
         }
 
-        port = ((Integer) configuration.get(LDAP_PORT_KEY)).intValue();
+        port = ( (Integer) configuration.get( LDAP_PORT_KEY ) ).intValue();
 
-        System.out.println("LDAP got port " + port);
+        System.out.println( "LDAP got port " + port );
     }
 
-    boolean isDifferent(Dictionary config)
+    boolean isDifferent( Dictionary config )
     {
-        if (port == ((Integer) config.get(LDAP_PORT_KEY)).intValue())
+        if ( port == ( (Integer) config.get( LDAP_PORT_KEY ) ).intValue() )
         {
             return false;
         }
@@ -63,7 +63,7 @@
 
     int getPort()
     {
-        System.out.println("Config returning " + port);
+        System.out.println( "Config returning " + port );
 
         return port;
     }
@@ -72,9 +72,8 @@
     {
         Dictionary defaults = new Hashtable();
 
-        defaults.put(SERVICE_PID, PID);
-        defaults.put(LDAP_PORT_KEY, Integer.getInteger(LDAP_PORT_KEY,
-                new Integer(LDAP_PORT_DEFAULT)));
+        defaults.put( SERVICE_PID, PID );
+        defaults.put( LDAP_PORT_KEY, Integer.getInteger( LDAP_PORT_KEY, new Integer( LDAP_PORT_DEFAULT
) ) );
 
         return defaults;
     }

Modified: directory/sandbox/trunk/osgi-protocol-providers/trunk/ldap/src/main/java/org/apache/ldap/LdapServer.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/osgi-protocol-providers/trunk/ldap/src/main/java/org/apache/ldap/LdapServer.java?rev=265048&r1=265047&r2=265048&view=diff
==============================================================================
--- directory/sandbox/trunk/osgi-protocol-providers/trunk/ldap/src/main/java/org/apache/ldap/LdapServer.java
(original)
+++ directory/sandbox/trunk/osgi-protocol-providers/trunk/ldap/src/main/java/org/apache/ldap/LdapServer.java
Wed Aug 31 07:20:12 2005
@@ -38,7 +38,7 @@
     private String name;
     private int port = -1;
 
-    public LdapServer(LdapConfig config, ServiceRegistry registry, Hashtable env)
+    public LdapServer( LdapConfig config, ServiceRegistry registry, Hashtable env )
     {
         this.config = config;
         this.registry = registry;
@@ -54,35 +54,35 @@
 
         try
         {
-            System.out.println(name + " starting on " + port);
+            System.out.println( name + " starting on " + port );
 
-            provider = new LdapProtocolProvider((Hashtable) env.clone());
+            provider = new LdapProtocolProvider( (Hashtable) env.clone() );
 
-            tcpService = new Service(name, TransportType.SOCKET, port);
+            tcpService = new Service( name, TransportType.SOCKET, port );
 
-            registry.bind(tcpService, provider);
+            registry.bind( tcpService, provider );
 
-            System.out.println(name + " listening on port " + port);
+            System.out.println( name + " listening on port " + port );
         }
-        catch (Exception e)
+        catch ( Exception e )
         {
             e.printStackTrace();
         }
     }
 
-    public boolean isDifferent(Dictionary newConfig)
+    public boolean isDifferent( Dictionary newConfig )
     {
-        return config.isDifferent(newConfig);
+        return config.isDifferent( newConfig );
     }
 
     public void destroy()
     {
-        registry.unbind(tcpService);
+        registry.unbind( tcpService );
 
         registry = null;
         provider = null;
         tcpService = null;
 
-        System.out.println(name + " has stopped listening on " + port);
+        System.out.println( name + " has stopped listening on " + port );
     }
 }

Modified: directory/sandbox/trunk/osgi-protocol-providers/trunk/ldap/src/main/java/org/apache/ldap/LdapServerFactory.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/osgi-protocol-providers/trunk/ldap/src/main/java/org/apache/ldap/LdapServerFactory.java?rev=265048&r1=265047&r2=265048&view=diff
==============================================================================
--- directory/sandbox/trunk/osgi-protocol-providers/trunk/ldap/src/main/java/org/apache/ldap/LdapServerFactory.java
(original)
+++ directory/sandbox/trunk/osgi-protocol-providers/trunk/ldap/src/main/java/org/apache/ldap/LdapServerFactory.java
Wed Aug 31 07:20:12 2005
@@ -37,7 +37,7 @@
 
     Object updateLock = new Object();
 
-    LdapServerFactory(ServiceRegistry registry, Hashtable env)
+    LdapServerFactory( ServiceRegistry registry, Hashtable env )
     {
         this.registry = registry;
         this.env = env;
@@ -46,63 +46,63 @@
     public void destroy()
     {
         Iterator it = servers.keySet().iterator();
-        while (it.hasNext())
+        while ( it.hasNext() )
         {
-            deleted((String) it.next());
+            deleted( (String) it.next() );
         }
     }
 
-    public void updated(String pid, Dictionary config) throws ConfigurationException
+    public void updated( String pid, Dictionary config ) throws ConfigurationException
     {
-        int port = ((Integer) config.get(LdapConfig.LDAP_PORT_KEY)).intValue();
+        int port = ( (Integer) config.get( LdapConfig.LDAP_PORT_KEY ) ).intValue();
 
-        if (port < 1 || port > 0xFFFF)
+        if ( port < 1 || port > 0xFFFF )
         {
-            throw new ConfigurationException(LdapConfig.LDAP_PORT_KEY, "invalid value=" +
port);
+            throw new ConfigurationException( LdapConfig.LDAP_PORT_KEY, "invalid value="
+ port );
         }
 
-        synchronized (updateLock)
+        synchronized ( updateLock )
         {
-            if (DEFAULT_PID.equals(pid) && servers.size() > 0)
+            if ( DEFAULT_PID.equals( pid ) && servers.size() > 0 )
             {
                 return;
             }
 
             // As soon as we get a "non-default"-config, delete default
-            if (!DEFAULT_PID.equals(pid) && (null != servers.get(DEFAULT_PID)))
+            if ( !DEFAULT_PID.equals( pid ) && ( null != servers.get( DEFAULT_PID
) ) )
             {
-                deleted(DEFAULT_PID);
+                deleted( DEFAULT_PID );
             }
 
             // for a given pid-config, do we have the service?
             // if not, create it with the config
-            LdapServer server = (LdapServer) servers.get(pid);
-            if (server == null)
+            LdapServer server = (LdapServer) servers.get( pid );
+            if ( server == null )
             {
-                server = new LdapServer(new LdapConfig(config), registry, env);
-                servers.put(pid, server);
+                server = new LdapServer( new LdapConfig( config ), registry, env );
+                servers.put( pid, server );
             }
             else
             {
                 // we have the service, so ...
                 // for a given config, is the config different?
-                if (server.isDifferent(config))
+                if ( server.isDifferent( config ) )
                 {
                     // the config for this service is different, so ...
                     // destroy the listener and recreate it with the new config.
-                    deleted(pid);
-                    server = new LdapServer(new LdapConfig(config), registry, env);
-                    servers.put(pid, server);
+                    deleted( pid );
+                    server = new LdapServer( new LdapConfig( config ), registry, env );
+                    servers.put( pid, server );
                 }
             }
         }
     }
 
-    public void deleted(String pid)
+    public void deleted( String pid )
     {
-        LdapServer server = (LdapServer) servers.remove(pid);
+        LdapServer server = (LdapServer) servers.remove( pid );
 
-        if (server != null)
+        if ( server != null )
         {
             server.destroy();
         }

Modified: directory/sandbox/trunk/osgi-protocol-providers/trunk/ntp/src/main/java/org/apache/ntp/Activator.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/osgi-protocol-providers/trunk/ntp/src/main/java/org/apache/ntp/Activator.java?rev=265048&r1=265047&r2=265048&view=diff
==============================================================================
--- directory/sandbox/trunk/osgi-protocol-providers/trunk/ntp/src/main/java/org/apache/ntp/Activator.java
(original)
+++ directory/sandbox/trunk/osgi-protocol-providers/trunk/ntp/src/main/java/org/apache/ntp/Activator.java
Wed Aug 31 07:20:12 2005
@@ -48,21 +48,20 @@
      * starts this service.
      * @param context the framework context for the bundle.
      */
-    public void start(BundleContext context)
+    public void start( BundleContext context )
     {
-        System.out.println("Starting Apache NTP.");
+        System.out.println( "Starting Apache NTP." );
 
-        tracker = new ServiceTracker(context, ServiceRegistry.class.getName(), null);
+        tracker = new ServiceTracker( context, ServiceRegistry.class.getName(), null );
         tracker.open();
 
         registry = (ServiceRegistry) tracker.getService();
 
-        serverFactory = new NtpServerFactory(registry);
+        serverFactory = new NtpServerFactory( registry );
 
         Dictionary parameters = new Hashtable();
-        parameters.put(ConfigurationAdmin.SERVICE_FACTORYPID, FACTORY_PID);
-        registration = context.registerService(ManagedServiceFactory.class.getName(),
-                serverFactory, parameters);
+        parameters.put( ConfigurationAdmin.SERVICE_FACTORYPID, FACTORY_PID );
+        registration = context.registerService( ManagedServiceFactory.class.getName(), serverFactory,
parameters );
 
         ServiceReference adminRef = null;
         try
@@ -71,38 +70,37 @@
             Configuration[] configs = null;
             try
             {
-                adminRef = context.getServiceReference(ConfigurationAdmin.class.getName());
+                adminRef = context.getServiceReference( ConfigurationAdmin.class.getName()
);
 
                 // Potential start order problem!
-                if (adminRef != null)
+                if ( adminRef != null )
                 {
-                    admin = (ConfigurationAdmin) context.getService(adminRef);
-                    String filter = "(&(service.factoryPid=" + FACTORY_PID + ")"
-                            + "(|(service.bundleLocation=" + context.getBundle().getLocation()
-                            + ")" + "(service.bundleLocation=NULL)"
+                    admin = (ConfigurationAdmin) context.getService( adminRef );
+                    String filter = "(&(service.factoryPid=" + FACTORY_PID + ")" + "(|(service.bundleLocation="
+                            + context.getBundle().getLocation() + ")" + "(service.bundleLocation=NULL)"
                             + "(!(service.bundleLocation=*))))";
-                    configs = admin.listConfigurations(filter);
+                    configs = admin.listConfigurations( filter );
                 }
             }
-            catch (Exception e)
+            catch ( Exception e )
             {
                 e.printStackTrace();
             }
 
-            if (admin == null || configs == null || configs.length == 0)
+            if ( admin == null || configs == null || configs.length == 0 )
             {
-                serverFactory.updated(NtpServerFactory.DEFAULT_PID, NtpConfig.getDefaultConfig());
+                serverFactory.updated( NtpServerFactory.DEFAULT_PID, NtpConfig.getDefaultConfig()
);
             }
         }
-        catch (ConfigurationException ce)
+        catch ( ConfigurationException ce )
         {
             ce.printStackTrace();
         }
         finally
         {
-            if (adminRef != null)
+            if ( adminRef != null )
             {
-                context.ungetService(adminRef);
+                context.ungetService( adminRef );
             }
         }
     }
@@ -111,9 +109,9 @@
      * Implements BundleActivator.stop(). Logs that this service has stopped.
      * @param context the framework context for the bundle.
      */
-    public void stop(BundleContext context)
+    public void stop( BundleContext context )
     {
-        System.out.println("Stopping Apache NTP.");
+        System.out.println( "Stopping Apache NTP." );
 
         registration.unregister();
         registration = null;

Modified: directory/sandbox/trunk/osgi-protocol-providers/trunk/ntp/src/main/java/org/apache/ntp/NtpConfig.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/osgi-protocol-providers/trunk/ntp/src/main/java/org/apache/ntp/NtpConfig.java?rev=265048&r1=265047&r2=265048&view=diff
==============================================================================
--- directory/sandbox/trunk/osgi-protocol-providers/trunk/ntp/src/main/java/org/apache/ntp/NtpConfig.java
(original)
+++ directory/sandbox/trunk/osgi-protocol-providers/trunk/ntp/src/main/java/org/apache/ntp/NtpConfig.java
Wed Aug 31 07:20:12 2005
@@ -31,23 +31,23 @@
 
     private int port;
 
-    public NtpConfig(Dictionary configuration)
+    public NtpConfig( Dictionary configuration )
     {
-        System.out.println("Got props " + configuration);
+        System.out.println( "Got props " + configuration );
 
-        if (configuration == null)
+        if ( configuration == null )
         {
             configuration = getDefaultConfig();
         }
 
-        port = ((Integer) configuration.get(NTP_PORT_KEY)).intValue();
+        port = ( (Integer) configuration.get( NTP_PORT_KEY ) ).intValue();
 
-        System.out.println("NTP got port " + port);
+        System.out.println( "NTP got port " + port );
     }
 
-    boolean isDifferent(Dictionary config)
+    boolean isDifferent( Dictionary config )
     {
-        if (port == ((Integer) config.get(NTP_PORT_KEY)).intValue())
+        if ( port == ( (Integer) config.get( NTP_PORT_KEY ) ).intValue() )
         {
             return false;
         }
@@ -62,7 +62,7 @@
 
     int getPort()
     {
-        System.out.println("Config returning " + port);
+        System.out.println( "Config returning " + port );
 
         return port;
     }
@@ -71,8 +71,8 @@
     {
         Dictionary defaults = new Hashtable();
 
-        defaults.put(SERVICE_PID, PID);
-        defaults.put(NTP_PORT_KEY, Integer.getInteger(NTP_PORT_KEY, new Integer(NTP_PORT_DEFAULT)));
+        defaults.put( SERVICE_PID, PID );
+        defaults.put( NTP_PORT_KEY, Integer.getInteger( NTP_PORT_KEY, new Integer( NTP_PORT_DEFAULT
) ) );
 
         return defaults;
     }

Modified: directory/sandbox/trunk/osgi-protocol-providers/trunk/ntp/src/main/java/org/apache/ntp/NtpServer.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/osgi-protocol-providers/trunk/ntp/src/main/java/org/apache/ntp/NtpServer.java?rev=265048&r1=265047&r2=265048&view=diff
==============================================================================
--- directory/sandbox/trunk/osgi-protocol-providers/trunk/ntp/src/main/java/org/apache/ntp/NtpServer.java
(original)
+++ directory/sandbox/trunk/osgi-protocol-providers/trunk/ntp/src/main/java/org/apache/ntp/NtpServer.java
Wed Aug 31 07:20:12 2005
@@ -38,7 +38,7 @@
     private String name;
     private int port = -1;
 
-    public NtpServer(NtpConfig config, ServiceRegistry registry)
+    public NtpServer( NtpConfig config, ServiceRegistry registry )
     {
         this.config = config;
         this.registry = registry;
@@ -53,39 +53,39 @@
 
         try
         {
-            System.out.println(name + " starting on " + port);
+            System.out.println( name + " starting on " + port );
 
             provider = new NtpProtocolProvider();
 
-            udpService = new Service(name, TransportType.DATAGRAM, port);
-            tcpService = new Service(name, TransportType.SOCKET, port);
+            udpService = new Service( name, TransportType.DATAGRAM, port );
+            tcpService = new Service( name, TransportType.SOCKET, port );
 
-            registry.bind(udpService, provider);
-            registry.bind(tcpService, provider);
+            registry.bind( udpService, provider );
+            registry.bind( tcpService, provider );
 
-            System.out.println(name + " listening on port " + port);
+            System.out.println( name + " listening on port " + port );
         }
-        catch (IOException ioe)
+        catch ( IOException ioe )
         {
             ioe.printStackTrace();
         }
     }
 
-    public boolean isDifferent(Dictionary newConfig)
+    public boolean isDifferent( Dictionary newConfig )
     {
-        return config.isDifferent(newConfig);
+        return config.isDifferent( newConfig );
     }
 
     public void destroy()
     {
-        registry.unbind(udpService);
-        registry.unbind(tcpService);
+        registry.unbind( udpService );
+        registry.unbind( tcpService );
 
         registry = null;
         provider = null;
         udpService = null;
         tcpService = null;
 
-        System.out.println(name + " has stopped listening on " + port);
+        System.out.println( name + " has stopped listening on " + port );
     }
 }

Modified: directory/sandbox/trunk/osgi-protocol-providers/trunk/ntp/src/main/java/org/apache/ntp/NtpServerFactory.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/osgi-protocol-providers/trunk/ntp/src/main/java/org/apache/ntp/NtpServerFactory.java?rev=265048&r1=265047&r2=265048&view=diff
==============================================================================
--- directory/sandbox/trunk/osgi-protocol-providers/trunk/ntp/src/main/java/org/apache/ntp/NtpServerFactory.java
(original)
+++ directory/sandbox/trunk/osgi-protocol-providers/trunk/ntp/src/main/java/org/apache/ntp/NtpServerFactory.java
Wed Aug 31 07:20:12 2005
@@ -35,7 +35,7 @@
 
     Object updateLock = new Object();
 
-    NtpServerFactory(ServiceRegistry registry)
+    NtpServerFactory( ServiceRegistry registry )
     {
         this.registry = registry;
     }
@@ -43,63 +43,63 @@
     public void destroy()
     {
         Iterator it = servers.keySet().iterator();
-        while (it.hasNext())
+        while ( it.hasNext() )
         {
-            deleted((String) it.next());
+            deleted( (String) it.next() );
         }
     }
 
-    public void updated(String pid, Dictionary config) throws ConfigurationException
+    public void updated( String pid, Dictionary config ) throws ConfigurationException
     {
-        int port = ((Integer) config.get(NtpConfig.NTP_PORT_KEY)).intValue();
+        int port = ( (Integer) config.get( NtpConfig.NTP_PORT_KEY ) ).intValue();
 
-        if (port < 1 || port > 0xFFFF)
+        if ( port < 1 || port > 0xFFFF )
         {
-            throw new ConfigurationException(NtpConfig.NTP_PORT_KEY, "invalid value=" + port);
+            throw new ConfigurationException( NtpConfig.NTP_PORT_KEY, "invalid value=" +
port );
         }
 
-        synchronized (updateLock)
+        synchronized ( updateLock )
         {
-            if (DEFAULT_PID.equals(pid) && servers.size() > 0)
+            if ( DEFAULT_PID.equals( pid ) && servers.size() > 0 )
             {
                 return;
             }
 
             // As soon as we get a "non-default"-config, delete default
-            if (!DEFAULT_PID.equals(pid) && (null != servers.get(DEFAULT_PID)))
+            if ( !DEFAULT_PID.equals( pid ) && ( null != servers.get( DEFAULT_PID
) ) )
             {
-                deleted(DEFAULT_PID);
+                deleted( DEFAULT_PID );
             }
 
             // for a given pid-config, do we have the service?
             // if not, create it with the config
-            NtpServer ntpServer = (NtpServer) servers.get(pid);
-            if (ntpServer == null)
+            NtpServer ntpServer = (NtpServer) servers.get( pid );
+            if ( ntpServer == null )
             {
-                ntpServer = new NtpServer(new NtpConfig(config), registry);
-                servers.put(pid, ntpServer);
+                ntpServer = new NtpServer( new NtpConfig( config ), registry );
+                servers.put( pid, ntpServer );
             }
             else
             {
                 // we have the service, so ...
                 // for a given config, is the config different?
-                if (ntpServer.isDifferent(config))
+                if ( ntpServer.isDifferent( config ) )
                 {
                     // the config for this service is different, so ...
                     // destroy the listener and recreate it with the new config.
-                    deleted(pid);
-                    ntpServer = new NtpServer(new NtpConfig(config), registry);
-                    servers.put(pid, ntpServer);
+                    deleted( pid );
+                    ntpServer = new NtpServer( new NtpConfig( config ), registry );
+                    servers.put( pid, ntpServer );
                 }
             }
         }
     }
 
-    public void deleted(String pid)
+    public void deleted( String pid )
     {
-        NtpServer ntpServer = (NtpServer) servers.remove(pid);
+        NtpServer ntpServer = (NtpServer) servers.remove( pid );
 
-        if (ntpServer != null)
+        if ( ntpServer != null )
         {
             ntpServer.destroy();
         }



Mime
View raw message