1 package org.apache.maven.repository.manager.web.job;
\r
4 * Copyright 2005-2006 The Apache Software Foundation.
\r
6 * Licensed under the Apache License, Version 2.0 (the "License");
\r
7 * you may not use this file except in compliance with the License.
\r
8 * You may obtain a copy of the License at
\r
10 * http://www.apache.org/licenses/LICENSE-2.0
\r
12 * Unless required by applicable law or agreed to in writing, software
\r
13 * distributed under the License is distributed on an "AS IS" BASIS,
\r
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
15 * See the License for the specific language governing permissions and
\r
16 * limitations under the License.
\r
19 import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
\r
20 import org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout;
\r
21 import org.apache.maven.artifact.repository.layout.LegacyRepositoryLayout;
\r
22 import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
\r
23 import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException;
\r
25 import java.util.Properties;
\r
28 * This class contains the configuration values to be used by the scheduler
\r
30 public class Configuration
\r
31 implements Initializable
\r
34 private Properties props;
\r
37 * @throws InitializationException
\r
39 public void initialize()
\r
40 throws InitializationException
\r
45 * Set the properties object
\r
49 public void setProperties( Properties properties )
\r
51 this.props = properties;
\r
55 * Returns the properties object
\r
57 * @return a Properties object that contains the configuration values
\r
59 public Properties getProperties()
\r
64 public ArtifactRepositoryLayout getLayout()
\r
66 ArtifactRepositoryLayout layout;
\r
67 if ( "legacy".equals( props.getProperty( "layout" ) ) )
\r
69 layout = new LegacyRepositoryLayout();
\r
73 layout = new DefaultRepositoryLayout();
\r
78 public String getIndexDirectory()
\r
80 return props.getProperty( "index.path" );
\r
83 public String getRepositoryDirectory()
\r
85 String repositoryDir = "";
\r
86 if ( "default".equals( props.getProperty( "layout" ) ) )
\r
88 repositoryDir = props.getProperty( "default.repository.dir" );
\r
90 else if ( "legacy".equals( props.getProperty( "layout" ) ) )
\r
92 repositoryDir = props.getProperty( "legacy.repository.dir" );
\r
94 return repositoryDir;
\r