* 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.
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- *
+ *
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*
*******************************************************************************/
-package com.att.nsa.cambria.service.impl;
+package com.att.dmf.mr.service.impl;
import java.io.IOException;
import java.util.Collection;
import org.json.JSONObject;
import org.springframework.stereotype.Component;
+import com.att.dmf.mr.backends.Consumer;
+import com.att.dmf.mr.backends.ConsumerFactory;
+import com.att.dmf.mr.beans.DMaaPContext;
+import com.att.dmf.mr.security.DMaaPAuthenticatorImpl;
+import com.att.dmf.mr.service.AdminService;
+import com.att.dmf.mr.utils.DMaaPResponseBuilder;
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
-import com.att.nsa.cambria.backends.Consumer;
-import com.att.nsa.cambria.backends.ConsumerFactory;
-import com.att.nsa.cambria.beans.DMaaPContext;
-import com.att.nsa.cambria.security.DMaaPAuthenticatorImpl;
-import com.att.nsa.cambria.service.AdminService;
-import com.att.nsa.cambria.utils.DMaaPResponseBuilder;
import com.att.nsa.configs.ConfigDbException;
import com.att.nsa.limits.Blacklist;
import com.att.nsa.security.NsaApiKey;
import com.att.nsa.security.ReadWriteSecuredResource.AccessDeniedException;
+//import com.att.sa.highlandPark.util.HpJsonUtil;
/**
- * @author author
+ * @author muzainulhaque.qazi
*
*/
@Component
adminAuthenticate ( dMaaPContext );
DMaaPResponseBuilder.respondOk ( dMaaPContext,
- new JSONObject().put ( "blacklist", setToJsonArray ( getIpBlacklist (dMaaPContext).asSet() ) ) );
+ new JSONObject().put ( "blacklist",
+ setToJsonArray ( getIpBlacklist (dMaaPContext).asSet() ) ) );
+ }
+
+ public static JSONArray setToJsonArray ( Set<?> fields )
+ {
+ return collectionToJsonArray ( fields );
+ }
+
+ public static JSONArray collectionToJsonArray ( Collection<?> fields )
+ {
+ final JSONArray a = new JSONArray ();
+ if ( fields != null )
+ {
+ for ( Object o : fields )
+ {
+ a.put ( o );
+ }
+ }
+ return a;
}
/**
{
final NsaApiKey user = DMaaPAuthenticatorImpl.getAuthenticatedUser(dMaaPContext);
- if ( (user == null || !user.getKey ().equals ( "admin" )) )
+ if ( user == null || !user.getKey ().equals ( "admin" ) )
{
throw new AccessDeniedException ();
}
}
-
- public static JSONArray setToJsonArray ( Set<?> fields )
- {
- return collectionToJsonArray ( fields );
- }
-
- public static JSONArray collectionToJsonArray ( Collection<?> fields )
- {
- final JSONArray a = new JSONArray ();
- if ( fields != null )
- {
- for ( Object o : fields )
- {
- a.put ( o );
- }
- }
- return a;
- }
}