result.add(entry.getKey());
}
}
- return BundleScanner.loadClasses(bundle, result);
+ return BundleScanner.loadClasses(result, bundle);
}
private boolean matches(Pattern pattern, Set<String> values) {
return false;
}
+ /**
+ * Get classes with annotations matching a pattern
+ *
+ * @param allbundles - all bundles
+ * @param pattern - annotation pattern to match
+ * @param initBundle - the bundle which initiated this call
+ *
+ * @return list of annotated classes matching the pattern
+ */
public List<Class<?>> getAnnotatedClasses(
Collection<BundleInfo> allbundles,
- Pattern pattern)
+ Pattern pattern, Bundle initBundle)
{
List<Class<?>> classes = getAnnotatedClasses(pattern);
processAnnotatedClassesInternal(this, allbundles, pattern,
- new HashSet<BundleInfo>(), classes);
+ new HashSet<BundleInfo>(), classes, initBundle);
return classes;
}
Collection<BundleInfo> bundlesToScan,
Pattern pattern,
Collection<BundleInfo> visited,
- List<Class<?>> classes)
+ List<Class<?>> classes,
+ Bundle initBundle)
{
for (BundleInfo other : bundlesToScan) {
if (other.getId() == target.getId()) continue;
if (target.isDependantOn(other)) {
if (!visited.contains(other)) {
- classes.addAll(BundleScanner.loadClasses(other.getBundle(),
- other.getExportedAnnotatedClasses(pattern)));
+ classes.addAll(BundleScanner.loadClasses(
+ other.getExportedAnnotatedClasses(pattern), initBundle));
visited.add(other);
processAnnotatedClassesInternal(other, bundlesToScan,
- pattern, visited, classes);
+ pattern, visited, classes, initBundle);
}
}
}
Pattern pattern = mergePatterns(annotations, false);
List<Class<?>> result = null;
if (includeDependentBundleClasses) {
- result = info.getAnnotatedClasses(bundleAnnotations.values(), pattern);
+ result = info.getAnnotatedClasses(bundleAnnotations.values(),
+ pattern, context.getBundle());
} else {
result = info.getAnnotatedClasses(pattern);
}
// find bundle dependencies
}
- public static List<Class<?>> loadClasses(Bundle bundle,
- Collection<String> annotatedClasses)
+ public static List<Class<?>> loadClasses(
+ Collection<String> annotatedClasses,
+ Bundle initBundle)
{
List<Class<?>> result = new ArrayList<Class<?>>();
+ StringBuilder errors = new StringBuilder();
for (String name : annotatedClasses) {
try {
- result.add(bundle.loadClass(name));
- } catch (Exception e) {
- LOGGER.error("Unable to load class: {}", name, e);
+ result.add(initBundle.loadClass(name));
+ } catch (ClassNotFoundException e) {
+ errors.append(name).append(", ");
}
}
+ if (LOGGER.isDebugEnabled() && errors.length() > 0) {
+ LOGGER.debug("Bundle: {} could not load classes: {}",
+ initBundle.getSymbolicName(), errors.toString());
+ }
return result;
}
import javax.ws.rs.Consumes;
import javax.ws.rs.core.GenericEntity;
import javax.ws.rs.core.MediaType;
-import javax.ws.rs.Produces;
import javax.ws.rs.core.Response;
import javax.ws.rs.ext.ExceptionMapper;
import javax.ws.rs.ext.Provider;
* A custom exception mapper for handling Jackson JsonProcessingException types
*/
@Provider
-@Consumes({MediaType.APPLICATION_JSON, "text/json"})
+@Consumes({MediaType.APPLICATION_JSON})
public class JacksonJsonProcessingExceptionMapper
implements ExceptionMapper<JsonProcessingException>
{
*/
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
-@XmlSeeAlso({ Controller.class, Drop.class, Flood.class, FloodAll.class, HwPath.class, Loopback.class, Output.class,
- PopVlan.class, PushVlan.class, SetDlDst.class, SetDlSrc.class, SetDlType.class, SetNwDst.class, SetNwSrc.class,
- SetNwTos.class, SetTpDst.class, SetTpSrc.class, SetVlanCfi.class, SetVlanId.class, SetVlanPcp.class,
- SwPath.class })
public abstract class Action implements Serializable {
private static final long serialVersionUID = 1L;
private static final Logger logger = LoggerFactory.getLogger(Action.class);
*/
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
-@XmlSeeAlso({ Config.class, Name.class, State.class, TimeStamp.class,
- Latency.class, Bandwidth.class, Tier.class, Actions.class,
- AdvertisedBandwidth.class, Buffers.class, Capabilities.class,
- MacAddress.class, PeerBandwidth.class, SupportedBandwidth.class,
- Tables.class, Description.class, ForwardingMode.class })
abstract public class Property implements Serializable, Cloneable {
private static final long serialVersionUID = 1L;
private final String name;
*
*/
@XmlRootElement
-@XmlSeeAlso( { EthernetAddress.class })
abstract public class DataLinkAddress implements Serializable {
private static final long serialVersionUID = 1L;
private String name;
*
* @return A clone of this DataLinkAddress
*/
+ @Override
abstract public DataLinkAddress clone();
/**