You are viewing a plain text version of this content. The canonical link for it is here.
Posted to wsrp4j-dev@portals.apache.org by es...@apache.org on 2007/08/21 04:28:08 UTC
svn commit: r567912 - in
/portals/wsrp4j/trunk/persistence-xml/src/java/org/apache/wsrp4j/persistence/xml/driver:
PersistentHandlerImpl.java ProducerPersistentFactoryImpl.java
Author: esm
Date: Mon Aug 20 19:28:08 2007
New Revision: 567912
URL: http://svn.apache.org/viewvc?rev=567912&view=rev
Log:
Removed log statements
Some code reformatting
Modified:
portals/wsrp4j/trunk/persistence-xml/src/java/org/apache/wsrp4j/persistence/xml/driver/PersistentHandlerImpl.java
portals/wsrp4j/trunk/persistence-xml/src/java/org/apache/wsrp4j/persistence/xml/driver/ProducerPersistentFactoryImpl.java
Modified: portals/wsrp4j/trunk/persistence-xml/src/java/org/apache/wsrp4j/persistence/xml/driver/PersistentHandlerImpl.java
URL: http://svn.apache.org/viewvc/portals/wsrp4j/trunk/persistence-xml/src/java/org/apache/wsrp4j/persistence/xml/driver/PersistentHandlerImpl.java?rev=567912&r1=567911&r2=567912&view=diff
==============================================================================
--- portals/wsrp4j/trunk/persistence-xml/src/java/org/apache/wsrp4j/persistence/xml/driver/PersistentHandlerImpl.java (original)
+++ portals/wsrp4j/trunk/persistence-xml/src/java/org/apache/wsrp4j/persistence/xml/driver/PersistentHandlerImpl.java Mon Aug 20 19:28:08 2007
@@ -45,7 +45,7 @@
*/
public class PersistentHandlerImpl implements PersistentHandler {
- private static final Log log =
+ private static final Log LOG =
LogFactory.getLog(PersistentHandlerImpl.class);
// holds this PersistentHandler
@@ -88,12 +88,6 @@
public void store(PersistentDataObject persistentDataObject)
throws WSRPException {
- String MN = "store";
-
- if (log.isDebugEnabled()) {
- log.debug(Utility.strEnter(MN));
- }
-
Mapping mapping = null;
Marshaller marshaller = null;
FileWriter fileWriter = null;
@@ -118,8 +112,8 @@
File file = new File(filename);
- if (log.isDebugEnabled()) {
- log.debug("Filename for store: " + filename +
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Filename for store: " + filename +
" with code: " + code);
}
@@ -140,13 +134,9 @@
} catch (Exception e) {
// could not store object to persistent file
- WSRPXHelper.throwX(log, ErrorCodes.STORE_OBJECT_ERROR, e);
+ WSRPXHelper.throwX(LOG, ErrorCodes.STORE_OBJECT_ERROR, e);
}
-
- if (log.isDebugEnabled()) {
- log.debug(Utility.strExit(MN));
- }
-
+
}
/**
@@ -163,12 +153,6 @@
PersistentDataObject persistentDataObject)
throws WSRPException {
- String MN = "restore";
-
- if (log.isDebugEnabled()) {
- log.debug(Utility.strEnter(MN));
- }
-
Mapping mapping = null;
Unmarshaller unmarshaller = null;
@@ -202,15 +186,15 @@
String code = new Integer(hashCode).toString();
_filenameMap.put(code, file.getAbsolutePath());
- if (log.isDebugEnabled()) {
- log.debug("File: " + file.getAbsolutePath() +
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("File: " + file.getAbsolutePath() +
" added with hashCode = " + code);
}
} catch (Exception e) {
// could not restore a single file from persistent store
- WSRPXHelper.throwX(log, ErrorCodes.RESTORE_OBJECT_ERROR, e);
+ WSRPXHelper.throwX(LOG, ErrorCodes.RESTORE_OBJECT_ERROR, e);
}
}
@@ -218,11 +202,7 @@
} catch (Exception e) {
// castor persistent failure
- WSRPXHelper.throwX(log, ErrorCodes.RESTORE_OBJECT_ERROR, e);
- }
-
- if (log.isDebugEnabled()) {
- log.debug(Utility.strExit(MN));
+ WSRPXHelper.throwX(LOG, ErrorCodes.RESTORE_OBJECT_ERROR, e);
}
return persistentDataObject;
@@ -244,12 +224,6 @@
PersistentDataObject persistentDataObject)
throws WSRPException {
- String MN = "restoreMultiple";
-
- if (log.isDebugEnabled()) {
- log.debug(Utility.strEnter(MN));
- }
-
Mapping mapping = null;
Unmarshaller unmarshaller = null;
@@ -300,8 +274,8 @@
String code = new Integer(hashCode).toString();
_filenameMap.put(code, files[x].getAbsolutePath());
- if (log.isDebugEnabled()) {
- log.debug("File: " +
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("File: " +
files[x].getAbsolutePath() +
" added with hashCode = " +
code);
@@ -310,7 +284,7 @@
} catch (Exception e) {
// restore error
- WSRPXHelper.throwX(log,
+ WSRPXHelper.throwX(LOG,
ErrorCodes.RESTORE_OBJECT_ERROR, e);
}
}
@@ -320,13 +294,9 @@
}
} catch (Exception e) {
// restore error
- WSRPXHelper.throwX(log, ErrorCodes.RESTORE_OBJECT_ERROR, e);
+ WSRPXHelper.throwX(LOG, ErrorCodes.RESTORE_OBJECT_ERROR, e);
}
-
- if (log.isDebugEnabled()) {
- log.debug(Utility.strExit(MN));
- }
-
+
return persistentDataObject;
}
@@ -340,12 +310,6 @@
public void delete(PersistentDataObject persistentDataObject)
throws WSRPException {
- String MN = "delete";
-
- if (log.isDebugEnabled()) {
- log.debug(Utility.strEnter(MN));
- }
-
Object o = persistentDataObject.getLastElement();
int hashCode = o.hashCode();
String code = new Integer(hashCode).toString();
@@ -355,18 +319,14 @@
File file = new File(filename);
if (file.exists()) {
file.delete();
- if (log.isDebugEnabled()) {
- log.debug("Persistent file: " + filename + " deleted.");
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Persistent file: " + filename + " deleted.");
}
} else {
- if (log.isDebugEnabled()) {
- log.debug("Trying to delete persistent file: " +
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Trying to delete persistent file: " +
filename + ". Not found!");
}
- }
-
- if (log.isDebugEnabled()) {
- log.debug(Utility.strExit(MN));
}
}
Modified: portals/wsrp4j/trunk/persistence-xml/src/java/org/apache/wsrp4j/persistence/xml/driver/ProducerPersistentFactoryImpl.java
URL: http://svn.apache.org/viewvc/portals/wsrp4j/trunk/persistence-xml/src/java/org/apache/wsrp4j/persistence/xml/driver/ProducerPersistentFactoryImpl.java?rev=567912&r1=567911&r2=567912&view=diff
==============================================================================
--- portals/wsrp4j/trunk/persistence-xml/src/java/org/apache/wsrp4j/persistence/xml/driver/ProducerPersistentFactoryImpl.java (original)
+++ portals/wsrp4j/trunk/persistence-xml/src/java/org/apache/wsrp4j/persistence/xml/driver/ProducerPersistentFactoryImpl.java Mon Aug 20 19:28:08 2007
@@ -31,235 +31,160 @@
import org.apache.wsrp4j.persistence.xml.ProducerPersistentInformationProvider;
-
/**
* This class is the server factory implementation for the persistence support.
- *
- * @version $Id$
+ *
+ * @version $Id: ProducerPersistentFactoryImpl.java 489955 2006-12-24 00:22:31Z
+ * dlouzan $
*/
-public class ProducerPersistentFactoryImpl implements ProducerPersistentFactory {
+public class ProducerPersistentFactoryImpl implements ProducerPersistentFactory
+{
// holds the persistentHandler
private static PersistentHandler persistentHandler;
-
+
// holds the ProducerPersistentInformationProvider
private static ProducerPersistentInformationProvider producerInfoProvider;
-
+
// log and trace support
- private static final Log log =
- LogFactory.getLog(ProducerPersistentFactoryImpl.class);
-
-
-
+ private static final Log LOG = LogFactory.getLog( ProducerPersistentFactoryImpl.class );
+
/**
* Returns a PersistentHandler
- *
+ *
* @return persistentHandler
*/
- public PersistentHandler getPersistentHandler() {
-
- String MN = "getPersistentHandler";
-
- if (log.isDebugEnabled()) {
- log.debug(Utility.strEnter(MN));
- }
-
- if (persistentHandler == null) {
+ public PersistentHandler getPersistentHandler( )
+ {
+ if ( persistentHandler == null )
+ {
persistentHandler = PersistentHandlerImpl.create();
-
- if (log.isDebugEnabled()) {
- log.debug("PersistentHandler successfully create.");
- }
}
-
- if (log.isDebugEnabled()) {
- log.debug(Utility.strExit(MN));
- }
-
+
return persistentHandler;
-
}
-
+
/**
* @return ProducerPersistentInformationProvider
*/
- public PersistentInformationProvider getPersistentInformationProvider() {
-
- String MN = "getProducerPersistentInformationProvider";
-
- if (log.isDebugEnabled()) {
- log.debug(Utility.strEnter(MN));
- }
-
- producerInfoProvider =
- ProducerPersistentInformationProviderImpl.create();
-
- if (log.isDebugEnabled()) {
- log.debug("ProducerPersistentInformationProvider successfully" +
- " created.");
- }
-
- if (log.isDebugEnabled()) {
- log.debug(Utility.strExit(MN));
- }
-
+ public PersistentInformationProvider getPersistentInformationProvider( )
+ {
+ producerInfoProvider = ProducerPersistentInformationProviderImpl.create();
return producerInfoProvider;
-
}
-
+
/**
* Returns the RegistrationList
- *
+ *
* @return PersistentDataObject
* @throws WSRPException
*/
- public PersistentDataObject getRegistrationList() throws WSRPException {
-
- String MN = "getRegistrationList";
-
- if (log.isDebugEnabled()) {
- log.debug(Utility.strEnter(MN));
- }
-
+ public PersistentDataObject getRegistrationList( ) throws WSRPException
+ {
RegistrationList pdo = null;
-
- try {
-
- pdo = (RegistrationList) Class.forName(
- "org.apache.wsrp4j.persistence.xml.driver." +
- "RegistrationList").newInstance();
-
- ((ProducerPersistentInformationProvider)
- getPersistentInformationProvider()).getPersistentInformation(pdo);
-
- } catch (Exception e) {
- // could not find class
- WSRPXHelper.throwX(log, ErrorCodes.UNMARSHAL_ERROR, e);
+
+ try
+ {
+
+ pdo = (RegistrationList) Class.forName( "org.apache.wsrp4j.persistence.xml.driver." + "RegistrationList" )
+ .newInstance();
+
+ ( (ProducerPersistentInformationProvider) getPersistentInformationProvider() )
+ .getPersistentInformation( pdo );
+
}
-
- if (log.isDebugEnabled()) {
- log.debug(Utility.strExit(MN));
+ catch ( Exception e )
+ {
+ // could not find class
+ WSRPXHelper.throwX( LOG, ErrorCodes.UNMARSHAL_ERROR, e );
}
return pdo;
-
}
-
+
/**
* Returns the ConsumerConfiguredPortletList
- *
+ *
* @return PersistentDataObject
* @throws WSRPException
*/
- public PersistentDataObject getConsumerConfiguredPortletList()
- throws WSRPException {
-
- String MN = "getConsumerConfiguredPortletList";
-
- if (log.isDebugEnabled()) {
- log.debug(Utility.strEnter(MN));
- }
-
+ public PersistentDataObject getConsumerConfiguredPortletList( ) throws WSRPException
+ {
+
ConsumerConfiguredPortletList pdo = null;
-
- try {
+
+ try
+ {
pdo = (ConsumerConfiguredPortletList) Class.forName(
- "org.apache.wsrp4j.persistence.xml.driver." +
- "ConsumerConfiguredPortletList").
- newInstance();
-
- ((ProducerPersistentInformationProvider)
- getPersistentInformationProvider()).getPersistentInformation(pdo);
-
- } catch (Exception e) {
- // could not find class
- WSRPXHelper.throwX(log, ErrorCodes.UNMARSHAL_ERROR, e);
+ "org.apache.wsrp4j.persistence.xml.driver." + "ConsumerConfiguredPortletList" ).newInstance();
+
+ ( (ProducerPersistentInformationProvider) getPersistentInformationProvider() )
+ .getPersistentInformation( pdo );
+
}
-
- if (log.isDebugEnabled()) {
- log.debug(Utility.strExit(MN));
+ catch ( Exception e )
+ {
+ // could not find class
+ WSRPXHelper.throwX( LOG, ErrorCodes.UNMARSHAL_ERROR, e );
}
-
+
return pdo;
-
}
-
+
/**
* Returns the ServiceDescriptionList
- *
+ *
* @return PersistentDataObject
* @throws WSRPException
*/
- public PersistentDataObject getServiceDescriptionList()
- throws WSRPException {
-
- String MN = "getServiceDescriptionList";
-
- if (log.isDebugEnabled()) {
- log.debug(Utility.strEnter(MN));
- }
-
+ public PersistentDataObject getServiceDescriptionList( ) throws WSRPException
+ {
ServiceDescriptionList pdo = null;
-
- try {
+
+ try
+ {
pdo = (ServiceDescriptionList) Class.forName(
- "org.apache.wsrp4j.persistence.xml.driver." +
- "ServiceDescriptionList").
- newInstance();
-
- ((ProducerPersistentInformationProvider)
- getPersistentInformationProvider()).getPersistentInformation(pdo);
-
- } catch (Exception e) {
- // could not find class
- WSRPXHelper.throwX(log, ErrorCodes.UNMARSHAL_ERROR, e);
+ "org.apache.wsrp4j.persistence.xml.driver." + "ServiceDescriptionList" ).newInstance();
+
+ ( (ProducerPersistentInformationProvider) getPersistentInformationProvider() )
+ .getPersistentInformation( pdo );
+
}
-
- if (log.isDebugEnabled()) {
- log.debug(Utility.strExit(MN));
+ catch ( Exception e )
+ {
+ // could not find class
+ WSRPXHelper.throwX( LOG, ErrorCodes.UNMARSHAL_ERROR, e );
}
-
+
return pdo;
-
}
-
+
/**
* Returns the ConsumerPortletRegistrationList
- *
+ *
* @return PersistentDataObject
* @throws WSRPException
*/
- public PersistentDataObject getConsumerPortletRegistrationList()
- throws WSRPException {
-
- String MN = "getConsumerPortletRegistrationList";
-
- if (log.isDebugEnabled()) {
- log.debug(Utility.strEnter(MN));
- }
-
+ public PersistentDataObject getConsumerPortletRegistrationList( ) throws WSRPException
+ {
ConsumerPortletRegistrationList pdo = null;
-
- try {
+
+ try
+ {
pdo = (ConsumerPortletRegistrationList) Class.forName(
- "org.apache.wsrp4j.persistence.xml.driver." +
- "ConsumerPortletRegistrationList").
- newInstance();
-
- ((ProducerPersistentInformationProvider)
- getPersistentInformationProvider()).getPersistentInformation(pdo);
-
- } catch (Exception e) {
- // could not find class
- WSRPXHelper.throwX(log, ErrorCodes.UNMARSHAL_ERROR, e);
+ "org.apache.wsrp4j.persistence.xml.driver." + "ConsumerPortletRegistrationList" ).newInstance();
+
+ ( (ProducerPersistentInformationProvider) getPersistentInformationProvider() )
+ .getPersistentInformation( pdo );
+
}
-
- if (log.isDebugEnabled()) {
- log.debug(Utility.strExit(MN));
+ catch ( Exception e )
+ {
+ // could not find class
+ WSRPXHelper.throwX( LOG, ErrorCodes.UNMARSHAL_ERROR, e );
}
-
+
return pdo;
-
}
-
+
}