>
>
services.TurbineDirectoryService.properties.java.naming.security.principal=c
> n=Manager, o=JNDITutorial
>
> Then  the TurbineResource.getString("java.naming.security.principal")
> couldn't return String.

Of course that wouldn't return the string because the name portion is
"services.TurbineDirectoryService.properties.java.naming.security.principal"
.

--> Sorry! I  make you a little confusion.
    I implemented a TurbineDirectoryService for my testing.
    Please refer to my code ( see below ).

If you want to get a property value out of a service, you need to use the
TurbineDirectoryService.getProperties() method to get the
properties...assuming that TurbineDirectoryService extends
TurbineBaseService.

> As a temporary solution, I modified the getString() method in
> Configurations.java like

Could you please just post a diff so that I can see what you changed?

-->  - throw new ClassCastException(key + " doesn't map to a String
object");
     + String str = value.toString();
     + return str.substring(1,str.length() - 1);

> It works good, but it is a temporary solution I think.
>
> How can I solve this problem without any breaking of compatibility in
> Turbine package.

--> What I want to do is to get a String ( cn=Manager, o=JNDITutorial ) if I
set some properties like
     bababa=cn=Manager, o=JNDITutorial
     in the TurbineResources.properties file

-> Below is my code TurbineDirectoryService.java ( Test purpose only ! )

     The NamingService in naming package was modified

     -  public Context getContext(String name);
     + public Properties getInitProperties();

    It was returned Context. But I would like to returns a Initial
properties of naming service.
    ( later I would like to expand it to cover all JNDI Sevices providers ,
      Sorry it is my own test purpose only !! )


package org.apache.turbine.services.naming;

import java.util.*;
import javax.naming.*;
import javax.naming.directory.*;

import org.apache.turbine.services.*;
import org.apache.turbine.util.*;

public class TurbineDirectoryService extends TurbineBaseService
    implements NamingService
{

    private String name = null;
    private Properties prop = null;
    private boolean init = false;

    public void init() {
        try{
        super.setName(name);
            prop = super.getProperties();
            if ( prop == null ) {
                Log.error ( "Can't get properties!");
            }
            else {
                setInit(true);
        }
        }
        catch (Exception e) {
            Log.error ( "Cannot initialize TurbineDirectoryService!" );
            Log.error (e);
        }
    }

    public Properties getInitProperties() {
        return prop;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public void setInit(boolean value) {
        this.init = value;
    }

    public boolean getInit() {
        return this.init;
    }
}

------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Problems?:           [EMAIL PROTECTED]



------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Problems?:           [EMAIL PROTECTED]

Reply via email to