* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
import locate.v1_1.Configuration;
import locate.v1_1.Configuration.Props;
-public class LocateServiceImpl<IN,OUT,ERROR>
+public class LocateServiceImpl<IN,OUT,ERROR>
implements LocateService<IN,OUT,Endpoints,MgmtEndpoints,Configuration,ERROR> {
private Mapper<IN,OUT,Endpoints,MgmtEndpoints,Configuration,ERROR> mapper;
protected LocateDAO locateDAO;
private ConfigDAO configDAO;
private boolean permToRegister;
-
- public LocateServiceImpl(AuthzTrans trans, AAF_Locate locate, Mapper<IN,OUT,Endpoints,MgmtEndpoints,Configuration,ERROR> mapper) throws APIException {
+
+ public LocateServiceImpl(AuthzTrans trans, AAF_Locate locate, Mapper<IN,OUT,Endpoints,MgmtEndpoints,Configuration,ERROR> mapper){
this.mapper = mapper;
this.locateDAO = locate.locateDAO;
this.configDAO = locate.configDAO;
permToRegister = false; //TODO Setup a Configuration for this
}
-
+
public Mapper<IN,OUT,Endpoints,MgmtEndpoints,Configuration,ERROR> mapper() {return mapper;}
@Override
int count = 0;
StringBuilder denied = null;
for (MgmtEndpoint me : meps.getMgmtEndpoint()) {
- if (permToRegister) {
+ if (permToRegister) {
int dot = me.getName().lastIndexOf('.'); // Note: Validator checks for NS for getName()
- AAFPermission p = new AAFPermission(me.getName().substring(0,dot),"locator",me.getHostname(),"write");
+ AAFPermission p = new AAFPermission(me.getName().substring(0,dot),"locator",me.getHostname(),"write");
if (!trans.fish(p)) {
- if(denied==null) {
- denied = new StringBuilder("May not register service(s):");
- }
-
+ if(denied==null) {
+ denied = new StringBuilder("May not register service(s):");
+ }
+
denied.append("\n\t");
denied.append(p.getKey());
denied.append(')');
return Result.ok();
} else {
return denied==null?Result.err(Result.ERR_NotFound, "No endpoints found")
- :Result.err(Result.ERR_Security,denied.toString());
+ :Result.err(Result.ERR_Security,denied.toString());
}
}
int count = 0;
StringBuilder denied = null;
for (MgmtEndpoint me : meps.getMgmtEndpoint()) {
- if (permToRegister) {
+ if (permToRegister) {
int dot = me.getName().lastIndexOf('.'); // Note: Validator checks for NS for getName()
- AAFPermission p = new AAFPermission(me.getName().substring(0,dot),"locator",me.getHostname(),"write");
+ AAFPermission p = new AAFPermission(me.getName().substring(0,dot),"locator",me.getHostname(),"write");
if (!trans.fish(p)) {
- if(denied==null) {
- denied = new StringBuilder("May not deregister service(s):");
- }
-
+ if(denied==null) {
+ denied = new StringBuilder("May not deregister service(s):");
+ }
+
denied.append("\n\t");
denied.append(p.getKey());
denied.append(')');
return Result.ok();
} else {
return denied==null?Result.err(Result.ERR_NotFound, "No endpoints found")
- :Result.err(Result.ERR_Security,denied.toString());
+ :Result.err(Result.ERR_Security,denied.toString());
}
}
///// ADDED v1_1
/* (non-Javadoc)
* @see org.onap.aaf.auth.locate.service.LocateService#getConfig(org.onap.aaf.auth.env.AuthzTrans, java.lang.String, java.lang.String)
- *
+ *
* Note: "id" is put in, in case we need to filter, or direct data change in the future by Permission
*/
@Override
Configuration c = new Configuration();
c.setName(type);
Props p;
-
+
if (dr.isOKhasData()) {
for (ConfigDAO.Data data : dr.value) {
p = new Props();