]> source.dussan.org Git - archiva.git/blob
d8614f4e849c43d8f36a43054fe7c4d533709a57
[archiva.git] /
1 package org.apache.maven.archiva.web.action.admin;
2
3 /*
4  * Licensed to the Apache Software Foundation (ASF) under one
5  * or more contributor license agreements.  See the NOTICE file
6  * distributed with this work for additional information
7  * regarding copyright ownership.  The ASF licenses this file
8  * to you under the Apache License, Version 2.0 (the
9  * "License"); you may not use this file except in compliance
10  * with the License.  You may obtain a copy of the License at
11  *
12  *   http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing,
15  * software distributed under the License is distributed on an
16  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17  * KIND, either express or implied.  See the License for the
18  * specific language governing permissions and limitations
19  * under the License.
20  */
21
22 import com.opensymphony.xwork.ModelDriven;
23 import com.opensymphony.xwork.Preparable;
24 import org.apache.maven.archiva.security.ArchivaRoleConstants;
25 import org.apache.maven.archiva.web.action.AbstractConfiguredAction;
26 //import org.apache.maven.artifact.installer.ArtifactInstallationException;
27 //import org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException;
28 //import org.apache.maven.model.Model;
29 //import org.apache.maven.project.ProjectBuildingException;
30 //import org.apache.maven.shared.app.company.CompanyPomHandler;
31 //import org.apache.maven.shared.app.configuration.CompanyPom;
32 //import org.apache.maven.shared.app.configuration.Configuration;
33 //import org.apache.maven.shared.app.configuration.MavenAppConfiguration;
34 import org.codehaus.plexus.security.rbac.Resource;
35 import org.codehaus.plexus.security.ui.web.interceptor.SecureAction;
36 import org.codehaus.plexus.security.ui.web.interceptor.SecureActionBundle;
37 import org.codehaus.plexus.security.ui.web.interceptor.SecureActionException;
38
39 import java.io.IOException;
40
41 /**
42  * @author <a href="mailto:brett@apache.org">Brett Porter</a>
43  * @version $Id: ConfigurationAction.java 480950 2006-11-30 14:58:35Z evenisse $
44  * @TODO plexus.component role="com.opensymphony.xwork.Action"
45  * role-hint="editPom"
46  */
47 public class EditPomAction
48     extends AbstractConfiguredAction
49     implements ModelDriven, SecureAction, Preparable
50 {
51     /**
52      * @plexus.requirement
53      */
54     // private MavenAppConfiguration appConfigurationStore;
55
56     /**
57      * The configuration.
58      */
59 //    private Configuration configuration;
60
61     /**
62      * @plexus.requirement
63      */
64     // private CompanyPomHandler companyPomHandler;
65
66     // private Model companyModel;
67
68     public String execute()
69 //        throws IOException, ArtifactInstallationException
70     {
71         // TODO: hack for passed in String[]
72 //        String[] logo = (String[]) companyModel.getProperties().get( "organization.logo" );
73 //        if ( logo != null )
74 //        {
75 //            companyModel.getProperties().put( "organization.logo", logo[0] );
76 //        }
77 //
78 //        companyPomHandler.save( companyModel, createLocalRepository() );
79
80         return SUCCESS;
81     }
82
83     public Object getModel()
84     {
85 //        return companyModel;
86         return new Object();
87     }
88
89     public void prepare()
90    //     throws ProjectBuildingException, ArtifactMetadataRetrievalException
91     {
92 //        configuration = appConfigurationStore.getConfiguration();
93 //
94 //        CompanyPom companyPom = configuration.getCompanyPom();
95 //        companyModel = companyPomHandler.getCompanyPomModel( companyPom, createLocalRepository() );
96 //
97 //        if ( companyModel == null )
98 //        {
99 //            companyModel = new Model();
100 //            companyModel.setModelVersion( "4.0.0" );
101 //            companyModel.setPackaging( "pom" );
102 //
103 //            if ( companyPom != null )
104 //            {
105 //                companyModel.setGroupId( companyPom.getGroupId() );
106 //                companyModel.setArtifactId( companyPom.getArtifactId() );
107 //            }
108 //        }
109     }
110
111     public SecureActionBundle getSecureActionBundle()
112         throws SecureActionException
113     {
114         SecureActionBundle bundle = new SecureActionBundle();
115         bundle.setRequiresAuthentication( true );
116         bundle.addRequiredAuthorization( ArchivaRoleConstants.OPERATION_MANAGE_CONFIGURATION, Resource.GLOBAL );
117
118         return bundle;
119     }
120
121 //    public Model getCompanyModel()
122 //    {
123 //        return companyModel;
124 //    }
125 }