Skip to content

Commit

Permalink
Cleans up the code
Browse files Browse the repository at this point in the history
Signed-off-by: Mohammad Ghazanfar Ali Danish <[email protected]>
  • Loading branch information
mdanish98 committed Aug 29, 2024
1 parent 2edd410 commit c1f8fef
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 5 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/maven_run_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
name: Java CI with Maven

on:
push:
branches: [ test ]
pull_request:
branches: [ main ]
paths-ignore:
Expand Down
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ private CommonAuthorizationProperties() {
public static final String RULES_BACKEND_TYPE = PROPERTIES_PREFIX + ".rules.backend";
public static final String RULES_BACKEND_TYPE_SUBMODEL_AUTHORIZATION = RULES_BACKEND_TYPE + ".submodel.authorization";
public static final String RULES_BACKEND_TYPE_SUBMODEL_AUTHORIZATION_SUBMODEL_ENDPOINT = RULES_BACKEND_TYPE_SUBMODEL_AUTHORIZATION + ".endpoint";
// public static final String RULES_BACKEND_TYPE_SUBMODEL_AUTHORIZATION_RULE_IDSHORTPATH = RULES_BACKEND_TYPE_SUBMODEL_AUTHORIZATION + ".";
public static final String RULES_BACKEND_TYPE_SUBMODEL_AUTHORIZATION_TOKEN_ENDPOINT = RULES_BACKEND_TYPE_SUBMODEL_AUTHORIZATION + ".token-endpoint";
public static final String RULES_BACKEND_TYPE_SUBMODEL_AUTHORIZATION_GRANT_TYPE = RULES_BACKEND_TYPE_SUBMODEL_AUTHORIZATION + ".grant-type";
public static final String RULES_BACKEND_TYPE_SUBMODEL_AUTHORIZATION_CLIENT_ID = RULES_BACKEND_TYPE_SUBMODEL_AUTHORIZATION + ".client-id";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,40 @@
/*******************************************************************************
* Copyright (C) 2024 the Eclipse BaSyx Authors
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* SPDX-License-Identifier: MIT
******************************************************************************/

package org.eclipse.digitaltwin.basyx.authorization.rbac;

import org.reflections.Reflections;
import org.reflections.scanners.Scanners;

import java.util.Set;

/**
* A processor to detect the type of the {@link TargetInformation} at runtime.
*
* @author danish
*/
public class TargetInformationTypeProcessor {

public static Object getImplementation(String type) {
Expand All @@ -16,12 +46,12 @@ public static Object getImplementation(String type) {
TargetInformationSubtype annotation = clazz.getAnnotation(TargetInformationSubtype.class);
if (annotation != null && annotation.getValue().equals(type)) {
try {
return clazz.getDeclaredConstructor().newInstance(); // Create instance
return clazz.getDeclaredConstructor().newInstance();
} catch (Exception e) {
e.printStackTrace();
}
}
}
return null; // or throw an exception if not found
return null;
}
}

0 comments on commit c1f8fef

Please sign in to comment.