Skip to content

Commit

Permalink
replace System.out.println with logger messages
Browse files Browse the repository at this point in the history
and some compile warning cleanup
  • Loading branch information
steve-hickman-epistimis committed Jan 22, 2024
1 parent f790782 commit 3a984cb
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,6 @@ public void completePlatformStruct_Member(EObject model, Assignment assignment,
if (count < 2) {
String msg = MessageFormat.format(STRUCT_REALIZATION_ERR,ps.getName(),meas.getName(), count);
logger.error(msg);
System.out.println(msg);
}
String ndent = PropUtils.indent(qnp.getFullyQualifiedName(model).getSegmentCount());
StringBuilder insertionText = new StringBuilder();
Expand Down
44 changes: 21 additions & 23 deletions com.epistimis.uddl/src/com/epistimis/uddl/RealizationProcessor.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,22 @@ public abstract class RealizationProcessor<BaseComposableElement extends UddlEle
BaseAssociation extends BaseEntity, RealizingAssociation extends RealizingEntity,
BaseProcessor extends EntityProcessor<BaseComposableElement, BaseCharacteristic, BaseEntity, BaseAssociation, BaseComposition, BaseParticipant, ?, ?>,
RealizingProcessor extends EntityProcessor<RealizingComposableElement, RealizingCharacteristic, RealizingEntity, RealizingAssociation, RealizingComposition, RealizingParticipant, ?, ?>> {
// @Inject
//private Provider<ResourceSet> resourceSetProvider;
//
//
//@Inject
//IResourceServiceProvider.Registry reg;
//
//IResourceServiceProvider queryRSP;
//IResourceFactory queryResFactory;

//@Inject
//ParseHelper<QuerySpecification> parseHelper;

private static Logger logger = Logger.getLogger(MethodHandles.lookup().lookupClass());

private static final String ASSOCIATION_REALIZATION_ERR_FMT = "Association {0} must be realized by an Association but {0} is an Entity";
// @Inject
//private Provider<ResourceSet> resourceSetProvider;
//
//
//@Inject
//IResourceServiceProvider.Registry reg;
//
//IResourceServiceProvider queryRSP;
//IResourceFactory queryResFactory;

//@Inject
//ParseHelper<QuerySpecification> parseHelper;

@Inject
IndexUtilities ndxUtil;
Expand All @@ -62,7 +66,6 @@ public abstract class RealizationProcessor<BaseComposableElement extends UddlEle
@Inject
RealizingProcessor realizingProcessor;

private static Logger logger = Logger.getLogger(MethodHandles.lookup().lookupClass());

static MessageFormat CharacteristicNotFoundMsgFmt = new MessageFormat(
"Entity {0} does not have a characteristic with rolename {1}");
Expand Down Expand Up @@ -208,7 +211,7 @@ public List<BaseParticipant> getRealizedParticipants(RealizingEntity rentity) {
BaseEntity be = getRealizedEntity(rentity);
if (baseProcessor.isAssociation(be)) {
// If the base is an association but the realization isn't, then that's an error
String msg = MessageFormat.format("Association {0} must be realized by an Association but {0} is an Entity",
String msg = MessageFormat.format(ASSOCIATION_REALIZATION_ERR_FMT,
qnp.getFullyQualifiedName(be).toString(), qnp.getFullyQualifiedName(rentity).toString());
logger.error(msg);
//throw new RealizationException(msg); // TODO: Throw or return empty list? See also (logical/platform)Extensions.ocl invariants - this is checked there
Expand Down Expand Up @@ -270,15 +273,12 @@ public Collection<EObject> getRealizingTypes( /*List<EPackage> pkgs,*/ EObject t
ResourceSet resourceSet = type2Realize.eResource().getResourceSet();
Collection<EObject> found = ndxUtil.processAQL(resourceSet, /*pkgs,*/variables,"self.eInverse('realizes')");
return found;
// Set<UddlElement> result = new HashSet<UddlElement>();
// for (EObject e : found) {
// result.add((UddlElement) e);
// }
// return result;

}

/**
* Find a single realizing type, logging if none or mone than one is found
* Find a single realizing type, logging if none or mone than one is found.
*
* @param pkgs All the root ePackages that must be registered for the search
* @param type2Realize The type we want to realize
* @param emptyMsgFmt Message format string for empty collection
Expand All @@ -290,13 +290,11 @@ public EObject getRealizingType( /*List<EPackage> pkgs,*/ EObject type2Realize,
if ((found == null) || (found.size() == 0 )) {
String msg = MessageFormat.format(emptyMsgFmt, qnp.getFullyQualifiedName(type2Realize));
logger.error(msg);
System.out.println(msg);
return null;
}
if (found.size() > 1) {
String msg = MessageFormat.format(manyMsgFmt, qnp.getFullyQualifiedName(type2Realize));
logger.info(msg);
System.out.println(msg);
logger.info(msg);
}
// Return the first one found
return found.iterator().next();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,24 +72,21 @@ class UddlGenerator extends AbstractGenerator {
gen2.doGenerate(resource, fsa, context);
}
catch (Exception excp) {
logger.error("Protobuf exception: " + excp.localizedMessage,excp);
//System.out.println(excp.stackTrace);
logger.error("Protobuf exception: " + excp.localizedMessage,excp); //(excp.stackTrace);
}
try {
val gen1 = new IDLDataStructureGenerator(RealizedComposableElement.allComposableElements);
gen1.doGenerate(resource, fsa, context);
}
catch (Exception excp) {
logger.error("IDL exception: " + excp.localizedMessage,excp);
//System.out.println(excp.stackTrace);
logger.error("IDL exception: " + excp.localizedMessage,excp); //(excp.stackTrace);
}
try {
val gen3 = new RDBMSDataStructureGenerator(RealizedComposableElement.allComposableElements);
gen3.doGenerate(resource, fsa, context);
}
catch (Exception excp) {
logger.error("RDBMS exception: " + excp.localizedMessage,excp);
//System.out.println(excp.stackTrace);
logger.error("RDBMS exception: " + excp.localizedMessage,excp); //(excp.stackTrace);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ public static void initializeResourceSet(ResourceSet resourceSet, String... bund
uriMap.put(resourceURI, pluginURI);
uriMap.put(pluginURI, locationURI);
} else {
System.err.println("initializeResourceSet failed to resolve '" + bundleName + "'");
logger.error("initializeResourceSet failed to resolve '" + bundleName + "'");
}
}
}
Expand Down

0 comments on commit 3a984cb

Please sign in to comment.