@Test(expected = IllegalArgumentException.class) public void testCreateEventDescriptorsNullClassNames() throws Exception { EventDescriptorFactory.createEventDescriptors (null); }
public static List<EventDescriptor> createEventDescriptors(String classpath, String... classNames) throws MalformedURLException, ResolverException, ClassNotFoundException, URISyntaxException { if(classNames==null) throw new IllegalArgumentException("classNames must not be null"); if(classNames.length==0) throw new IllegalArgumentException("classNames must not be empty"); final List<EventDescriptor> eventDescriptors = new ArrayList<EventDescriptor>(); if (classpath != null) { ClassAnnotator annotator = null; String[] classPath; if (Artifact.isArtifact(classpath)) { ArtifactURLConfiguration artifactURLConfiguration = new ArtifactURLConfiguration(classpath); StringBuilder artifactBuilder = new StringBuilder(); artifactBuilder.append("artifact:").append(artifactURLConfiguration.getArtifact()); annotator = new ClassAnnotator(new URL[]{new URL(artifactBuilder.toString())}); String[] cp = ResolverHelper.getResolver().getClassPathFor(classpath); classPath = new String[cp.length]; for (int i = 0; i < classPath.length; i++) { String s = cp[i].startsWith("file:") ? cp[i] : "file:" + cp[i]; classPath[i] = ResolverHelper.handleWindows(s); } } else { classPath = StringUtil.toArray(classpath, " ,"); } URL[] urls = new URL[classPath.length]; for (int i = 0; i < classPath.length; i++) { urls[i] = new URL(classPath[i]); } URLClassLoader loader; if(annotator!=null) { loader = new ServiceClassLoader(ServiceClassLoader.getURIs(urls), annotator, Thread.currentThread().getContextClassLoader()); } else { loader = new URLClassLoader(urls, Thread.currentThread().getContextClassLoader()); } for (String className : classNames) { Class<?> cl = loader.loadClass(className); eventDescriptors.add(new EventDescriptor(cl, getID(cl))); } } else { for (String className : classNames) { Class<?> cl = Thread.currentThread().getContextClassLoader().loadClass(className); eventDescriptors.add(new EventDescriptor(cl, getID(cl))); } } return eventDescriptors; }
EventDescriptorFactory { public static List<EventDescriptor> createEventDescriptors(String classpath, String... classNames) throws MalformedURLException, ResolverException, ClassNotFoundException, URISyntaxException { if(classNames==null) throw new IllegalArgumentException("classNames must not be null"); if(classNames.length==0) throw new IllegalArgumentException("classNames must not be empty"); final List<EventDescriptor> eventDescriptors = new ArrayList<EventDescriptor>(); if (classpath != null) { ClassAnnotator annotator = null; String[] classPath; if (Artifact.isArtifact(classpath)) { ArtifactURLConfiguration artifactURLConfiguration = new ArtifactURLConfiguration(classpath); StringBuilder artifactBuilder = new StringBuilder(); artifactBuilder.append("artifact:").append(artifactURLConfiguration.getArtifact()); annotator = new ClassAnnotator(new URL[]{new URL(artifactBuilder.toString())}); String[] cp = ResolverHelper.getResolver().getClassPathFor(classpath); classPath = new String[cp.length]; for (int i = 0; i < classPath.length; i++) { String s = cp[i].startsWith("file:") ? cp[i] : "file:" + cp[i]; classPath[i] = ResolverHelper.handleWindows(s); } } else { classPath = StringUtil.toArray(classpath, " ,"); } URL[] urls = new URL[classPath.length]; for (int i = 0; i < classPath.length; i++) { urls[i] = new URL(classPath[i]); } URLClassLoader loader; if(annotator!=null) { loader = new ServiceClassLoader(ServiceClassLoader.getURIs(urls), annotator, Thread.currentThread().getContextClassLoader()); } else { loader = new URLClassLoader(urls, Thread.currentThread().getContextClassLoader()); } for (String className : classNames) { Class<?> cl = loader.loadClass(className); eventDescriptors.add(new EventDescriptor(cl, getID(cl))); } } else { for (String className : classNames) { Class<?> cl = Thread.currentThread().getContextClassLoader().loadClass(className); eventDescriptors.add(new EventDescriptor(cl, getID(cl))); } } return eventDescriptors; } }
EventDescriptorFactory { public static List<EventDescriptor> createEventDescriptors(String classpath, String... classNames) throws MalformedURLException, ResolverException, ClassNotFoundException, URISyntaxException { if(classNames==null) throw new IllegalArgumentException("classNames must not be null"); if(classNames.length==0) throw new IllegalArgumentException("classNames must not be empty"); final List<EventDescriptor> eventDescriptors = new ArrayList<EventDescriptor>(); if (classpath != null) { ClassAnnotator annotator = null; String[] classPath; if (Artifact.isArtifact(classpath)) { ArtifactURLConfiguration artifactURLConfiguration = new ArtifactURLConfiguration(classpath); StringBuilder artifactBuilder = new StringBuilder(); artifactBuilder.append("artifact:").append(artifactURLConfiguration.getArtifact()); annotator = new ClassAnnotator(new URL[]{new URL(artifactBuilder.toString())}); String[] cp = ResolverHelper.getResolver().getClassPathFor(classpath); classPath = new String[cp.length]; for (int i = 0; i < classPath.length; i++) { String s = cp[i].startsWith("file:") ? cp[i] : "file:" + cp[i]; classPath[i] = ResolverHelper.handleWindows(s); } } else { classPath = StringUtil.toArray(classpath, " ,"); } URL[] urls = new URL[classPath.length]; for (int i = 0; i < classPath.length; i++) { urls[i] = new URL(classPath[i]); } URLClassLoader loader; if(annotator!=null) { loader = new ServiceClassLoader(ServiceClassLoader.getURIs(urls), annotator, Thread.currentThread().getContextClassLoader()); } else { loader = new URLClassLoader(urls, Thread.currentThread().getContextClassLoader()); } for (String className : classNames) { Class<?> cl = loader.loadClass(className); eventDescriptors.add(new EventDescriptor(cl, getID(cl))); } } else { for (String className : classNames) { Class<?> cl = Thread.currentThread().getContextClassLoader().loadClass(className); eventDescriptors.add(new EventDescriptor(cl, getID(cl))); } } return eventDescriptors; } private  EventDescriptorFactory(); }
EventDescriptorFactory { public static List<EventDescriptor> createEventDescriptors(String classpath, String... classNames) throws MalformedURLException, ResolverException, ClassNotFoundException, URISyntaxException { if(classNames==null) throw new IllegalArgumentException("classNames must not be null"); if(classNames.length==0) throw new IllegalArgumentException("classNames must not be empty"); final List<EventDescriptor> eventDescriptors = new ArrayList<EventDescriptor>(); if (classpath != null) { ClassAnnotator annotator = null; String[] classPath; if (Artifact.isArtifact(classpath)) { ArtifactURLConfiguration artifactURLConfiguration = new ArtifactURLConfiguration(classpath); StringBuilder artifactBuilder = new StringBuilder(); artifactBuilder.append("artifact:").append(artifactURLConfiguration.getArtifact()); annotator = new ClassAnnotator(new URL[]{new URL(artifactBuilder.toString())}); String[] cp = ResolverHelper.getResolver().getClassPathFor(classpath); classPath = new String[cp.length]; for (int i = 0; i < classPath.length; i++) { String s = cp[i].startsWith("file:") ? cp[i] : "file:" + cp[i]; classPath[i] = ResolverHelper.handleWindows(s); } } else { classPath = StringUtil.toArray(classpath, " ,"); } URL[] urls = new URL[classPath.length]; for (int i = 0; i < classPath.length; i++) { urls[i] = new URL(classPath[i]); } URLClassLoader loader; if(annotator!=null) { loader = new ServiceClassLoader(ServiceClassLoader.getURIs(urls), annotator, Thread.currentThread().getContextClassLoader()); } else { loader = new URLClassLoader(urls, Thread.currentThread().getContextClassLoader()); } for (String className : classNames) { Class<?> cl = loader.loadClass(className); eventDescriptors.add(new EventDescriptor(cl, getID(cl))); } } else { for (String className : classNames) { Class<?> cl = Thread.currentThread().getContextClassLoader().loadClass(className); eventDescriptors.add(new EventDescriptor(cl, getID(cl))); } } return eventDescriptors; } private  EventDescriptorFactory(); static List<EventDescriptor> createEventDescriptors(String classpath,
                                                               String... classNames); }
EventDescriptorFactory { public static List<EventDescriptor> createEventDescriptors(String classpath, String... classNames) throws MalformedURLException, ResolverException, ClassNotFoundException, URISyntaxException { if(classNames==null) throw new IllegalArgumentException("classNames must not be null"); if(classNames.length==0) throw new IllegalArgumentException("classNames must not be empty"); final List<EventDescriptor> eventDescriptors = new ArrayList<EventDescriptor>(); if (classpath != null) { ClassAnnotator annotator = null; String[] classPath; if (Artifact.isArtifact(classpath)) { ArtifactURLConfiguration artifactURLConfiguration = new ArtifactURLConfiguration(classpath); StringBuilder artifactBuilder = new StringBuilder(); artifactBuilder.append("artifact:").append(artifactURLConfiguration.getArtifact()); annotator = new ClassAnnotator(new URL[]{new URL(artifactBuilder.toString())}); String[] cp = ResolverHelper.getResolver().getClassPathFor(classpath); classPath = new String[cp.length]; for (int i = 0; i < classPath.length; i++) { String s = cp[i].startsWith("file:") ? cp[i] : "file:" + cp[i]; classPath[i] = ResolverHelper.handleWindows(s); } } else { classPath = StringUtil.toArray(classpath, " ,"); } URL[] urls = new URL[classPath.length]; for (int i = 0; i < classPath.length; i++) { urls[i] = new URL(classPath[i]); } URLClassLoader loader; if(annotator!=null) { loader = new ServiceClassLoader(ServiceClassLoader.getURIs(urls), annotator, Thread.currentThread().getContextClassLoader()); } else { loader = new URLClassLoader(urls, Thread.currentThread().getContextClassLoader()); } for (String className : classNames) { Class<?> cl = loader.loadClass(className); eventDescriptors.add(new EventDescriptor(cl, getID(cl))); } } else { for (String className : classNames) { Class<?> cl = Thread.currentThread().getContextClassLoader().loadClass(className); eventDescriptors.add(new EventDescriptor(cl, getID(cl))); } } return eventDescriptors; } private  EventDescriptorFactory(); static List<EventDescriptor> createEventDescriptors(String classpath,
                                                               String... classNames);  }