1 package org.apache.maven.repository.manager.web.job;
\r
3 import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
\r
4 import org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout;
\r
5 import org.apache.maven.artifact.repository.layout.LegacyRepositoryLayout;
\r
6 import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
\r
7 import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException;
\r
9 import java.util.Properties;
\r
11 * Copyright 2005-2006 The Apache Software Foundation.
\r
13 * Licensed under the Apache License, Version 2.0 (the "License");
\r
14 * you may not use this file except in compliance with the License.
\r
15 * You may obtain a copy of the License at
\r
17 * http://www.apache.org/licenses/LICENSE-2.0
\r
19 * Unless required by applicable law or agreed to in writing, software
\r
20 * distributed under the License is distributed on an "AS IS" BASIS,
\r
21 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
22 * See the License for the specific language governing permissions and
\r
23 * limitations under the License.
\r
29 public class Configuration
\r
30 implements Initializable
\r
33 private Properties props;
\r
35 public void initialize()
\r
36 throws InitializationException
\r
38 System.out.println( "Configuration initialized" );
\r
41 public void setProperties( Properties properties )
\r
43 this.props = properties;
\r
46 public Properties getProperties()
\r
51 public ArtifactRepositoryLayout getLayout()
\r
53 ArtifactRepositoryLayout layout;
\r
54 if ( "legacy".equals( props.getProperty( "layout" ) ) )
\r
56 layout = new LegacyRepositoryLayout();
\r
60 layout = new DefaultRepositoryLayout();
\r
65 public String getIndexDirectory()
\r
67 return props.getProperty( "index.path" );
\r
70 public String getRepositoryDirectory()
\r
72 String repositoryDir = "";
\r
73 if ( "default".equals( props.getProperty( "layout" ) ) )
\r
75 repositoryDir = props.getProperty( "default.repository.dir" );
\r
77 else if ( "legacy".equals( props.getProperty( "layout" ) ) )
\r
79 repositoryDir = props.getProperty( "legacy.repository.dir" );
\r
81 return repositoryDir;
\r