avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nic...@apache.org
Subject cvs commit: avalon-sandbox/eclipse/org.apache.avalon.ide.eclipse/schema org.apache.avalon.ide.eclipse.repository.exsd
Date Tue, 18 Nov 2003 16:06:36 GMT
niclas      2003/11/18 08:06:36

  Modified:    eclipse/org.apache.avalon.ide.eclipse plugin.xml
               eclipse/org.apache.avalon.ide.eclipse/ide/src/java/org/apache/avalon/ide/eclipse/preferences
                        AddRepositoryDialog.java
               eclipse/org.apache.avalon.ide.eclipse/ide/src/java/org/apache/avalon/ide/eclipse/views/repository
                        ViewContentProvider.java
               eclipse/org.apache.avalon.ide.eclipse/repository/api/src/java/org/apache/avalon/repository/tools
                        RepositoryAgentFactory.java
                        RepositoryTypeRegistry.java
               eclipse/org.apache.avalon.ide.eclipse/repository/impl/src/java/org/apache/avalon/repository/tools/common
                        SimpleRepositoryRegistry.java
               eclipse/org.apache.avalon.ide.eclipse/repository/impl/src/java/org/apache/avalon/repository/tools/url/plain
                        URLPlainRepositoryAgentFactory.java
  Added:       eclipse/org.apache.avalon.ide.eclipse/doc book.css
                        org_apache_avalon_ide_eclipse_org.apache.avalon.ide.eclipse.repository.html
                        schema.css
               eclipse/org.apache.avalon.ide.eclipse/schema
                        org.apache.avalon.ide.eclipse.repository.exsd
  Removed:     eclipse/org.apache.avalon.ide.eclipse/ide/src/java/org/apache/avalon/ide/eclipse
                        AssemblerPlugin.java
               eclipse/org.apache.avalon.ide.eclipse/ide/src/java/org/apache/avalon/ide/eclipse/actions
                        SampleAction.java
  Log:
  Got a bit longer on the registration of Repositories in the Preferences page, and it now
registers properly, but not removal is still not done properly. Also started to define the
Repository Extension Point, so people can right new RepositoryAgentFactory for types of repositories.
  
  Revision  Changes    Path
  1.3       +2 -0      avalon-sandbox/eclipse/org.apache.avalon.ide.eclipse/plugin.xml
  
  Index: plugin.xml
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/eclipse/org.apache.avalon.ide.eclipse/plugin.xml,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- plugin.xml	17 Nov 2003 10:34:18 -0000	1.2
  +++ plugin.xml	18 Nov 2003 16:06:35 -0000	1.3
  @@ -16,6 +16,8 @@
      </requires>
   
   
  +   <extension-point id="org.apache.avalon.ide.eclipse.repository" name="Avalon Repository"
schema="schema/org.apache.avalon.ide.eclipse.repository.exsd"/>
  +
      <extension
            point="org.eclipse.ui.actionSets">
         <actionSet
  
  
  
  1.1                  avalon-sandbox/eclipse/org.apache.avalon.ide.eclipse/doc/book.css
  
  Index: book.css
  ===================================================================
  P.Code {
  	display: block;
  	text-align: left;
  	text-indent: 0.00pt;
  	margin-top: 0.000000pt;
  	margin-bottom: 0.000000pt;
  	margin-right: 0.000000pt;
  	margin-left: 15pt;
  	font-size: 10.000000pt;
  	font-weight: medium;
  	font-style: Regular;
  	color: #4444CC;
  	text-decoration: none;
  	vertical-align: baseline;
  	text-transform: none;
  	font-family: "Courier New";
  }
  H6.CaptionFigColumn {
  	display: block;
  	text-align: left;
  	text-indent: 0.000000pt;
  	margin-top: 3.000000pt;
  	margin-bottom: 11.000000pt;
  	margin-right: 0.000000pt;
  	margin-left: 0.000000pt;
  	font-size: 9.000000pt;
  	font-weight: medium;
  	font-style: Italic;
  	color: #000000;
  	text-decoration: none;
  	vertical-align: baseline;
  	text-transform: none;
  	font-family: "Arial";
  }
  P.Note {
  	display: block;
  	text-align: left;
  	text-indent: 0pt;
  	margin-top: 19.500000pt;
  	margin-bottom: 19.500000pt;
  	margin-right: 0.000000pt;
  	margin-left: 30pt;
  	font-size: 11.000000pt;
  	font-weight: medium;
  	font-style: Italic;
  	color: #000000;
  	text-decoration: none;
  	vertical-align: baseline;
  	text-transform: none;
  	font-family: "Arial";
  }
  EM.UILabel {
  	font-weight: Bold;
  	font-style: Regular;
  	text-decoration: none;
  	vertical-align: baseline;
  	text-transform: none;
  }
  EM.CodeName {
  	font-weight: Bold;
  	font-style: Regular;
  	text-decoration: none;
  	vertical-align: baseline;
  	text-transform: none;
  	font-family:"Courier New";
  }
  
  
  
  
  /* following font face declarations need to be removed for DBCS */
  
  body, h1, h2, h3, h4, h5, h6, p, table, td, caption, th, ul, ol, dl, li, dd, dt {font-family:
Arial, Helvetica, sans-serif; color: #000000}
  pre				{ font-family: Courier, monospace}
  
  /* end font face declarations */
  
  /* following font size declarations should be OK for DBCS */
  body, h1, h2, h3, h4, h5, h6, p, table, td, caption, th, ul, ol, dl, li, dd, dt {font-size:
10pt; }
  pre				{ font-size: 10pt}
  
  /* end font size declarations */
  
  body	     { background: #FFFFFF}
  h1           { font-size: 18pt; margin-top: 5; margin-bottom: 1 }	
  h2           { font-size: 14pt; margin-top: 25; margin-bottom: 3 }
  h3           { font-size: 11pt; margin-top: 20; margin-bottom: 3 }
  h4           { font-size: 10pt; margin-top: 20; margin-bottom: 3; font-style: italic }
  p            { margin-top: 10px; margin-bottom: 10px }
  pre	     { margin-left: 6; font-size: 9pt }
  a:link	     { color: #0000FF }
  a:hover	     { color: #000080 }
  a:visited    { text-decoration: underline }
  ul	     { margin-top: 0; margin-bottom: 10 }
  li	     { margin-top: 0; margin-bottom: 0 } 
  li p	     { margin-top: 0; margin-bottom: 0 } 
  ol	     { margin-top: 0; margin-bottom: 10 }
  dl	     { margin-top: 0; margin-bottom: 10 }
  dt	     { margin-top: 0; margin-bottom: 0; font-weight: bold }
  dd	     { margin-top: 0; margin-bottom: 0 }
  strong	     { font-weight: bold}
  em	     { font-style: italic}
  var	     { font-style: italic}
  div.revision { border-left-style: solid; border-left-width: thin; 
  				   border-left-color: #7B68EE; padding-left:5 }
  th	     { font-weight: bold }
  
  
  
  1.1                  avalon-sandbox/eclipse/org.apache.avalon.ide.eclipse/doc/org_apache_avalon_ide_eclipse_org.apache.avalon.ide.eclipse.repository.html
  
  Index: org_apache_avalon_ide_eclipse_org.apache.avalon.ide.eclipse.repository.html
  ===================================================================
  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  <HEAD><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  <!-- default platform documentation stylesheets -->
  <style>@import url("book.css");</style>
  <!-- default schema documentation stylesheets -->
  <style>@import url("schema.css");</style>
  </HEAD>
  <HTML>
  <BODY>
  <H1><CENTER>Avalon Repository</CENTER></H1>
  <p></p>
  <h6 class=CaptionFigColumn id=header>Identifier: </h6>org.apache.avalon.ide.eclipse.org.apache.avalon.ide.eclipse.repository<p></p>
  <h6 class=CaptionFigColumn id=header>Since: </h6>[Enter the first release in
which this extension point appears.]
  <p></p>
  
  <p>
  <h6 class=CaptionFigColumn id=header>Description: </h6>For registration of new
Avalon Repository types.</p>
  <p><h6 class=CaptionFigColumn id=header>Configuration Markup:</h6></p>
  <p class=code id=dtd>&lt;!ELEMENT <a name="e.extension">extension</a>
EMPTY&gt;</p>
  <p class=code id=dtd>&lt;!ATTLIST extension</p>
  <p class=code id=dtdAttlist>point&nbsp;CDATA #REQUIRED<p class=code id=dtdAttlist>id&nbsp;&nbsp;&nbsp;&nbsp;CDATA
#IMPLIED<p class=code id=dtdAttlist>name&nbsp;&nbsp;CDATA #IMPLIED&gt;</p>
  <p></p>
  <ul class=ConfigMarkup id=attlistDesc>
  </ul>
  <br><p class=code id=dtd>&lt;!ELEMENT <a name="e.type">type</a>
EMPTY&gt;</p>
  <p class=code id=dtd>&lt;!ATTLIST type</p>
  <p class=code id=dtdAttlist>classname&nbsp;CDATA #REQUIRED<p class=code id=dtdAttlist>urn-id&nbsp;&nbsp;&nbsp;&nbsp;CDATA
#REQUIRED&gt;</p>
  <p></p>
  <ul class=ConfigMarkup id=attlistDesc>
  <li><b>classname</b> - The classname of the implementation of the RepositoryAgentFactory.</li>
  <li><b>urn-id</b> - The 'urn-id' must be in the form of 
  [urnliterals]:[urn-identifier]
  where [urnliterls] is "urn" and the [urn-identifier] is a established globally unique name,
only containing alpha-numeric characters, dash (-) and underscore (_).</li>
  </ul>
  <br><p class=code id=dtd>&lt;!ELEMENT <a name="e.description">description</a>
EMPTY&gt;</p>
  <p></p>
  <p class=ConfigMarkup id=elementDesc>
  A description of the Repository type.</p>
  <br><br>
  <h6 class=CaptionFigColumn id=header>Examples: </h6>[Enter extension point usage
example here.]
  <p></p>
  
  <h6 class=CaptionFigColumn id=header>API Information: </h6>[Enter API information
here.]
  <p></p>
  
  <h6 class=CaptionFigColumn id=header>Supplied Implementation: </h6>[Enter information
about supplied implementation of this extension point.]
  <p></p>
  
  <br>
  <p class=note id=copyright>
  </p>
  </BODY>
  </HTML>
  
  
  
  1.1                  avalon-sandbox/eclipse/org.apache.avalon.ide.eclipse/doc/schema.css
  
  Index: schema.css
  ===================================================================
  H6.CaptionFigColumn#header {
  	font-size:16px; 
  	display:inline
  }
  
  H6.CaptionFigColumn#copyright-text {
  	font-size: smaller; 
  	font-style: normal;
  	color: #336699; 
  	display:inline 
  }
  
  P.Code#dtd {
  	color: #800000; 
  	display: inline;
  	margin-top: 0.000000pt;
  	margin-bottom: 0.000000pt;
  	margin-right: 0.000000pt;
  	margin-left: 0.000000pt;
  }
  
  P.Code#tag {
  	color: #000080; 
  	display:inline;
  	margin-top: 0.000000pt;
  	margin-bottom: 0.000000pt;
  	margin-right: 0.000000pt;
  	margin-left: 0.000000pt;
  }
  
  P.Code#cstring {
  	color: #008000; 
  	display:inline;
  	margin-top: 0.000000pt;
  	margin-bottom: 0.000000pt;
  	margin-right: 0.000000pt;
  	margin-left: 0.000000pt;	
  }
  
  
   
  
  
  
  
  1.3       +52 -21    avalon-sandbox/eclipse/org.apache.avalon.ide.eclipse/ide/src/java/org/apache/avalon/ide/eclipse/preferences/AddRepositoryDialog.java
  
  Index: AddRepositoryDialog.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/eclipse/org.apache.avalon.ide.eclipse/ide/src/java/org/apache/avalon/ide/eclipse/preferences/AddRepositoryDialog.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- AddRepositoryDialog.java	17 Nov 2003 11:07:24 -0000	1.2
  +++ AddRepositoryDialog.java	18 Nov 2003 16:06:36 -0000	1.3
  @@ -50,13 +50,17 @@
   import org.eclipse.jface.dialogs.IDialogConstants;
   import org.eclipse.jface.dialogs.IInputValidator;
   import org.eclipse.swt.SWT;
  +import org.eclipse.swt.events.ModifyEvent;
  +import org.eclipse.swt.events.ModifyListener;
  +import org.eclipse.swt.events.SelectionEvent;
  +import org.eclipse.swt.events.SelectionListener;
   import org.eclipse.swt.layout.GridData;
  +import org.eclipse.swt.layout.GridLayout;
   import org.eclipse.swt.widgets.Button;
   import org.eclipse.swt.widgets.Composite;
   import org.eclipse.swt.widgets.Control;
   import org.eclipse.swt.widgets.Group;
   import org.eclipse.swt.widgets.Label;
  -import org.eclipse.swt.widgets.List;
   import org.eclipse.swt.widgets.Shell;
   import org.eclipse.swt.widgets.Text;
   
  @@ -64,9 +68,11 @@
    * @author Niclas Hedhman, niclas@hedhman.org
    */
   public class AddRepositoryDialog extends Dialog
  +    implements SelectionListener
   {
  -    private List m_List;
  -    private Text m_Text;
  +    private String m_TextValue;
  +    private URNDescriptor m_Selected;
  +
       private IInputValidator m_Validator;
   
       public AddRepositoryDialog(Shell parent, IInputValidator validator)
  @@ -78,50 +84,75 @@
       protected Control createDialogArea(Composite parent)
       {
           Composite panel = (Composite) super.createDialogArea(parent);
  +        GridLayout layout = new GridLayout();
  +        panel.setLayout(layout);
   
           Label label = new Label(panel, SWT.WRAP);
           label.setText("Location:");
           GridData data =
               new GridData(
                   GridData.GRAB_HORIZONTAL
  -                    | GridData.GRAB_VERTICAL
                       | GridData.HORIZONTAL_ALIGN_FILL
  -                    | GridData.VERTICAL_ALIGN_CENTER);
  +                    | GridData.VERTICAL_ALIGN_END);
           data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
           label.setLayoutData(data);
   
  -        m_Text = new Text(panel, SWT.SINGLE | SWT.BORDER);
  -        m_Text.setText("");
  -        m_Text.setLayoutData(
  +        Text textField = new Text(panel, SWT.SINGLE | SWT.BORDER);
  +        textField.setText("");
  +        textField.setLayoutData(
               new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
  +        textField.addModifyListener( new ModifyListener()
  +        {
  +            public void modifyText( ModifyEvent event )
  +            {
  +                m_TextValue = ((Text) event.getSource()).getText();
  +            }
  +        } );
   
           Group group = new Group(panel, SWT.SHADOW_ETCHED_IN);
  +        layout = new GridLayout();
  +        group.setLayout(layout);
  +
           group.setText("Registered Types");
  -        group.setLayoutData(
  +        data =
               new GridData(
  -                GridData.GRAB_HORIZONTAL
  +                GridData.HORIZONTAL_ALIGN_FILL
                       | GridData.GRAB_VERTICAL
  -                    | GridData.HORIZONTAL_ALIGN_FILL
  -                    | GridData.VERTICAL_ALIGN_FILL));
  +                    | GridData.VERTICAL_ALIGN_BEGINNING);
  +        group.setLayoutData(data);
   
           RepositoryTypeRegistry reg = RepositoryPlugin.getDefault().getRepositoryTypeRegistry();
           URNDescriptor[] urns = reg.getRegisteredURNs();
  +        m_Selected = urns[0];
           for (int i = 0; i < urns.length; i++)
           {
  -            System.out.println("Placing button:" + urns[i]);
  -            Button b = new Button(group, SWT.RADIO);
  -            b.setText(urns[i].getName());
  -            b.setData(urns[i]);
  -            b.setToolTipText(urns[i].getDescription());
  +            Button b1 = new Button(group, SWT.RADIO);
  +            GridData gd = new GridData();
  +            gd.grabExcessHorizontalSpace = true;
  +            gd.grabExcessVerticalSpace = true;
  +            b1.setLayoutData(gd);
  +            b1.setText(urns[i].getName());
  +            b1.setData(urns[i]);
  +            b1.setToolTipText(urns[i].getDescription());
  +            b1.addSelectionListener( this );            
  +            if (i == 0)
  +                b1.setSelection(true);
           }
  -        group.pack();
  -        group.layout();
  -        panel.pack();
           return panel;
       }
   
  +    public void widgetDefaultSelected( SelectionEvent event )
  +    {
  +        System.out.println( "widgetDefaultSelected" );
  +    }
  +
  +    public void widgetSelected( SelectionEvent event )
  +    {
  +        m_Selected = (URNDescriptor) ((Button) event.getSource()).getData();
  +    }
  +
       public String getValue()
       {
  -        return "urn:" + m_List.getSelection()[0] + ":" + m_Text.getText();
  +        return "urn:" + m_Selected.getURN() + ":" + m_TextValue;
       }
   }
  
  
  
  1.3       +90 -49    avalon-sandbox/eclipse/org.apache.avalon.ide.eclipse/ide/src/java/org/apache/avalon/ide/eclipse/views/repository/ViewContentProvider.java
  
  Index: ViewContentProvider.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/eclipse/org.apache.avalon.ide.eclipse/ide/src/java/org/apache/avalon/ide/eclipse/views/repository/ViewContentProvider.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ViewContentProvider.java	17 Nov 2003 10:34:19 -0000	1.2
  +++ ViewContentProvider.java	18 Nov 2003 16:06:36 -0000	1.3
  @@ -7,24 +7,23 @@
    * Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
    * 
    * Redistribution and use in source and binary forms, with or without modifica-
  - * tion, are permitted provided that the following conditions are met:
  - *  1. Redistributions of source code must retain the above copyright notice,
  - * this list of conditions and the following disclaimer.
  - *  2. Redistributions in binary form must reproduce the above copyright
  - * notice, this list of conditions and the following disclaimer in the
  - * documentation and/or other materials provided with the distribution.
  - *  3. The end-user documentation included with the redistribution, if any,
  - * must include the following acknowledgment: "This product includes software
  - * developed by the Apache Software Foundation (http://www.apache.org/)."
  - * Alternately, this acknowledgment may appear in the software itself, if and
  - * wherever such third-party acknowledgments normally appear.
  - *  4. The names "Jakarta", "Apache Avalon", "Avalon Framework" and "Apache
  - * Software Foundation" must not be used to endorse or promote products derived
  - * from this software without prior written permission. For written permission,
  - * please contact apache@apache.org.
  - *  5. Products derived from this software may not be called "Apache", nor may
  - * "Apache" appear in their name, without prior written permission of the
  - * Apache Software Foundation.
  + * tion, are permitted provided that the following conditions are met: 1.
  + * Redistributions of source code must retain the above copyright notice, this
  + * list of conditions and the following disclaimer. 2. Redistributions in
  + * binary form must reproduce the above copyright notice, this list of
  + * conditions and the following disclaimer in the documentation and/or other
  + * materials provided with the distribution. 3. The end-user documentation
  + * included with the redistribution, if any, must include the following
  + * acknowledgment: "This product includes software developed by the Apache
  + * Software Foundation (http://www.apache.org/)." Alternately, this
  + * acknowledgment may appear in the software itself, if and wherever such
  + * third-party acknowledgments normally appear. 4. The names "Jakarta", "Apache
  + * Avalon", "Avalon Framework" and "Apache Software Foundation" must not be
  + * used to endorse or promote products derived from this software without prior
  + * written permission. For written permission, please contact
  + * apache@apache.org. 5. Products derived from this software may not be called
  + * "Apache", nor may "Apache" appear in their name, without prior written
  + * permission of the Apache Software Foundation.
    * 
    * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
    * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  @@ -55,10 +54,14 @@
   import org.apache.avalon.repository.ResourceInfo;
   import org.apache.avalon.repository.Version;
   import org.apache.avalon.repository.tools.RepositoryAgent;
  +import org.apache.avalon.repository.tools.RepositoryAgentCreationException;
   import org.apache.avalon.repository.tools.RepositoryAgentEvent;
  +import org.apache.avalon.repository.tools.RepositoryAgentFactory;
   import org.apache.avalon.repository.tools.RepositoryAgentFactoryEvent;
   import org.apache.avalon.repository.tools.RepositoryAgentFactoryListener;
   import org.apache.avalon.repository.tools.RepositoryAgentListener;
  +import org.apache.avalon.repository.tools.RepositoryTypeRegistry;
  +import org.apache.avalon.repository.tools.URNDescriptor;
   import org.apache.avalon.repository.tools.common.NonVersion;
   import org.apache.avalon.repository.tools.common.ResourceInfoImpl;
   import org.apache.avalon.repository.tools.compliance.EmptyCompliance;
  @@ -98,6 +101,14 @@
       ViewContentProvider(RepositoryView pView)
       {
           m_View = pView;
  +        RepositoryPlugin plugin = RepositoryPlugin.getDefault();
  +        RepositoryTypeRegistry reg = plugin.getRepositoryTypeRegistry();
  +        URNDescriptor[] urns = reg.getRegisteredURNs();
  +        for( int i=0 ; i < urns.length ; i++ )
  +        {
  +            RepositoryAgentFactory factory = reg.getRepositoryAgentFactory( urns[i] );
  +            factory.addRepositoryAgentFactoryListener( this );
  +        }
       }
   
       public void inputChanged(Viewer v, Object oldInput, Object newInput)
  @@ -106,7 +117,17 @@
       public void dispose()
       {
           IPreferenceStore prefs = RepositoryPlugin.getDefault().getPreferenceStore();
  -        prefs.removePropertyChangeListener( this );
  +        prefs.removePropertyChangeListener(this);
  +        
  +        RepositoryPlugin plugin = RepositoryPlugin.getDefault();
  +        RepositoryTypeRegistry reg = plugin.getRepositoryTypeRegistry();
  +        URNDescriptor[] urns = reg.getRegisteredURNs();
  +        for( int i=0 ; i < urns.length ; i++ )
  +        {
  +            RepositoryAgentFactory factory = reg.getRepositoryAgentFactory( urns[i] );
  +            factory.addRepositoryAgentFactoryListener( this );
  +        }
  +
           ViewNode[] repos = m_InvisibleRoot.getChildren();
           for (int i = 0; i < repos.length; i++)
               removeRepository(repos[i]);
  @@ -165,10 +186,11 @@
           m_InvisibleRoot = new ParentNode(m_View, null, info);
           m_Repositories = new HashMap();
           IPreferenceStore prefs = RepositoryPlugin.getDefault().getPreferenceStore();
  -        prefs.addPropertyChangeListener( this );
  -        String repos = prefs.getString( RepositoryPreferencePage.P_REPOSITORIES );
  -        PropertyChangeEvent event = new PropertyChangeEvent( this, RepositoryPreferencePage.P_REPOSITORIES,
"", repos );
  -        propertyChange( event );
  +        prefs.addPropertyChangeListener(this);
  +        String repos = prefs.getString(RepositoryPreferencePage.P_REPOSITORIES);
  +        PropertyChangeEvent event =
  +            new PropertyChangeEvent(this, RepositoryPreferencePage.P_REPOSITORIES, "",
repos);
  +        propertyChange(event);
       }
   
       public void available(RepositoryAgentEvent event)
  @@ -182,58 +204,78 @@
       }
   
       // IPropertyChangeListener method
  -    public void propertyChange( PropertyChangeEvent event )
  +    public void propertyChange(PropertyChangeEvent event)
       {
           String prop = event.getProperty();
  -        if( prop.equals( RepositoryPreferencePage.P_REPOSITORIES))
  +        if (prop.equals(RepositoryPreferencePage.P_REPOSITORIES))
           {
               String oldValue = (String) event.getOldValue();
               String newValue = (String) event.getNewValue();
  -            ArrayList olds = parse( oldValue );
  -            ArrayList news = parse( newValue );
  -            ArrayList removes = new ArrayList( olds );
  -            Iterator list = news.iterator();
  -            while( list.hasNext() )
  +            ArrayList olds = parse(oldValue);
  +            ArrayList news = parse(newValue);
  +
  +            ArrayList removes = new ArrayList(olds);
  +            removes.removeAll(news);
  +
  +            ArrayList adds = new ArrayList(news);
  +            adds.removeAll(olds);
  +
  +            RepositoryPlugin plugin = RepositoryPlugin.getDefault();
  +            RepositoryTypeRegistry reg = plugin.getRepositoryTypeRegistry();
  +
  +            Iterator removeList = removes.iterator();
  +            while (removeList.hasNext())
               {
  -                String repo = (String) list.next();
  -                removes.remove( repo );
  +                String s = (String) removeList.next();
  +                URNDescriptor urn = reg.findByType(s);
  +                RepositoryAgentFactory factory = reg.getRepositoryAgentFactory(urn);
  +                RepositoryAgent agent = factory.findRepositoryAgentByLocation(s);
  +                factory.dispose(agent);
               }
  -            ArrayList adds = new ArrayList( news );
  -            list = olds.iterator();
  -            while( list.hasNext() )
  +
  +            Iterator addList = adds.iterator();
  +            while (addList.hasNext())
               {
  -                String repo = (String) list.next();
  -                adds.remove( repo );
  +                String s = (String) addList.next();
  +                try
  +                {
  +                    URNDescriptor urn = reg.findByType(s);
  +                    RepositoryAgentFactory factory = reg.getRepositoryAgentFactory(urn);
  +                    factory.create(s, null);
  +                } catch (RepositoryAgentCreationException e)
  +                {
  +                    // SHOULD-DO Error Handling.
  +                    System.err.println("Could not create RepositoryAgent " + s);
  +                }
               }
  -            System.out.println( "Adding: " + adds );
  -            System.out.println( "Removing: " + removes );
           }
       }
   
  -    private ArrayList parse( String s )
  +    private ArrayList parse(String s)
       {
           ArrayList result = new ArrayList();
  -        StringTokenizer st = new StringTokenizer( s, ", ", false );
  -        while( st.hasMoreTokens() )
  +        StringTokenizer st = new StringTokenizer(s, ", ", false);
  +        while (st.hasMoreTokens())
           {
               String tok = st.nextToken();
  -            result.add( tok );
  +            result.add(tok);
           }
           return result;
       }
       // RepositoryAgentFactoryListener method
  -    public void createdRepositoryAgent( RepositoryAgentFactoryEvent event )
  +    public void createdRepositoryAgent(RepositoryAgentFactoryEvent event)
       {
           RepositoryAgent agent = event.getRepositoryAgent();
           agent.addRepositoryAgentListener(this);
  +        agent.loadResourceInfo("/");
       }
   
  -    public void deletedRepositoryAgent( RepositoryAgentFactoryEvent event )
  +    public void deletedRepositoryAgent(RepositoryAgentFactoryEvent event)
       {
           RepositoryAgent agent = event.getRepositoryAgent();
           agent.removeRepositoryAgentListener(this);
       }
  -    
  +
       // RepositoryAgentListener methods
       public void resourceLoaded(RepositoryAgentEvent event)
       {
  @@ -271,7 +313,7 @@
       }
   
       // ITreeViewerListener methods
  -    
  +
       public void treeExpanded(TreeExpansionEvent event)
       {
           ParentNode node = (ParentNode) event.getElement();
  @@ -293,6 +335,5 @@
           int pos = ident.lastIndexOf('/');
           return ident.substring(0, pos + 1);
       }
  -    
  -   
  +
   }
  
  
  
  1.4       +29 -20    avalon-sandbox/eclipse/org.apache.avalon.ide.eclipse/repository/api/src/java/org/apache/avalon/repository/tools/RepositoryAgentFactory.java
  
  Index: RepositoryAgentFactory.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/eclipse/org.apache.avalon.ide.eclipse/repository/api/src/java/org/apache/avalon/repository/tools/RepositoryAgentFactory.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- RepositoryAgentFactory.java	17 Nov 2003 11:07:24 -0000	1.3
  +++ RepositoryAgentFactory.java	18 Nov 2003 16:06:36 -0000	1.4
  @@ -7,24 +7,23 @@
    * Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
    * 
    * Redistribution and use in source and binary forms, with or without modifica-
  - * tion, are permitted provided that the following conditions are met:
  - *  1. Redistributions of source code must retain the above copyright notice,
  - * this list of conditions and the following disclaimer.
  - *  2. Redistributions in binary form must reproduce the above copyright
  - * notice, this list of conditions and the following disclaimer in the
  - * documentation and/or other materials provided with the distribution.
  - *  3. The end-user documentation included with the redistribution, if any,
  - * must include the following acknowledgment: "This product includes software
  - * developed by the Apache Software Foundation (http://www.apache.org/)."
  - * Alternately, this acknowledgment may appear in the software itself, if and
  - * wherever such third-party acknowledgments normally appear.
  - *  4. The names "Jakarta", "Apache Avalon", "Avalon Framework" and "Apache
  - * Software Foundation" must not be used to endorse or promote products derived
  - * from this software without prior written permission. For written permission,
  - * please contact apache@apache.org.
  - *  5. Products derived from this software may not be called "Apache", nor may
  - * "Apache" appear in their name, without prior written permission of the
  - * Apache Software Foundation.
  + * tion, are permitted provided that the following conditions are met: 1.
  + * Redistributions of source code must retain the above copyright notice, this
  + * list of conditions and the following disclaimer. 2. Redistributions in
  + * binary form must reproduce the above copyright notice, this list of
  + * conditions and the following disclaimer in the documentation and/or other
  + * materials provided with the distribution. 3. The end-user documentation
  + * included with the redistribution, if any, must include the following
  + * acknowledgment: "This product includes software developed by the Apache
  + * Software Foundation (http://www.apache.org/)." Alternately, this
  + * acknowledgment may appear in the software itself, if and wherever such
  + * third-party acknowledgments normally appear. 4. The names "Jakarta", "Apache
  + * Avalon", "Avalon Framework" and "Apache Software Foundation" must not be
  + * used to endorse or promote products derived from this software without prior
  + * written permission. For written permission, please contact
  + * apache@apache.org. 5. Products derived from this software may not be called
  + * "Apache", nor may "Apache" appear in their name, without prior written
  + * permission of the Apache Software Foundation.
    * 
    * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
    * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  @@ -63,11 +62,9 @@
       /**
   	 * Creates a RepositoryAgent for the given location.
   	 * 
  -	 * <p>
   	 * The semantics of the <i>location</i> parameter is implementation
   	 * dependent. The RepositoryAgentFactory MUST handle any initial "urn:" and
   	 * <i>[type]</i> of a urn: <i>[type]</i>:<i>[location]</i>
format.
  -	 * </p>
   	 * 
   	 * @param location
   	 *            Location of the repository.
  @@ -76,6 +73,18 @@
   	 * @throws RepositoryAgentCreationException
   	 */
       RepositoryAgent create(String location, Locale locale) throws RepositoryAgentCreationException;
  +
  +    /**
  +	 * Returns the RepositoryAgent at that location, if any. The location
  +	 * parameter is of the format <i><strong>urn:</strong> [type] <strong>:
  +	 * </strong> [location]</i>, and the RepositoryAgentFactory MUST handle
  +	 * the initial urn:[type], if present.
  +	 * 
  +	 * @param location
  +	 *            The location of the RepositoryAgent to find.
  +	 * @return Returns null if no RepositoryAgent exists at that URN.
  +	 */
  +    RepositoryAgent findRepositoryAgentByLocation(String location);
   
       /**
   	 * Call to dispose the RepositoryAgent.
  
  
  
  1.3       +11 -0     avalon-sandbox/eclipse/org.apache.avalon.ide.eclipse/repository/api/src/java/org/apache/avalon/repository/tools/RepositoryTypeRegistry.java
  
  Index: RepositoryTypeRegistry.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/eclipse/org.apache.avalon.ide.eclipse/repository/api/src/java/org/apache/avalon/repository/tools/RepositoryTypeRegistry.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- RepositoryTypeRegistry.java	17 Nov 2003 10:34:19 -0000	1.2
  +++ RepositoryTypeRegistry.java	18 Nov 2003 16:06:36 -0000	1.3
  @@ -109,6 +109,17 @@
        */
       URNDescriptor[] getRegisteredURNs();
       
  +    /** Returns the URNDescriptor registered under the type name.
  +     * 
  +     * The type parameter may contain the "urn:" and [location] literals. It
  +     * is the responsibility of the RepositoryTypeRegistry implementation to
  +     * do the parsing.
  +     * 
  +     * @param type The type of the urn to be looked up.
  +     * @return
  +     */
  +    URNDescriptor findByType( String type );
  +    
       /** Returns the RepositoryAgentFactory registered with the given URN.
        * 
        * @param urn The URN for which to return its RepositoryAgentFactory.
  
  
  
  1.3       +30 -1     avalon-sandbox/eclipse/org.apache.avalon.ide.eclipse/repository/impl/src/java/org/apache/avalon/repository/tools/common/SimpleRepositoryRegistry.java
  
  Index: SimpleRepositoryRegistry.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/eclipse/org.apache.avalon.ide.eclipse/repository/impl/src/java/org/apache/avalon/repository/tools/common/SimpleRepositoryRegistry.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- SimpleRepositoryRegistry.java	17 Nov 2003 10:34:19 -0000	1.2
  +++ SimpleRepositoryRegistry.java	18 Nov 2003 16:06:36 -0000	1.3
  @@ -65,6 +65,7 @@
   public class SimpleRepositoryRegistry implements RepositoryTypeRegistry
   {
       private HashMap m_Registrations;
  +    private HashMap m_URNTypes;
       private ArrayList m_Listeners;
   
       /**
  @@ -74,6 +75,7 @@
       {
           super();
           m_Registrations = new HashMap();
  +        m_URNTypes = new HashMap();
           m_Listeners = new ArrayList();
       }
   
  @@ -93,6 +95,21 @@
           }
       }
       
  +    /** Returns the URNDescriptor registered under the type name.
  +     * 
  +     * The type parameter may contain the "urn:" and [location] literals. It
  +     * is the responsibility of the RepositoryTypeRegistry implementation to
  +     * do the parsing.
  +     * 
  +     * @param location The location containing the type of the urn to be looked up.
  +     * @return
  +     */
  +    public URNDescriptor findByType( String location )
  +    {
  +        String type = normalize( location );
  +        return (URNDescriptor) m_URNTypes.get( type );
  +    }
  +
       /** Returns the RepositoryAgentFactory registered with the given URN.
        * 
        * @param urn The URN for which to return its RepositoryAgentFactory.
  @@ -127,6 +144,7 @@
           Iterator list;
           synchronized (this)
           {
  +            m_URNTypes.put( urn.getURN(), urn );
               m_Registrations.put(urn, factory);
               list = m_Listeners.iterator();
           }
  @@ -157,6 +175,7 @@
           synchronized (this)
           {
               factory = (RepositoryAgentFactory) m_Registrations.get(urn);
  +            m_URNTypes.remove( urn.getURN() );
               if (factory == null)
                   return;
               list = m_Listeners.iterator();
  @@ -177,6 +196,7 @@
           }
       }
   
  +
       /** Adds a RepositoryRegistryListener.
        * 
        * <p>
  @@ -218,5 +238,14 @@
               m_Listeners = v;
           }
       }
  -
  +    
  +    private String normalize( String location )
  +    {
  +        if( location.startsWith( "urn:" ))
  +            location = location.substring( 4 );
  +        int pos = location.indexOf( ":" );
  +        if( pos >= 0 )
  +            location = location.substring( 0, pos );
  +        return location;
  +    }
   }
  
  
  
  1.3       +35 -2     avalon-sandbox/eclipse/org.apache.avalon.ide.eclipse/repository/impl/src/java/org/apache/avalon/repository/tools/url/plain/URLPlainRepositoryAgentFactory.java
  
  Index: URLPlainRepositoryAgentFactory.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/eclipse/org.apache.avalon.ide.eclipse/repository/impl/src/java/org/apache/avalon/repository/tools/url/plain/URLPlainRepositoryAgentFactory.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- URLPlainRepositoryAgentFactory.java	17 Nov 2003 10:34:19 -0000	1.2
  +++ URLPlainRepositoryAgentFactory.java	18 Nov 2003 16:06:36 -0000	1.3
  @@ -47,6 +47,7 @@
   import java.io.IOException;
   import java.net.MalformedURLException;
   import java.util.ArrayList;
  +import java.util.HashMap;
   import java.util.Iterator;
   import java.util.Locale;
   
  @@ -62,13 +63,15 @@
   public class URLPlainRepositoryAgentFactory implements RepositoryAgentFactory
   {
       private ArrayList m_Listeners;
  -
  +    private HashMap m_Agents;
  +    
       /**
   	 *  
   	 */
       public URLPlainRepositoryAgentFactory()
       {
           super();
  +        m_Agents = new HashMap();
       }
   
       /**
  @@ -91,7 +94,9 @@
       {
           try
           {
  -            RepositoryAgent agent = new URLPlainRepositoryAgent(location, locale);
  +            String loc = normalize( location );
  +            RepositoryAgent agent = new URLPlainRepositoryAgent(loc, locale);
  +            m_Agents.put( loc, agent );
               RepositoryAgentFactoryEvent event = new RepositoryAgentFactoryEvent(this, agent);
               Iterator list = m_Listeners.iterator();
               while (list.hasNext())
  @@ -117,6 +122,22 @@
       }
   
       /**
  +     * Returns the RepositoryAgent at that location, if any. The location
  +     * parameter is of the format <i><strong>urn:</strong> [type] <strong>:
  +     * </strong> [location]</i>, and the RepositoryAgentFactory MUST handle
  +     * the initial urn:[type], if present.
  +     * 
  +     * @param location
  +     *            The location of the RepositoryAgent to find.
  +     * @return Returns null if no RepositoryAgent exists at that URN.
  +     */
  +    public RepositoryAgent findRepositoryAgentByLocation(String location)
  +    {
  +        String loc = normalize( location );
  +        return (RepositoryAgent) m_Agents.get( loc );
  +    }
  +
  +    /**
   	 * Call to dispose the RepositoryAgent.
   	 * 
   	 * It is important that the factory is given a chance to clean up the
  @@ -128,6 +149,7 @@
   	 */
       public void dispose(RepositoryAgent agent)
       {
  +        m_Agents.remove( agent.getLocation() );
           RepositoryAgentFactoryEvent event = new RepositoryAgentFactoryEvent(this, agent);
           Iterator list = m_Listeners.iterator();
           while (list.hasNext())
  @@ -190,4 +212,15 @@
           }
       }
   
  +    private String normalize( String location )
  +    {
  +        if( location.startsWith( "urn:" ))
  +            location = location.substring( 4 );
  +        int pos = location.indexOf( ":" );
  +        if( pos >= 0 )
  +            location = location.substring( pos + 1 );
  +        if( ! location.endsWith( "/"))
  +            location = location + "/";
  +        return location;
  +    }
   }
  
  
  
  1.1                  avalon-sandbox/eclipse/org.apache.avalon.ide.eclipse/schema/org.apache.avalon.ide.eclipse.repository.exsd
  
  Index: org.apache.avalon.ide.eclipse.repository.exsd
  ===================================================================
  <?xml version='1.0' encoding='UTF-8'?>
  <!-- Schema file written by PDE -->
  <schema targetNamespace="org.apache.avalon.ide.eclipse.org.apache.avalon.ide.eclipse">
  <annotation>
        <appInfo>
           <meta.schema plugin="org.apache.avalon.ide.eclipse.org.apache.avalon.ide.eclipse"
id="repository" name="Avalon Repository"/>
        </appInfo>
        <documentation>
           For registration of new Avalon Repository types.
        </documentation>
     </annotation>
  
     <element name="extension">
        <complexType>
           <sequence>
           </sequence>
           <attribute name="point" type="string" use="required">
              <annotation>
                 <documentation>
                    
                 </documentation>
              </annotation>
           </attribute>
           <attribute name="id" type="string">
              <annotation>
                 <documentation>
                    
                 </documentation>
              </annotation>
           </attribute>
           <attribute name="name" type="string">
              <annotation>
                 <documentation>
                    
                 </documentation>
              </annotation>
           </attribute>
        </complexType>
     </element>
  
     <element name="type">
        <complexType>
           <sequence>
           </sequence>
           <attribute name="classname" type="string" use="required">
              <annotation>
                 <documentation>
                    The classname of the implementation of the RepositoryAgentFactory.
                 </documentation>
              </annotation>
           </attribute>
           <attribute name="urn-id" type="string" use="required">
              <annotation>
                 <documentation>
                    The &apos;urn-id&apos; must be in the form of 
  [urnliterals]:[urn-identifier]
  where [urnliterls] is &quot;urn&quot; and the [urn-identifier] is a established
globally unique name, only containing alpha-numeric characters, dash (-) and underscore (_).
                 </documentation>
              </annotation>
           </attribute>
        </complexType>
     </element>
  
     <element name="description">
        <annotation>
           <documentation>
              A description of the Repository type.
           </documentation>
        </annotation>
        <complexType>
           <sequence>
           </sequence>
        </complexType>
     </element>
  
     <annotation>
        <appInfo>
           <meta.section type="since"/>
        </appInfo>
        <documentation>
           [Enter the first release in which this extension point appears.]
        </documentation>
     </annotation>
  
     <annotation>
        <appInfo>
           <meta.section type="examples"/>
        </appInfo>
        <documentation>
           [Enter extension point usage example here.]
        </documentation>
     </annotation>
  
     <annotation>
        <appInfo>
           <meta.section type="apiInfo"/>
        </appInfo>
        <documentation>
           [Enter API information here.]
        </documentation>
     </annotation>
  
     <annotation>
        <appInfo>
           <meta.section type="implementation"/>
        </appInfo>
        <documentation>
           [Enter information about supplied implementation of this extension point.]
        </documentation>
     </annotation>
  
     <annotation>
        <appInfo>
           <meta.section type="copyright"/>
        </appInfo>
        <documentation>
           
        </documentation>
     </annotation>
  
  </schema>
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: cvs-unsubscribe@avalon.apache.org
For additional commands, e-mail: cvs-help@avalon.apache.org


Mime
View raw message