]> git.argeo.org Git - gpl/argeo-slc.git/blob - org.argeo.slc.support/src/org/argeo/slc/aether/spring/RemoteRepositoryFactory.java
069e4c3e4ee055952d61e1a09662adc331183f4a
[gpl/argeo-slc.git] / org.argeo.slc.support / src / org / argeo / slc / aether / spring / RemoteRepositoryFactory.java
1 /*
2 * Copyright (C) 2007-2012 Argeo GmbH
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 package org.argeo.slc.aether.spring;
17
18 import org.eclipse.aether.repository.Authentication;
19 import org.eclipse.aether.repository.RemoteRepository;
20 import org.springframework.beans.factory.BeanNameAware;
21 import org.springframework.beans.factory.FactoryBean;
22
23 /** Simplifies the definition of a remote factory using Spring */
24 public class RemoteRepositoryFactory implements BeanNameAware, FactoryBean {
25 private String beanName;
26 private String id;
27 private String url;
28 private String type = "default";
29 private String username;
30 private String password;
31
32 public Object getObject() throws Exception {
33 // FIXME Adapt to changes in Aether
34 // RemoteRepository remoteRepository = new RemoteRepository(
35 // id != null ? id : beanName, type, url);
36 // if (username != null) {
37 // Authentication authentication = new Authentication(username,
38 // password);
39 // remoteRepository.setAuthentication(authentication);
40 // }
41 return null;
42 }
43
44 public Class<?> getObjectType() {
45 return RemoteRepository.class;
46 }
47
48 public boolean isSingleton() {
49 return true;
50 }
51
52 public void setBeanName(String name) {
53 this.beanName = name;
54
55 }
56
57 public void setId(String id) {
58 this.id = id;
59 }
60
61 public void setUrl(String url) {
62 this.url = url;
63 }
64
65 public void setType(String type) {
66 this.type = type;
67 }
68
69 public void setUsername(String username) {
70 this.username = username;
71 }
72
73 public void setPassword(String password) {
74 this.password = password;
75 }
76
77 }