Java Code Examples for org.jfree.util.Log#debug()

The following examples show how to use org.jfree.util.Log#debug() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PackageManager.java    From ccu-historian with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Loads all modules mentioned in the report configuration starting with
 * the given prefix. This method is used during the boot process of
 * JFreeReport. You should never need to call this method directly.
 *
 * @param modulePrefix the module prefix.
 */
public void load(final String modulePrefix) {
    if (this.initSections.contains(modulePrefix)) {
        return;
    }
    this.initSections.add(modulePrefix);

    final Configuration config = this.booter.getGlobalConfig();
    final Iterator it = config.findPropertyKeys(modulePrefix);
    int count = 0;
    while (it.hasNext()) {
        final String key = (String) it.next();
        if (key.endsWith(".Module")) {
            final String moduleClass = config.getConfigProperty(key);
            if (moduleClass != null && moduleClass.length() > 0) {
                addModule(moduleClass);
                count++;
            }
        }
    }
    Log.debug("Loaded a total of " + count + " modules under prefix: " + modulePrefix);
}
 
Example 2
Source File: ParserFrontend.java    From ccu-historian with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Returns a SAX parser.
 *
 * @return a SAXParser.
 *
 * @throws ParserConfigurationException if there is a problem configuring the parser.
 * @throws SAXException if there is a problem with the parser initialisation
 */
protected SAXParser getParser() throws ParserConfigurationException, SAXException {
    if (this.factory == null) {
        this.factory = SAXParserFactory.newInstance();
        if (isValidateDTD()) {
            try {
                // dont touch the validating feature, if not needed ..
                this.factory.setValidating(true);
            }
            catch (Exception ex) {
                // the parser does not like the idea of validating ...
                Log.debug("The parser will not validate the xml document.", ex);
            }
        }
    }
    return this.factory.newSAXParser();
}
 
Example 3
Source File: PropertyFileConfiguration.java    From ccu-historian with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Loads the properties stored in the given file. This method does nothing if
 * the file does not exist or is unreadable. Appends the contents of the loaded
 * properties to the already stored contents.
 *
 * @param resourceName the file name of the stored properties.
 * @param resourceSource ?
 */
public void load(final String resourceName, final Class resourceSource)
{
  final InputStream in = ObjectUtilities.getResourceRelativeAsStream
          (resourceName, resourceSource);
  if (in != null)
  {
    try
    {
      load(in);
    }
    finally
    {
      try
      {
        in.close();
      }
      catch (IOException e)
      {
        // ignore
      }
    }
  }
  else
  {
    Log.debug ("Configuration file not found in the classpath: " + resourceName);
  }

}
 
Example 4
Source File: DescriptionModel.java    From ccu-historian with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Removes any class descriptions that are not fully defined.
 */
public void prune() {
    final ClassDescription[] cds = (ClassDescription[]) this.classes.toArray(new ClassDescription[0]);
    for (int i = 0; i < cds.length; i++) {
        if (cds[i].isUndefined()) {
            removeClassDescription(cds[i]);
            Log.debug("Pruned: " + cds[i].getName());
        }
    }
}
 
Example 5
Source File: JavaSourceCollector.java    From ccu-historian with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Adds a base class that should be ignored.
 * 
 * @param baseClass  the base class name.
 */
public void addIgnoredBaseClass(final String baseClass) {
    final Class loadedClass = loadClass(baseClass);
    if (loadedClass != null) {
        Log.debug (new Log.SimpleMessage("Added IgnClass: " , baseClass));
        this.ignoredBaseClasses.add(loadedClass);
    }
}
 
Example 6
Source File: JavaSourceCollector.java    From ccu-historian with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Collects the files/classes.
 * 
 * @param directory  the starting directory.
 * @param packageName  the initial package name.
 */
protected void collectFiles(final File directory, final String packageName) {
    final File[] files = directory.listFiles(this.eff);
    for (int i = 0; i < files.length; i++) {
        if (files[i].isDirectory()) {
            collectFiles(files[i], buildJavaName(packageName, files[i].getName()));
        }
        else {
            final String fname = files[i].getName();
            final String className = fname.substring(0, fname.length() - 5);
            final String fullName = buildJavaName(packageName, className);
            if (isIgnoredPackage(fullName)) {
                Log.debug (new Log.SimpleMessage("Do not process: Ignored: ", className));
                continue;
            }
            final Class jclass = loadClass(fullName);
            if (jclass == null || isIgnoredBaseClass(jclass)) {
                continue;
            }
            if (jclass.isInterface() || Modifier.isAbstract(jclass.getModifiers())) {
                Log.debug (new Log.SimpleMessage("Do not process: Abstract: ", className));
                continue;
            }
            if (!Modifier.isPublic(jclass.getModifiers())) {
                Log.debug (new Log.SimpleMessage("Do not process: Not public: ", className));
                continue;
            }
            this.fileList.add(jclass);
        }
    }
}
 
Example 7
Source File: DescriptionGenerator.java    From ccu-historian with GNU General Public License v3.0 5 votes vote down vote up
/**
     * Runs the generator, using the 'generator.properties' file for configuration info.
     * 
     * @param args  command line arguments.
     * 
     * @throws Exception if something goes wrong!
     */
    public static void main(final String[] args) throws Exception {

        Log.getInstance().addTarget(new PrintStreamLogTarget());
        
        URL propertyURL = ObjectUtilities.getResourceRelative
                ("generator.properties", DescriptionGenerator.class);
        if (args.length > 0) {
            final File f = new File(args[0]);
            propertyURL = f.toURL();
        }
        final Properties p = loadProperties(propertyURL);

        final String handlerSource = p.getProperty("attributedefinition");
        if (handlerSource != null) {
            final Properties handlers = loadProperties(new URL(propertyURL, handlerSource));
            ModelBuilder.getInstance().addAttributeHandlers(handlers);
        }

        final String source = p.getProperty("sourcedirectory", ".");
        final String target = p.getProperty("targetfile", "model.xml");
        DescriptionModel model = null;
        try {
            model = new DefaultModelReader().load(target);
        }
        catch (Exception e) {
            Log.debug("Unable to load default model. Ignoring...");
        }
//        Log.debug (model.getModelComments());
        model = generate(source, p, model);
        model.prune();
        writeMultiFile(target, model);
        System.exit(0);
    }
 
Example 8
Source File: DescriptionGenerator.java    From ccu-historian with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Writes the class description model to a single file.
 * 
 * @param target  the target file name.
 * @param model  the class description model.
 * 
 * @throws IOException if there is an I/O problem.
 */
public static void writeSingleFile(final String target, final DescriptionModel model) throws IOException {
    Log.debug ("Writing ...");
    final ModelWriter writer = new ModelWriter();
    writer.setModel(model);
    final Writer w = new BufferedWriter(new FileWriter(target));
    writer.write(w);
    w.close();
}
 
Example 9
Source File: GephiSolver.java    From ServiceCutter with Apache License 2.0 5 votes vote down vote up
SolverResult solveWithGirvanNewman(final int numberOfClusters) {
	Log.debug("solve cluster with numberOfClusters = " + numberOfClusters);
	GirvanNewmanClusterer clusterer = new GirvanNewmanClusterer();
	clusterer.setPreferredNumberOfClusters(numberOfClusters);
	clusterer.execute(graphModel);
	SolverResult solverResult = new SolverResult(getClustererResult(clusterer));
	return solverResult;
}
 
Example 10
Source File: AbstractTabbedUI.java    From ccu-historian with GNU General Public License v3.0 5 votes vote down vote up
/**
 * This method gets called when a bound property is changed.
 *
 * @param evt A PropertyChangeEvent object describing the event source
 *            and the property that has changed.
 */
public void propertyChange(final PropertyChangeEvent evt) {
    if (evt.getPropertyName().equals("enabled") == false) {
        Log.debug ("PropertyName");
        return;
    }
    if (evt.getSource() instanceof RootEditor == false) {
        Log.debug ("Source");
        return;
    }
    final RootEditor editor = (RootEditor) evt.getSource();
    updateRootEditorEnabled(editor);
}
 
Example 11
Source File: ParserFrontend.java    From ccu-historian with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Configures the xml reader. Use this to set features or properties
 * before the documents get parsed.
 *
 * @param handler the parser implementation that will handle the SAX-Callbacks.
 * @param reader the xml reader that should be configured.
 */
protected void configureReader(final XMLReader reader, final FrontendDefaultHandler handler) {
    try {
        reader.setProperty
            ("http://xml.org/sax/properties/lexical-handler", handler.getCommentHandler());
    }
    catch (SAXException se) {
        Log.debug("Comments are not supported by this SAX implementation.");
    }
}
 
Example 12
Source File: AbstractModelReader.java    From ccu-historian with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Parses the given specification and loads all includes specified in the files.
 * This implementation does not check for loops in the include files.
 *
 * @param resource  the url of the xml specification.
 * @param isInclude  an include?
 * 
 * @throws org.jfree.xml.util.ObjectDescriptionException if an error occured which prevented the
 * loading of the specifications.
 */
protected void parseXmlDocument(final URL resource, final boolean isInclude)
    throws ObjectDescriptionException {
    
    try {
        final InputStream in = new BufferedInputStream(resource.openStream());
        final SAXParserFactory factory = SAXParserFactory.newInstance();
        final SAXParser saxParser = factory.newSAXParser();
        final XMLReader reader = saxParser.getXMLReader();

        final SAXModelHandler handler = new SAXModelHandler(resource, isInclude);
        try {
            reader.setProperty
                ("http://xml.org/sax/properties/lexical-handler",
                    getCommentHandler());
        }
        catch (SAXException se) {
            Log.debug("Comments are not supported by this SAX implementation.");
        }
        reader.setContentHandler(handler);
        reader.setDTDHandler(handler);
        reader.setErrorHandler(handler);
        reader.parse(new InputSource(in));
        in.close();
    }
    catch (Exception e) {
        // unable to init
        Log.warn("Unable to load factory specifications", e);
        throw new ObjectDescriptionException("Unable to load object factory specs.", e);
    }
}
 
Example 13
Source File: IntegerAttributeHandler.java    From ccu-historian with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Converts the attribute to a string.
 *
 * @param o  the attribute ({@link Integer} expected).
 * 
 * @return A string representing the integer value.
 */
public String toAttributeValue(final Object o) {
    try {
        final Integer in = (Integer) o;
        return in.toString();
    }
    catch (ClassCastException cce) {
        if (o != null) {
            Log.debug("ClassCastException: Expected Integer, found " + o.getClass());
        }
        throw cce;
    }
}
 
Example 14
Source File: BusinessGroupServiceImpl.java    From olat with Apache License 2.0 4 votes vote down vote up
/**
 * @see org.olat.lms.group.BusinessGroupService#deleteBusinessGroup(org.olat.data.group.BusinessGroup)
 */
@Override
public void deleteBusinessGroup(BusinessGroup businessGroupTodelete) {

    final OLATResourceableJustBeforeDeletedEvent delEv = new OLATResourceableJustBeforeDeletedEvent(businessGroupTodelete);
    // notify all (currently running) BusinessGroupXXXcontrollers
    // about the deletion which will occur.
    CoordinatorManager.getInstance().getCoordinator().getEventBus().fireEventToListenersOf(delEv, businessGroupTodelete);

    final String type = businessGroupTodelete.getType();
    // refresh object to avoid stale object exceptions
    businessGroupTodelete = loadBusinessGroup(businessGroupTodelete);
    // 0) Loop over all deletableGroupData
    for (final DeletableGroupData deleteListener : deleteListeners) {
        Log.debug("deleteBusinessGroup: call deleteListener=" + deleteListener);
        deleteListener.deleteGroupDataFor(businessGroupTodelete);
    }
    ProjectBrokerManagerFactory.getProjectBrokerManager().deleteGroupDataFor(businessGroupTodelete);
    // 1) Delete all group properties
    final CollaborationTools ct = CollaborationToolsFactory.getInstance().getOrCreateCollaborationTools(businessGroupTodelete);
    ct.deleteTools(businessGroupTodelete);// deletes everything concerning properties&collabTools
    // 1.b)delete display member property
    final BusinessGroupPropertyManager bgpm = new BusinessGroupPropertyManager(businessGroupTodelete);
    bgpm.deleteDisplayMembers();
    // 2) Delete the group areas
    if (BusinessGroup.TYPE_LEARNINGROUP.equals(type)) {
        BGAreaDaoImpl.getInstance().deleteBGtoAreaRelations(businessGroupTodelete);
    }
    // 3) Delete the group object itself on the database
    businessGroupDAO.deleteBusinessGroup(businessGroupTodelete);
    // 4) Delete the associated security groups
    if (BusinessGroup.TYPE_BUDDYGROUP.equals(type) || BusinessGroup.TYPE_LEARNINGROUP.equals(type)) {
        final SecurityGroup owners = businessGroupTodelete.getOwnerGroup();
        securityManager.deleteSecurityGroup(owners);
    }
    // in all cases the participant groups
    final SecurityGroup partips = businessGroupTodelete.getPartipiciantGroup();
    securityManager.deleteSecurityGroup(partips);
    // Delete waiting-group when one exists
    if (businessGroupTodelete.getWaitingGroup() != null) {
        securityManager.deleteSecurityGroup(businessGroupTodelete.getWaitingGroup());
    }

    // delete potential jabber group roster
    if (InstantMessagingModule.isEnabled()) {
        final String groupID = InstantMessagingModule.getAdapter().createChatRoomString(businessGroupTodelete);
        InstantMessagingModule.getAdapter().deleteRosterGroup(groupID);
    }
    log.info("Audit:Deleted Business Group" + businessGroupTodelete.toString());

}
 
Example 15
Source File: BusinessGroupServiceImpl.java    From olat with Apache License 2.0 4 votes vote down vote up
/**
 * @see org.olat.lms.group.BusinessGroupService#deleteBusinessGroup(org.olat.data.group.BusinessGroup)
 */
@Override
public void deleteBusinessGroup(BusinessGroup businessGroupTodelete) {

    final OLATResourceableJustBeforeDeletedEvent delEv = new OLATResourceableJustBeforeDeletedEvent(businessGroupTodelete);
    // notify all (currently running) BusinessGroupXXXcontrollers
    // about the deletion which will occur.
    CoordinatorManager.getInstance().getCoordinator().getEventBus().fireEventToListenersOf(delEv, businessGroupTodelete);

    final String type = businessGroupTodelete.getType();
    // refresh object to avoid stale object exceptions
    businessGroupTodelete = loadBusinessGroup(businessGroupTodelete);
    // 0) Loop over all deletableGroupData
    for (final DeletableGroupData deleteListener : deleteListeners) {
        Log.debug("deleteBusinessGroup: call deleteListener=" + deleteListener);
        deleteListener.deleteGroupDataFor(businessGroupTodelete);
    }
    ProjectBrokerManagerFactory.getProjectBrokerManager().deleteGroupDataFor(businessGroupTodelete);
    // 1) Delete all group properties
    final CollaborationTools ct = CollaborationToolsFactory.getInstance().getOrCreateCollaborationTools(businessGroupTodelete);
    ct.deleteTools(businessGroupTodelete);// deletes everything concerning properties&collabTools
    // 1.b)delete display member property
    final BusinessGroupPropertyManager bgpm = new BusinessGroupPropertyManager(businessGroupTodelete);
    bgpm.deleteDisplayMembers();
    // 2) Delete the group areas
    if (BusinessGroup.TYPE_LEARNINGROUP.equals(type)) {
        BGAreaDaoImpl.getInstance().deleteBGtoAreaRelations(businessGroupTodelete);
    }
    // 3) Delete the group object itself on the database
    businessGroupDAO.deleteBusinessGroup(businessGroupTodelete);
    // 4) Delete the associated security groups
    if (BusinessGroup.TYPE_BUDDYGROUP.equals(type) || BusinessGroup.TYPE_LEARNINGROUP.equals(type)) {
        final SecurityGroup owners = businessGroupTodelete.getOwnerGroup();
        securityManager.deleteSecurityGroup(owners);
    }
    // in all cases the participant groups
    final SecurityGroup partips = businessGroupTodelete.getPartipiciantGroup();
    securityManager.deleteSecurityGroup(partips);
    // Delete waiting-group when one exists
    if (businessGroupTodelete.getWaitingGroup() != null) {
        securityManager.deleteSecurityGroup(businessGroupTodelete.getWaitingGroup());
    }

    // delete the publisher attached to this group (e.g. the forum and folder
    // publisher)
    notificationService.deletePublishersOf(businessGroupTodelete);

    // delete potential jabber group roster
    if (InstantMessagingModule.isEnabled()) {
        final String groupID = InstantMessagingModule.getAdapter().createChatRoomString(businessGroupTodelete);
        InstantMessagingModule.getAdapter().deleteRosterGroup(groupID);
    }
    log.info("Audit:Deleted Business Group" + businessGroupTodelete.toString());

}
 
Example 16
Source File: GenericWriteHandler.java    From ccu-historian with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Performs the writing of a generic object.
 *
 * @param tagName  the tag name.
 * @param object  the generic object.
 * @param writer  the writer.
 * @param mPlexAttribute  ??.
 * @param mPlexValue  ??.
 * 
 * @throws IOException if there is an I/O error.
 * @throws XMLWriterException if there is a writer error.
 */
public void write(final String tagName, final Object object, final XMLWriter writer,
                  final String mPlexAttribute, final String mPlexValue)
    throws IOException, XMLWriterException {

    try {
        this.factory.readProperties(object);

        final AttributeList attributes = new AttributeList();
        if (mPlexAttribute != null) {
            attributes.setAttribute(mPlexAttribute, mPlexValue);
        }
        final AttributeDefinition[] attribDefs = this.factory.getAttributeDefinitions();
        final ArrayList properties = new ArrayList();
        for (int i = 0; i < attribDefs.length; i++) {
            final AttributeDefinition adef = attribDefs[i];
            final String pName = adef.getAttributeName();
            final Object propValue = this.factory.getProperty(adef.getPropertyName());
            if (propValue != null) {
                Log.debug(
                    "Here: " + this.factory.getBaseClass() + " -> " + adef.getPropertyName()
                );
                final String value = adef.getHandler().toAttributeValue(propValue);
                if (value != null) {
                    attributes.setAttribute(pName, value);
                }
            }
            properties.add(adef.getPropertyName());
        }
        writer.writeTag(tagName, attributes, false);
        writer.startBlock();

        final PropertyDefinition[] propertyDefs = this.factory.getPropertyDefinitions();
        final RootXmlWriteHandler rootHandler = getRootHandler();
        for (int i = 0; i < propertyDefs.length; i++) {
            final PropertyDefinition pDef = propertyDefs[i];
            final String elementName = pDef.getElementName();
            rootHandler.write
                (elementName, this.factory.getProperty(pDef.getPropertyName()),
                        this.factory.getTypeForTagName(elementName), writer);
        }
        writer.endBlock();
        writer.writeCloseTag(tagName);
    }
    catch (ObjectDescriptionException ode) {
        Log.warn ("Unable to write element", ode);
        throw new IOException(ode.getMessage());
    }
}
 
Example 17
Source File: DescriptionGenerator.java    From ccu-historian with GNU General Public License v3.0 3 votes vote down vote up
/**
 * Writes the class description model to multiple files.
 * 
 * @param target  the target file name.
 * @param model  the class description model.
 * 
 * @throws IOException if there is an I/O problem.
 */
public static void writeMultiFile(final String target, final DescriptionModel model) throws IOException {
    Log.debug ("Writing multiple files ...");
    final SplittingModelWriter writer = new SplittingModelWriter();
    writer.setModel(model);
    writer.write(target);
}
 
Example 18
Source File: JavaSourceCollector.java    From ccu-historian with GNU General Public License v3.0 2 votes vote down vote up
/**
 * Adds a package that should be ignored.
 * 
 * @param pkg  the package name.
 */
public void addIgnoredPackage(final String pkg) {
    Log.debug (new Log.SimpleMessage("Added IgnPackage: " , pkg));
    this.ignoredPackages.add(pkg);
}
 
Example 19
Source File: DescriptionModel.java    From ccu-historian with GNU General Public License v3.0 2 votes vote down vote up
/**
 * Sets the model comments.
 * 
 * @param modelComments  the model comments.
 */
public void setModelComments(final Comments modelComments) {
    Log.debug ("Model: Comment set: " + modelComments);
    this.modelComments = modelComments;
}