directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From erodrig...@apache.org
Subject svn commit: r265029 - in /directory/sandbox/trunk/osgi-protocol-providers/trunk/changepw/src/main/java/org/apache/changepw: Activator.java ChangepwConfig.java ChangepwServer.java ChangepwServerFactory.java
Date Wed, 31 Aug 2005 12:27:21 GMT
Author: erodriguez
Date: Wed Aug 31 05:27:01 2005
New Revision: 265029

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

Modified:
    directory/sandbox/trunk/osgi-protocol-providers/trunk/changepw/src/main/java/org/apache/changepw/Activator.java
    directory/sandbox/trunk/osgi-protocol-providers/trunk/changepw/src/main/java/org/apache/changepw/ChangepwConfig.java
    directory/sandbox/trunk/osgi-protocol-providers/trunk/changepw/src/main/java/org/apache/changepw/ChangepwServer.java
    directory/sandbox/trunk/osgi-protocol-providers/trunk/changepw/src/main/java/org/apache/changepw/ChangepwServerFactory.java

Modified: directory/sandbox/trunk/osgi-protocol-providers/trunk/changepw/src/main/java/org/apache/changepw/Activator.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/osgi-protocol-providers/trunk/changepw/src/main/java/org/apache/changepw/Activator.java?rev=265029&r1=265028&r2=265029&view=diff
==============================================================================
--- directory/sandbox/trunk/osgi-protocol-providers/trunk/changepw/src/main/java/org/apache/changepw/Activator.java
(original)
+++ directory/sandbox/trunk/osgi-protocol-providers/trunk/changepw/src/main/java/org/apache/changepw/Activator.java
Wed Aug 31 05:27:01 2005
@@ -79,8 +79,7 @@
 
         registry = (ServiceRegistry) tracker.getService();
 
-        ServiceReference storeReference = context.getServiceReference( InitialContextFactory.class
-                .getName() );
+        ServiceReference storeReference = context.getServiceReference( InitialContextFactory.class.getName()
);
 
         InitialContextFactory factory = (InitialContextFactory) context.getService( storeReference
);
 
@@ -113,8 +112,7 @@
 
         Dictionary parameters = new Hashtable();
         parameters.put( ConfigurationAdmin.SERVICE_FACTORYPID, FACTORY_PID );
-        registration = context.registerService( ManagedServiceFactory.class.getName(),
-                serverFactory, parameters );
+        registration = context.registerService( ManagedServiceFactory.class.getName(), serverFactory,
parameters );
 
         ServiceReference adminRef = null;
         try
@@ -129,9 +127,8 @@
                 if ( adminRef != null )
                 {
                     admin = (ConfigurationAdmin) context.getService( adminRef );
-                    String filter = "(&(service.factoryPid=" + FACTORY_PID + ")"
-                            + "(|(service.bundleLocation=" + context.getBundle().getLocation()
-                            + ")" + "(service.bundleLocation=NULL)"
+                    String filter = "(&(service.factoryPid=" + FACTORY_PID + ")" + "(|(service.bundleLocation="
+                            + context.getBundle().getLocation() + ")" + "(service.bundleLocation=NULL)"
                             + "(!(service.bundleLocation=*))))";
                     configs = admin.listConfigurations( filter );
                 }
@@ -143,8 +140,7 @@
 
             if ( admin == null || configs == null || configs.length == 0 )
             {
-                serverFactory.updated( ChangepwServerFactory.DEFAULT_PID, ChangepwConfig
-                        .getDefaultConfig() );
+                serverFactory.updated( ChangepwServerFactory.DEFAULT_PID, ChangepwConfig.getDefaultConfig()
);
             }
         }
         catch ( ConfigurationException ce )

Modified: directory/sandbox/trunk/osgi-protocol-providers/trunk/changepw/src/main/java/org/apache/changepw/ChangepwConfig.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/osgi-protocol-providers/trunk/changepw/src/main/java/org/apache/changepw/ChangepwConfig.java?rev=265029&r1=265028&r2=265029&view=diff
==============================================================================
--- directory/sandbox/trunk/osgi-protocol-providers/trunk/changepw/src/main/java/org/apache/changepw/ChangepwConfig.java
(original)
+++ directory/sandbox/trunk/osgi-protocol-providers/trunk/changepw/src/main/java/org/apache/changepw/ChangepwConfig.java
Wed Aug 31 05:27:01 2005
@@ -31,23 +31,23 @@
 
     private int port;
 
-    public ChangepwConfig(Dictionary configuration)
+    public ChangepwConfig( 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(CHANGEPW_PORT_KEY)).intValue();
+        port = ( (Integer) configuration.get( CHANGEPW_PORT_KEY ) ).intValue();
 
-        System.out.println("Change Password got port " + port);
+        System.out.println( "Change Password got port " + port );
     }
 
-    boolean isDifferent(Dictionary config)
+    boolean isDifferent( Dictionary config )
     {
-        if (port == ((Integer) config.get(CHANGEPW_PORT_KEY)).intValue())
+        if ( port == ( (Integer) config.get( CHANGEPW_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,9 +71,8 @@
     {
         Dictionary defaults = new Hashtable();
 
-        defaults.put(SERVICE_PID, PID);
-        defaults.put(CHANGEPW_PORT_KEY, Integer.getInteger(CHANGEPW_PORT_KEY, new Integer(
-                CHANGEPW_PORT_DEFAULT)));
+        defaults.put( SERVICE_PID, PID );
+        defaults.put( CHANGEPW_PORT_KEY, Integer.getInteger( CHANGEPW_PORT_KEY, new Integer(
CHANGEPW_PORT_DEFAULT ) ) );
 
         return defaults;
     }

Modified: directory/sandbox/trunk/osgi-protocol-providers/trunk/changepw/src/main/java/org/apache/changepw/ChangepwServer.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/osgi-protocol-providers/trunk/changepw/src/main/java/org/apache/changepw/ChangepwServer.java?rev=265029&r1=265028&r2=265029&view=diff
==============================================================================
--- directory/sandbox/trunk/osgi-protocol-providers/trunk/changepw/src/main/java/org/apache/changepw/ChangepwServer.java
(original)
+++ directory/sandbox/trunk/osgi-protocol-providers/trunk/changepw/src/main/java/org/apache/changepw/ChangepwServer.java
Wed Aug 31 05:27:01 2005
@@ -41,7 +41,7 @@
     private String name;
     private int port = -1;
 
-    public ChangepwServer(ChangepwConfig config, ServiceRegistry registry, PrincipalStore
store)
+    public ChangepwServer( ChangepwConfig config, ServiceRegistry registry, PrincipalStore
store )
     {
         this.config = config;
         this.registry = registry;
@@ -57,39 +57,39 @@
 
         try
         {
-            System.out.println(name + " starting on " + port);
+            System.out.println( name + " starting on " + port );
 
-            provider = new ChangePasswordProtocolProvider(new ChangePasswordConfiguration(),
store);
+            provider = new ChangePasswordProtocolProvider( new ChangePasswordConfiguration(),
store );
 
-            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/changepw/src/main/java/org/apache/changepw/ChangepwServerFactory.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/osgi-protocol-providers/trunk/changepw/src/main/java/org/apache/changepw/ChangepwServerFactory.java?rev=265029&r1=265028&r2=265029&view=diff
==============================================================================
--- directory/sandbox/trunk/osgi-protocol-providers/trunk/changepw/src/main/java/org/apache/changepw/ChangepwServerFactory.java
(original)
+++ directory/sandbox/trunk/osgi-protocol-providers/trunk/changepw/src/main/java/org/apache/changepw/ChangepwServerFactory.java
Wed Aug 31 05:27:01 2005
@@ -37,7 +37,7 @@
 
     Object updateLock = new Object();
 
-    ChangepwServerFactory(ServiceRegistry registry, PrincipalStore store)
+    ChangepwServerFactory( ServiceRegistry registry, PrincipalStore store )
     {
         this.registry = registry;
         this.store = store;
@@ -46,64 +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(ChangepwConfig.CHANGEPW_PORT_KEY)).intValue();
+        int port = ( (Integer) config.get( ChangepwConfig.CHANGEPW_PORT_KEY ) ).intValue();
 
-        if (port < 1 || port > 0xFFFF)
+        if ( port < 1 || port > 0xFFFF )
         {
-            throw new ConfigurationException(ChangepwConfig.CHANGEPW_PORT_KEY, "invalid value="
-                    + port);
+            throw new ConfigurationException( ChangepwConfig.CHANGEPW_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
-            ChangepwServer server = (ChangepwServer) servers.get(pid);
-            if (server == null)
+            ChangepwServer server = (ChangepwServer) servers.get( pid );
+            if ( server == null )
             {
-                server = new ChangepwServer(new ChangepwConfig(config), registry, store);
-                servers.put(pid, server);
+                server = new ChangepwServer( new ChangepwConfig( config ), registry, store
);
+                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 ChangepwServer(new ChangepwConfig(config), registry, store);
-                    servers.put(pid, server);
+                    deleted( pid );
+                    server = new ChangepwServer( new ChangepwConfig( config ), registry,
store );
+                    servers.put( pid, server );
                 }
             }
         }
     }
 
-    public void deleted(String pid)
+    public void deleted( String pid )
     {
-        ChangepwServer server = (ChangepwServer) servers.remove(pid);
+        ChangepwServer server = (ChangepwServer) servers.remove( pid );
 
-        if (server != null)
+        if ( server != null )
         {
             server.destroy();
         }



Mime
View raw message