Exemple #1
0
    public org.omg.CORBA.Contained[] contents(org.omg.CORBA.DefinitionKind limit_type, 
                                              boolean exclude_inherited)
    {
        Hashtable limited = new Hashtable();

        // analog constants, exceptions etc.

        for( Enumeration e = contained.elements(); e.hasMoreElements();  )
        {
            org.omg.CORBA.Contained c = (org.omg.CORBA.Contained)e.nextElement();
            if( limit_type == org.omg.CORBA.DefinitionKind.dk_all || 
                limit_type == c.def_kind() )
            {
                limited.put( c, "" );
            }
        }

        org.omg.CORBA.Contained[] c = new org.omg.CORBA.Contained[limited.size()];
        int i;
        Enumeration e;
        for( e = limited.keys(), i=0 ; e.hasMoreElements(); i++ )
            c[i] = (org.omg.CORBA.Contained)e.nextElement();
        return c;			
    }
Exemple #2
0
    public org.omg.CORBA.Contained lookup( String scopedname )
    {
        org.jacorb.util.Debug.output(2,"Struct " + this.name + " lookup " + scopedname );

        String top_level_name;
        String rest_of_name;
        String name;

        if( scopedname.startsWith("::") )       
        {
            name = scopedname.substring(2);
        }
        else
            name = scopedname;

        if( name.indexOf("::") > 0 )
        {
            top_level_name = name.substring( 0, name.indexOf("::") );
            rest_of_name = name.substring( name.indexOf("::") + 2);
        } 
        else 
        {
            top_level_name = name;
            rest_of_name = null;
        }
		
        try
        {
            org.omg.CORBA.Contained top = 
                (org.omg.CORBA.Contained)contained.get( top_level_name );

            if( top == null )
            {
                org.jacorb.util.Debug.output(2,"Interface " + this.name + 
                                         " top " + top_level_name + " not found ");
                return null;
            }
	
            if( rest_of_name == null )
            {
                return top;
            }
            else 
            {
                if( top instanceof org.omg.CORBA.Container)
                {
                    return ((org.omg.CORBA.Container)top).lookup( rest_of_name );
                }
                else
                {
                    org.jacorb.util.Debug.output(2,"Interface " + this.name +
                                             " " + scopedname + " not found ");
                    return null;		
                }
            }
        } 
        catch( Exception e )
        {
            e.printStackTrace();
            return null;			
        }	
    }
Exemple #3
0
    public void loadContents()
    {
        // read from the  class (operations and atributes)
        Debug.assert( getReference() != null, "my own ref null");

        org.omg.CORBA.StructDef myReference = 
            org.omg.CORBA.StructDefHelper.narrow( getReference());

        Debug.assert( myReference != null, "narrow failed for " + getReference() );

        /* load nested definitions from interfacePackage directory */
        
        String[] classes = null;
        if( my_dir != null )
        {
            classes = my_dir.list( new IRFilenameFilter(".class") );

            // load class files in this interface's Package directory
            if( classes != null) 
            {
                for( int j = 0; j < classes.length; j++ )
                {
                    try 
                    { 
                        org.jacorb.util.Debug.output(2, "Struct " +name+ " tries " + 
                                                 full_name.replace('.', fileSeparator) + 
                                                 "Package" + fileSeparator + 
                                                 classes[j].substring( 0, classes[j].indexOf(".class")) );

                        ClassLoader loader = getClass().getClassLoader();
                        if( loader == null )
                        {
                            loader = RepositoryImpl.loader;
                        }

                        Class cl = 
                            loader.loadClass( 
                                             ( full_name.replace('.', fileSeparator) + "Package" + fileSeparator + 
                                               classes[j].substring( 0, classes[j].indexOf(".class"))
                                               ).replace( fileSeparator, '/') );
                        

                        Contained containedObject = Contained.createContained( cl, 
                                                                               path,
                                                                               myReference, 
                                                                               containing_repository );
                        if( containedObject == null )
                            continue;
                        
                        org.omg.CORBA.Contained containedRef = 
                            Contained.createContainedReference(containedObject);
                        
                        if( containedObject instanceof ContainerType )
                            ((ContainerType)containedObject).loadContents();
                        
                        containedRef.move( myReference, containedRef.name(), containedRef.version() );
                        
                        org.jacorb.util.Debug.output(2, "Struct " + full_name + 
                                                 " loads "+ containedRef.name() );
                        contained.put( containedRef.name() , containedRef );
                        containedLocals.put( containedRef.name(), containedObject );                        
                    } 
                    catch ( Exception e ) 
                    {
                        e.printStackTrace();
                    }
                }
            }
        }
    }