dev@glassfish.java.net

Re: pom review request

From: Romain Grecourt <romain.grecourt_at_oracle.com>
Date: Tue, 19 Mar 2013 14:37:12 +0100

On 3/19/13 2:26 PM, Rajendra Inamdar wrote:
> Please review pom.xml changes for logging migration in
> main/nucleus/osgi-platforms/osgi-container:
pom change looks good to me.

Thanks,
Romain
>
> Sahoo: Also, please review changes in OSGiArchiveHandler.java
>
> Thanks,
> /Raj
>
> Index: pom.xml
> ===================================================================
> --- pom.xml (revision 60562)
> +++ pom.xml (working copy)
> @@ -92,5 +92,10 @@
> <artifactId>internal-api</artifactId>
> <version>${project.version}</version>
> </dependency>
> + <dependency>
> + <groupId>org.glassfish.annotations</groupId>
> + <artifactId>logging-annotation-processor</artifactId>
> + <optional>true</optional>
> + </dependency>
> </dependencies>
> </project>
>
> Index:
> src/main/java/org/glassfish/extras/osgicontainer/OSGiArchiveHandler.java
> ===================================================================
> ---
> src/main/java/org/glassfish/extras/osgicontainer/OSGiArchiveHandler.java
> (revision 60562)
> +++
> src/main/java/org/glassfish/extras/osgicontainer/OSGiArchiveHandler.java
> (working copy)
> @@ -1,7 +1,7 @@
> /*
> * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
> *
> - * Copyright (c) 1997-2012 Oracle and/or its affiliates. All rights
> reserved.
> + * Copyright (c) 1997-2013 Oracle and/or its affiliates. All rights
> reserved.
> *
> * The contents of this file are subject to the terms of either the GNU
> * General Public License Version 2 only ("GPL") or the Common
> Development
> @@ -59,6 +59,10 @@
> import java.util.logging.Level;
> import java.util.logging.Logger;
>
> +import org.glassfish.logging.annotation.LogMessageInfo;
> +import org.glassfish.logging.annotation.LogMessagesResourceBundle;
> +import org.glassfish.logging.annotation.LoggerInfo;
> +
> /**
> * Archive Handler for OSGi modules.
> * This understands a special deployment property called UriScheme.
> @@ -77,7 +81,18 @@
> @Singleton
> public class OSGiArchiveHandler extends GenericHandler implements
> CompositeHandler {
>
> - private static Logger logger =
> Logger.getLogger(OSGiArchiveHandler.class.getPackage().getName());
> + @LoggerInfo(subsystem = "OSGI", description="OSGI container
> logger", publish=true)
> + private static final String LOGGER_NAME =
> "javax.enterprise.osgi.container";
> +
> + @LogMessagesResourceBundle()
> + public static final String RB_NAME =
> "org.glassfish.extras.osgicontainer.LogMessages";
> +
> + private static Logger logger = Logger.getLogger(LOGGER_NAME,
> RB_NAME);
> +
> + @LogMessageInfo(message = "Decorated url = {0}", level="INFO")
> + public static final String DECORATED_URL = "NCLS-OSGI-00001";
> +
> +
> @Inject
> private OSGiArchiveDetector detector;
> private String URI_SCHEME_PROP_NAME = "UriScheme";
> @@ -131,7 +146,7 @@
> // if UriScheme is specified, we need to construct a new
> URL based on user's input
> // and souce parameter and call openConnection() and
> getInputStream() on it.
> URL url = prepareUrl(context, props);
> - logger.logp(Level.INFO, "OSGiArchiveHandler", "expand",
> "Decorated url = {0}", new Object[]{url});
> + logger.log(Level.INFO, DECORATED_URL, new Object[]{url});
> final JarInputStream jis = new
> JarInputStream(url.openStream());
> expandJar(jis, target);
> } else {
>