You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by cl...@apache.org on 2007/09/04 20:16:13 UTC
svn commit: r572766 [1/2] - in /felix/sandbox/clement/maven-obr-plugin: ./
src/main/java/bundles/ src/main/java/org/apache/felix/maven/
src/main/java/org/apache/felix/obr/
src/main/java/org/apache/felix/obr/plugin/ src/main/java/org/osgi/impl/
src/main...
Author: clement
Date: Tue Sep 4 11:16:11 2007
New Revision: 572766
URL: http://svn.apache.org/viewvc?rev=572766&view=rev
Log:
Modify package name
Modify code style
Added:
felix/sandbox/clement/maven-obr-plugin/src/main/java/org/apache/felix/obr/
felix/sandbox/clement/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/
felix/sandbox/clement/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/Capability.java
- copied, changed from r572698, felix/sandbox/clement/maven-obr-plugin/src/main/java/org/apache/felix/maven/obr/plugin/Capability.java
felix/sandbox/clement/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/Category.java
- copied, changed from r572698, felix/sandbox/clement/maven-obr-plugin/src/main/java/org/apache/felix/maven/obr/plugin/Category.java
felix/sandbox/clement/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/Config.java
- copied, changed from r572698, felix/sandbox/clement/maven-obr-plugin/src/main/java/org/apache/felix/maven/obr/plugin/Config.java
felix/sandbox/clement/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ExtractBindexInfo.java
- copied, changed from r572698, felix/sandbox/clement/maven-obr-plugin/src/main/java/org/apache/felix/maven/obr/plugin/ExtractBindexInfo.java
felix/sandbox/clement/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ObrDeploy.java
- copied, changed from r572698, felix/sandbox/clement/maven-obr-plugin/src/main/java/org/apache/felix/maven/obr/plugin/ObrDeploy.java
felix/sandbox/clement/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ObrDeployFile.java
- copied, changed from r572698, felix/sandbox/clement/maven-obr-plugin/src/main/java/org/apache/felix/maven/obr/plugin/ObrDeployFile.java
felix/sandbox/clement/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ObrInstall.java
- copied, changed from r572698, felix/sandbox/clement/maven-obr-plugin/src/main/java/org/apache/felix/maven/obr/plugin/ObrInstall.java
felix/sandbox/clement/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ObrInstallFile.java
- copied, changed from r572698, felix/sandbox/clement/maven-obr-plugin/src/main/java/org/apache/felix/maven/obr/plugin/ObrInstallFile.java
felix/sandbox/clement/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ObrUpdate.java
- copied, changed from r572698, felix/sandbox/clement/maven-obr-plugin/src/main/java/org/apache/felix/maven/obr/plugin/ObrUpdate.java
felix/sandbox/clement/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/PElement.java
- copied, changed from r572698, felix/sandbox/clement/maven-obr-plugin/src/main/java/org/apache/felix/maven/obr/plugin/PElement.java
felix/sandbox/clement/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/PathFile.java
- copied, changed from r572698, felix/sandbox/clement/maven-obr-plugin/src/main/java/org/apache/felix/maven/obr/plugin/PathFile.java
felix/sandbox/clement/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/RemoteFileManager.java
- copied, changed from r572698, felix/sandbox/clement/maven-obr-plugin/src/main/java/org/apache/felix/maven/obr/plugin/RemoteFileManager.java
felix/sandbox/clement/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/Require.java
- copied, changed from r572698, felix/sandbox/clement/maven-obr-plugin/src/main/java/org/apache/felix/maven/obr/plugin/Require.java
felix/sandbox/clement/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ResourcesBundle.java
- copied, changed from r572698, felix/sandbox/clement/maven-obr-plugin/src/main/java/org/apache/felix/maven/obr/plugin/ResourcesBundle.java
felix/sandbox/clement/maven-obr-plugin/src/main/java/org/osgi/impl/
felix/sandbox/clement/maven-obr-plugin/src/main/java/org/osgi/impl/bundle/
felix/sandbox/clement/maven-obr-plugin/src/main/java/org/osgi/impl/bundle/obr/
Removed:
felix/sandbox/clement/maven-obr-plugin/src/main/java/bundles/
felix/sandbox/clement/maven-obr-plugin/src/main/java/org/apache/felix/maven/
Modified:
felix/sandbox/clement/maven-obr-plugin/ (props changed)
felix/sandbox/clement/maven-obr-plugin/pom.xml
Propchange: felix/sandbox/clement/maven-obr-plugin/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue Sep 4 11:16:11 2007
@@ -0,0 +1,5 @@
+.project
+.checkstyle
+.classpath
+target
+.settings
Modified: felix/sandbox/clement/maven-obr-plugin/pom.xml
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/maven-obr-plugin/pom.xml?rev=572766&r1=572765&r2=572766&view=diff
==============================================================================
--- felix/sandbox/clement/maven-obr-plugin/pom.xml (original)
+++ felix/sandbox/clement/maven-obr-plugin/pom.xml Tue Sep 4 11:16:11 2007
@@ -6,7 +6,6 @@
<packaging>maven-plugin</packaging>
<name>obr maven plugin</name>
<version>0.0.1</version>
- <url>http://maven.apache.org</url>
<dependencies>
<dependency>
@@ -29,8 +28,6 @@
<artifactId>maven-project</artifactId>
<version>2.0.7</version>
</dependency>
-
-
</dependencies>
</project>
Copied: felix/sandbox/clement/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/Capability.java (from r572698, felix/sandbox/clement/maven-obr-plugin/src/main/java/org/apache/felix/maven/obr/plugin/Capability.java)
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/Capability.java?p2=felix/sandbox/clement/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/Capability.java&p1=felix/sandbox/clement/maven-obr-plugin/src/main/java/org/apache/felix/maven/obr/plugin/Capability.java&r1=572698&r2=572766&rev=572766&view=diff
==============================================================================
--- felix/sandbox/clement/maven-obr-plugin/src/main/java/org/apache/felix/maven/obr/plugin/Capability.java (original)
+++ felix/sandbox/clement/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/Capability.java Tue Sep 4 11:16:11 2007
@@ -1,4 +1,22 @@
-package org.apache.felix.maven.obr.plugin;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.felix.obr.plugin;
import java.util.ArrayList;
import java.util.List;
@@ -8,13 +26,10 @@
import org.w3c.dom.Node;
/**
- * this class describe and store capability node.
- *
- * @author Maxime
- *
+ * This class describe and store capability node.
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
*/
-public class Capability
-{
+public class Capability {
/**
* m_name: name of the capability.
@@ -31,20 +46,18 @@
*
* @return name attribute
*/
- public String getName()
- {
+ public String getName() {
return m_name;
}
/**
* set the name attribute.
*
- * @param m_name new name value
+ * @param name new name value
*
*/
- public void setName(String m_name)
- {
- this.m_name = m_name;
+ public void setName(String name) {
+ this.m_name = name;
}
/**
@@ -52,20 +65,18 @@
*
* @return List of PElement
*/
- public List getP()
- {
+ public List getP() {
return m_p;
}
/**
* set the capabilities.
*
- * @param m_p List of PElement
+ * @param mp List of PElement
*
*/
- public void setP(List m_p)
- {
- this.m_p = m_p;
+ public void setP(List mp) {
+ this.m_p = mp;
}
/**
@@ -74,8 +85,7 @@
* @param pelement PElement
*
*/
- public void addP(PElement pelement)
- {
+ public void addP(PElement pelement) {
m_p.add(pelement);
}
@@ -85,12 +95,10 @@
* @param father father document for create Node
* @return node
*/
- public Node getNode(Document father)
- {
+ public Node getNode(Document father) {
Element capability = father.createElement("capability");
capability.setAttribute("name", this.getName());
- for (int i = 0; i < this.getP().size(); i++)
- {
+ for (int i = 0; i < this.getP().size(); i++) {
capability.appendChild(((PElement) (this.getP().get(i))).getNode(father));
}
return capability;
Copied: felix/sandbox/clement/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/Category.java (from r572698, felix/sandbox/clement/maven-obr-plugin/src/main/java/org/apache/felix/maven/obr/plugin/Category.java)
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/Category.java?p2=felix/sandbox/clement/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/Category.java&p1=felix/sandbox/clement/maven-obr-plugin/src/main/java/org/apache/felix/maven/obr/plugin/Category.java&r1=572698&r2=572766&rev=572766&view=diff
==============================================================================
--- felix/sandbox/clement/maven-obr-plugin/src/main/java/org/apache/felix/maven/obr/plugin/Category.java (original)
+++ felix/sandbox/clement/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/Category.java Tue Sep 4 11:16:11 2007
@@ -1,4 +1,4 @@
-/*
+/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.felix.maven.obr.plugin;
+package org.apache.felix.obr.plugin;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -25,12 +25,10 @@
/**
* describe and store category node.
*
- * @author Maxime
- *
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
*/
-public class Category
-{
+public class Category {
/**
* id of the category.
*/
@@ -41,8 +39,7 @@
*
* @return id
*/
- public String getId()
- {
+ public String getId() {
return m_id;
}
@@ -50,8 +47,7 @@
* set the id attribute.
* @param id new id value
*/
- public void setId(String id)
- {
+ public void setId(String id) {
this.m_id = id;
}
@@ -60,8 +56,7 @@
* @param father father document for create Node
* @return node
*/
- public Node getNode(Document father)
- {
+ public Node getNode(Document father) {
Element category = father.createElement("category");
category.setAttribute("id", this.getId());
return category;
Copied: felix/sandbox/clement/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/Config.java (from r572698, felix/sandbox/clement/maven-obr-plugin/src/main/java/org/apache/felix/maven/obr/plugin/Config.java)
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/Config.java?p2=felix/sandbox/clement/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/Config.java&p1=felix/sandbox/clement/maven-obr-plugin/src/main/java/org/apache/felix/maven/obr/plugin/Config.java&r1=572698&r2=572766&rev=572766&view=diff
==============================================================================
--- felix/sandbox/clement/maven-obr-plugin/src/main/java/org/apache/felix/maven/obr/plugin/Config.java (original)
+++ felix/sandbox/clement/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/Config.java Tue Sep 4 11:16:11 2007
@@ -1,4 +1,4 @@
-/*
+/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@@ -16,14 +16,14 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.felix.maven.obr.plugin;
+package org.apache.felix.obr.plugin;
+
/**
* this class is used to store some user information about configuration of the plugin.
- * @author Maxime
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
*
*/
-public class Config
-{
+public class Config {
/**
* use relative path or not.
@@ -39,8 +39,7 @@
* constructor: set default configuration: use relative path and don't upload file.
*
*/
- public Config()
- {
+ public Config() {
// default configuration
m_pathRelative = true;
m_fileRemote = false;
@@ -50,8 +49,7 @@
* set relativePath attribute.
* @param value new value of attribute
*/
- public void setPathRelative(boolean value)
- {
+ public void setPathRelative(boolean value) {
m_pathRelative = value;
}
@@ -59,8 +57,7 @@
* set fileRemote attribute.
* @param value new value of attribute
*/
- public void setRemotely(boolean value)
- {
+ public void setRemotely(boolean value) {
m_fileRemote = value;
}
@@ -68,8 +65,7 @@
* get use path relative.
* @return true if plugin use relative path, else false
*/
- public boolean isPathRelative()
- {
+ public boolean isPathRelative() {
return m_pathRelative;
}
@@ -77,8 +73,7 @@
* get if use upload file.
* @return true if the file will be uploaded, else false
*/
- public boolean isRemotely()
- {
+ public boolean isRemotely() {
return m_fileRemote;
}
}
Copied: felix/sandbox/clement/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ExtractBindexInfo.java (from r572698, felix/sandbox/clement/maven-obr-plugin/src/main/java/org/apache/felix/maven/obr/plugin/ExtractBindexInfo.java)
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ExtractBindexInfo.java?p2=felix/sandbox/clement/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ExtractBindexInfo.java&p1=felix/sandbox/clement/maven-obr-plugin/src/main/java/org/apache/felix/maven/obr/plugin/ExtractBindexInfo.java&r1=572698&r2=572766&rev=572766&view=diff
==============================================================================
--- felix/sandbox/clement/maven-obr-plugin/src/main/java/org/apache/felix/maven/obr/plugin/ExtractBindexInfo.java (original)
+++ felix/sandbox/clement/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ExtractBindexInfo.java Tue Sep 4 11:16:11 2007
@@ -1,4 +1,4 @@
-/*
+/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.felix.maven.obr.plugin;
+package org.apache.felix.obr.plugin;
import java.io.File;
import java.net.MalformedURLException;
@@ -28,25 +28,21 @@
import java.util.Map;
import org.apache.maven.plugin.MojoExecutionException;
-
-import bundles.obr.resource.BundleInfo;
-import bundles.obr.resource.CapabilityImpl;
-import bundles.obr.resource.RepositoryImpl;
-import bundles.obr.resource.RequirementImpl;
-import bundles.obr.resource.ResourceImpl;
-import bundles.obr.resource.VersionImpl;
+import org.osgi.impl.bundle.obr.resource.BundleInfo;
+import org.osgi.impl.bundle.obr.resource.CapabilityImpl;
+import org.osgi.impl.bundle.obr.resource.RepositoryImpl;
+import org.osgi.impl.bundle.obr.resource.RequirementImpl;
+import org.osgi.impl.bundle.obr.resource.ResourceImpl;
+import org.osgi.impl.bundle.obr.resource.VersionImpl;
/**
* this class is used to configure bindex and get information built by bindex about targeted bundle.
- *
- * @author Maxime
- *
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
*/
-public class ExtractBindexInfo
-{
+public class ExtractBindexInfo {
/**
- * attribute get from bindex which describe targeted ressource.
+ * attribute get from bindex which describe targeted resource.
*/
private ResourceImpl m_resource;
@@ -56,49 +52,38 @@
* @param outFile path on targeted jar-file
* @throws MojoExecutionException occurs if bindex configuration failed
*/
- public ExtractBindexInfo(URI repoFilename, String outFile) throws MojoExecutionException
- {
+ public ExtractBindexInfo(URI repoFilename, String outFile) throws MojoExecutionException {
this.m_resource = null;
RepositoryImpl repository = null;
- try
- {
+ try {
repository = new RepositoryImpl(new File(repoFilename).getAbsoluteFile().toURL());
- }
- catch (MalformedURLException e)
- {
+ } catch (MalformedURLException e) {
e.printStackTrace();
throw new MojoExecutionException("MalformedURLException");
}
BundleInfo info = null;
- try
- {
+ try {
info = new BundleInfo(repository, new File(outFile));
- }
- catch (Exception e)
- {
+ } catch (Exception e) {
e.printStackTrace();
throw new MojoExecutionException("Exception");
}
- try
- {
+ try {
m_resource = info.build();
- }
- catch (Exception e)
- {
+ } catch (Exception e) {
e.printStackTrace();
throw new MojoExecutionException("Exception");
}
}
/**
- * transform logical operator in xml syntax.
+ * transform logical operator in xml syntax.
* @param filter string which contains logical operator
- * @return string in correct xml syntax
+ * @return string in correct xml syntax
*/
- private String parseFilter(String filter)
- {
+ private String parseFilter(String filter) {
filter.replaceAll("&", "&");
filter.replaceAll(">=", ">");
@@ -107,44 +92,38 @@
/**
* extract capabilities from bindex information.
- * @return bundle capabilities List
+ * @return bundle capabilities List
*/
- public List getCapabilities()
- {
- ArrayList list = new ArrayList();
+ public List getCapabilities() {
+ List list = new ArrayList();
Collection res = m_resource.getCapabilityList();
Iterator it = res.iterator();
- while (it.hasNext())
- {
+ while (it.hasNext()) {
Capability capability = new Capability();
- CapabilityImpl ci = ((CapabilityImpl) it.next());
+ CapabilityImpl ci = (CapabilityImpl) it.next();
capability.setName(ci.getName());
// System.out.println(ci.getName()) ;
- if (!(ci.getName().compareTo("bundle") == 0))
- {
+ if (!(ci.getName().compareTo("bundle") == 0)) {
Map properties = ci.getProperties();
- for (Iterator k = properties.keySet().iterator(); k.hasNext();)
- {
+ for (Iterator k = properties.keySet().iterator(); k.hasNext();) {
PElement p = new PElement();
String key = (String) k.next();
List values = (List) properties.get(key);
- for (Iterator v = values.iterator(); v.hasNext();)
- {
+ for (Iterator v = values.iterator(); v.hasNext();) {
Object value = v.next();
p.setN(key);
- if (value != null)
- {
+ if (value != null) {
p.setV(value.toString());
- }
- else
+ } else {
System.out.println("Missing value " + key);
+ }
String type = null;
- if (value instanceof Number)
+ if (value instanceof Number) {
type = "number";
- else if (value.getClass() == VersionImpl.class)
- type = "version";
- if (type != null)
- {
+ } else {
+ if (value.getClass() == VersionImpl.class) { type = "version"; }
+ }
+ if (type != null) {
p.setT(type);
}
}
@@ -156,18 +135,17 @@
}
return list;
}
+
/**
* extract requirement from bindex information.
* @return bundle requirement List
*/
- public List getRequirement()
- {
- ArrayList list = new ArrayList();
+ public List getRequirement() {
+ List list = new ArrayList();
Collection res = m_resource.getRequirementList();
Iterator it = res.iterator();
- while (it.hasNext())
- {
- RequirementImpl ci = ((RequirementImpl) it.next());
+ while (it.hasNext()) {
+ RequirementImpl ci = (RequirementImpl) it.next();
Require require = new Require();
require.setExtend(String.valueOf(ci.isExtend()));
@@ -185,8 +163,7 @@
* extract symbolic name from bindex information.
* @return bundle symbolic name
*/
- public String getSymbolicName()
- {
+ public String getSymbolicName() {
return m_resource.getSymbolicName();
}
@@ -194,20 +171,19 @@
* extract version from bindex information.
* @return bundle version
*/
- public String getVersion()
- {
- if (m_resource.getVersion() != null)
+ public String getVersion() {
+ if (m_resource.getVersion() != null) {
return m_resource.getVersion().toString();
- else
+ } else {
return null;
+ }
}
/**
* extract presentation name from bindex information.
* @return bundle presentation name
*/
- public String getPresentationName()
- {
+ public String getPresentationName() {
return m_resource.getPresentationName();
}
@@ -215,8 +191,7 @@
* extract copyright from bindex information.
* @return bundle copyright
*/
- public String getCopyright()
- {
+ public String getCopyright() {
return m_resource.getCopyright();
}
@@ -224,8 +199,7 @@
* extract description from bindex information.
* @return bundle description
*/
- public String getDescription()
- {
+ public String getDescription() {
return m_resource.getDescription();
}
@@ -233,36 +207,36 @@
* extract documentation from bindex information.
* @return bundle documentation
*/
- public String getDocumentation()
- {
- if (m_resource.getDocumentation() != null)
+ public String getDocumentation() {
+ if (m_resource.getDocumentation() != null) {
return m_resource.getDocumentation().toString();
- else
+ } else {
return null;
+ }
}
/**
* extract license from bindex information.
* @return bundle license
*/
- public String getLicense()
- {
- if (m_resource.getLicense() != null)
+ public String getLicense() {
+ if (m_resource.getLicense() != null) {
return m_resource.getLicense().toString();
- else
+ } else {
return null;
+ }
}
/**
* extract source from bindex information.
* @return bundle source
*/
- public String getSource()
- {
- if (m_resource.getSource() != null)
+ public String getSource() {
+ if (m_resource.getSource() != null) {
return m_resource.getSource().toString();
- else
+ } else {
return null;
+ }
}
}
Copied: felix/sandbox/clement/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ObrDeploy.java (from r572698, felix/sandbox/clement/maven-obr-plugin/src/main/java/org/apache/felix/maven/obr/plugin/ObrDeploy.java)
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ObrDeploy.java?p2=felix/sandbox/clement/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ObrDeploy.java&p1=felix/sandbox/clement/maven-obr-plugin/src/main/java/org/apache/felix/maven/obr/plugin/ObrDeploy.java&r1=572698&r2=572766&rev=572766&view=diff
==============================================================================
--- felix/sandbox/clement/maven-obr-plugin/src/main/java/org/apache/felix/maven/obr/plugin/ObrDeploy.java (original)
+++ felix/sandbox/clement/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ObrDeploy.java Tue Sep 4 11:16:11 2007
@@ -1,4 +1,4 @@
-/*
+/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.felix.maven.obr.plugin;
+package org.apache.felix.obr.plugin;
import java.io.BufferedWriter;
import java.io.File;
@@ -43,10 +43,10 @@
* @goal deployment
* @phase deploy
* @requiresDependencyResolution compile
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
*/
-public class ObrDeploy extends AbstractMojo
-{
+public class ObrDeploy extends AbstractMojo {
/**
* setting of maven.
@@ -80,6 +80,7 @@
private MavenProject m_project;
/**
+ * Wagon Manager.
* @component
*/
private WagonManager m_wagonManager;
@@ -97,15 +98,13 @@
*/
private String m_fileInLocalRepo;
-
/**
* main method for this goal.
* @implements org.apache.maven.plugin.Mojo.execute
* @throws MojoExecutionException if the plugin failed
* @throws MojoFailureException if the plugin failed
*/
- public void execute() throws MojoExecutionException, MojoFailureException
- {
+ public void execute() throws MojoExecutionException, MojoFailureException {
getLog().info("Obr-deploy start:");
System.err.println(m_repositoryName);
@@ -114,19 +113,16 @@
// locate the obr.xml file
String obrXmlFile = null;
List l = m_project.getResources();
- for (int i = 0; i < l.size(); i++)
- {
+ for (int i = 0; i < l.size(); i++) {
File f = new File(((Resource) l.get(i)).getDirectory() + File.separator + "obr.xml");
- if (f.exists())
- {
+ if (f.exists()) {
obrXmlFile = ((Resource) l.get(i)).getDirectory() + File.separator + "obr.xml";
break;
}
}
// the obr.xml file is not present
- if (obrXmlFile == null)
- {
+ if (obrXmlFile == null) {
getLog().warn("obr.xml is not present, use default");
}
@@ -139,126 +135,90 @@
// create a non-empty file used to lock the repository descriptor file
File lockFile = null;
Writer output = null;
- try
- {
+ try {
lockFile = File.createTempFile(String.valueOf(System.currentTimeMillis()), null);
output = new BufferedWriter(new FileWriter(lockFile));
output.write("locked");
output.close();
- }
- catch (IOException e)
- {
+ } catch (IOException e) {
getLog().error("Unable to create temporary file");
throw new MojoFailureException("IOException");
}
- if (m_ignoreLock)
- {
- try
- {
+ if (m_ignoreLock) {
+ try {
remoteFile.put(lockFile, m_repositoryName + ".lock");
- }
- catch (TransferFailedException e)
- {
+ } catch (TransferFailedException e) {
getLog().error("Transfer failed");
e.printStackTrace();
throw new MojoFailureException("TransferFailedException");
- }
- catch (ResourceDoesNotExistException e)
- {
+ } catch (ResourceDoesNotExistException e) {
throw new MojoFailureException("ResourceDoesNotExistException");
- }
- catch (AuthorizationException e)
- {
+ } catch (AuthorizationException e) {
getLog().error("Authorization failed");
e.printStackTrace();
throw new MojoFailureException("AuthorizationException");
}
- }
- else
- {
+ } else {
int countError = 0;
- while (remoteFile.isLockedFile(remoteFile, m_repositoryName) && countError < 2)
- {
+ while (remoteFile.isLockedFile(remoteFile, m_repositoryName) && countError < 2) {
countError++;
getLog().warn("File is locked, retry in 10s");
- try
- {
+ try {
Thread.sleep(10000);
- }
- catch (InterruptedException e)
- {
+ } catch (InterruptedException e) {
+ getLog().warn("Sleep interupted");
}
}
- if (countError == 2)
- {
+ if (countError == 2) {
getLog().error("File: " + m_repositoryName + " is locked. Try -Dignore-lock=true if you want force uploading");
throw new MojoFailureException("fileLocked");
}
}
// file is not locked, so we lock it now
- try
- {
+ try {
remoteFile.put(lockFile, m_repositoryName + ".lock");
- }
- catch (TransferFailedException e)
- {
+ } catch (TransferFailedException e) {
getLog().error("Transfer failed");
e.printStackTrace();
throw new MojoFailureException("TransferFailedException");
- }
- catch (ResourceDoesNotExistException e)
- {
+ } catch (ResourceDoesNotExistException e) {
throw new MojoFailureException("ResourceDoesNotExistException");
- }
- catch (AuthorizationException e)
- {
+ } catch (AuthorizationException e) {
getLog().error("Authorization failed");
e.printStackTrace();
throw new MojoFailureException("AuthorizationException");
}
- try
- {
+ try {
repoDescriptorFile = remoteFile.get(m_repositoryName);
- }
- catch (TransferFailedException e)
- {
+ } catch (TransferFailedException e) {
getLog().error("Transfer failed");
e.printStackTrace();
throw new MojoFailureException("TransferFailedException");
- }
- catch (ResourceDoesNotExistException e)
- {
+ } catch (ResourceDoesNotExistException e) {
// file doesn't exist! create a new one
getLog().warn("file specified does not exist: " + m_repositoryName);
getLog().warn("Create a new repository descriptor file " + m_repositoryName);
- try
- {
+ try {
File f = File.createTempFile(String.valueOf(System.currentTimeMillis()), null);
repoDescriptorFile = new File(f.getParent() + File.separator + String.valueOf(System.currentTimeMillis()) + ".xml");
- }
- catch (IOException e1)
- {
+ } catch (IOException e1) {
getLog().error("canno't create temporary file");
e1.printStackTrace();
return;
}
- }
- catch (AuthorizationException e)
- {
+ } catch (AuthorizationException e) {
getLog().error("Authorization failed");
e.printStackTrace();
throw new MojoFailureException("AuthorizationException");
- }
- catch (IOException e)
- {
+ } catch (IOException e) {
e.printStackTrace();
throw new MojoFailureException("IOException");
}
@@ -271,10 +231,9 @@
// get the path to local maven repository
file = new PathFile(PathFile.uniformSeparator(m_settings.getLocalRepository()) + File.separator + PathFile.uniformSeparator(m_localRepo.pathOf(m_project.getArtifact())));
- if (file.isExists())
+ if (file.isExists()) {
m_fileInLocalRepo = file.getOnlyAbsoluteFilename();
- else
- {
+ } else {
getLog().error("file not found in local repository: " + m_settings.getLocalRepository() + File.separator + m_localRepo.pathOf(m_project.getArtifact()));
return;
}
@@ -286,24 +245,17 @@
obrUpdate.updateRepository();
// the reposiroty descriptor file is modified, we upload it on the remote repository
- try
- {
+ try {
remoteFile.put(repoDescriptorFile, m_repositoryName);
- }
- catch (TransferFailedException e)
- {
+ } catch (TransferFailedException e) {
getLog().error("Transfer failed");
e.printStackTrace();
throw new MojoFailureException("TransferFailedException");
- }
- catch (ResourceDoesNotExistException e)
- {
+ } catch (ResourceDoesNotExistException e) {
getLog().error("Resource does not exist:" + repoDescriptorFile.getName());
e.printStackTrace();
throw new MojoFailureException("ResourceDoesNotExistException");
- }
- catch (AuthorizationException e)
- {
+ } catch (AuthorizationException e) {
getLog().error("Authorization failed");
e.printStackTrace();
throw new MojoFailureException("AuthorizationException");
@@ -312,32 +264,22 @@
// we remove lockFile activation
lockFile = null;
- try
- {
+ try {
lockFile = File.createTempFile(String.valueOf(System.currentTimeMillis()), null);
- }
- catch (IOException e)
- {
+ } catch (IOException e) {
e.printStackTrace();
throw new MojoFailureException("IOException");
}
- try
- {
+ try {
remoteFile.put(lockFile, m_repositoryName + ".lock");
- }
- catch (TransferFailedException e)
- {
+ } catch (TransferFailedException e) {
getLog().error("Transfer failed");
e.printStackTrace();
throw new MojoFailureException("TransferFailedException");
- }
- catch (ResourceDoesNotExistException e)
- {
+ } catch (ResourceDoesNotExistException e) {
e.printStackTrace();
throw new MojoFailureException("ResourceDoesNotExistException");
- }
- catch (AuthorizationException e)
- {
+ } catch (AuthorizationException e) {
getLog().error("Authorization failed");
e.printStackTrace();
throw new MojoFailureException("AuthorizationException");
Copied: felix/sandbox/clement/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ObrDeployFile.java (from r572698, felix/sandbox/clement/maven-obr-plugin/src/main/java/org/apache/felix/maven/obr/plugin/ObrDeployFile.java)
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ObrDeployFile.java?p2=felix/sandbox/clement/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ObrDeployFile.java&p1=felix/sandbox/clement/maven-obr-plugin/src/main/java/org/apache/felix/maven/obr/plugin/ObrDeployFile.java&r1=572698&r2=572766&rev=572766&view=diff
==============================================================================
--- felix/sandbox/clement/maven-obr-plugin/src/main/java/org/apache/felix/maven/obr/plugin/ObrDeployFile.java (original)
+++ felix/sandbox/clement/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ObrDeployFile.java Tue Sep 4 11:16:11 2007
@@ -1,4 +1,4 @@
-/*
+/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.felix.maven.obr.plugin;
+package org.apache.felix.obr.plugin;
import java.io.BufferedWriter;
import java.io.File;
@@ -40,9 +40,9 @@
* this goal is used when you upload a jar file (in command line)
* @goal deploy-file
* @phase deploy
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
*/
-public class ObrDeployFile extends AbstractMojo
-{
+public class ObrDeployFile extends AbstractMojo {
/**
* setting of maven.
@@ -77,6 +77,7 @@
private MavenProject m_project;
/**
+ * Wagon Manager.
* @component
*/
private WagonManager m_wagonManager;
@@ -108,16 +109,14 @@
* @throws MojoExecutionException if the plugin failed
* @throws MojoFailureException if the plugin failed
*/
- public void execute() throws MojoExecutionException, MojoFailureException
- {
+ public void execute() throws MojoExecutionException, MojoFailureException {
getLog().info("Obr-deploy-file start:");
-
+
ArtifactRepository ar = m_project.getDistributionManagementArtifactRepository();
// locate the obr.xml file
PathFile fileObrXml = new PathFile(m_obrFile);
- if (!fileObrXml.isExists())
- {
+ if (!fileObrXml.isExists()) {
getLog().warn("obr.xml file not found, use default");
}
@@ -130,126 +129,90 @@
// create a non-empty file used to lock the repository descriptor file
File lockFile = null;
Writer output = null;
- try
- {
+ try {
lockFile = File.createTempFile(String.valueOf(System.currentTimeMillis()), null);
output = new BufferedWriter(new FileWriter(lockFile));
output.write("locked");
output.close();
- }
- catch (IOException e)
- {
+ } catch (IOException e) {
getLog().error("Unable to create temporary file");
throw new MojoFailureException("IOException");
}
- if (m_ignoreLock)
- {
- try
- {
+ if (m_ignoreLock) {
+ try {
remoteFile.put(lockFile, m_repositoryName + ".lock");
- }
- catch (TransferFailedException e)
- {
+ } catch (TransferFailedException e) {
getLog().error("Transfer failed");
e.printStackTrace();
throw new MojoFailureException("TransferFailedException");
- }
- catch (ResourceDoesNotExistException e)
- {
+ } catch (ResourceDoesNotExistException e) {
throw new MojoFailureException("ResourceDoesNotExistException");
- }
- catch (AuthorizationException e)
- {
+ } catch (AuthorizationException e) {
getLog().error("Authorization failed");
e.printStackTrace();
throw new MojoFailureException("AuthorizationException");
}
- }
- else
- {
+ } else {
int countError = 0;
- while (remoteFile.isLockedFile(remoteFile, m_repositoryName) && countError < 2)
- {
+ while (remoteFile.isLockedFile(remoteFile, m_repositoryName) && countError < 2) {
countError++;
getLog().warn("File is locked, retry in 10s");
- try
- {
+ try {
Thread.sleep(10000);
- }
- catch (InterruptedException e)
- {
+ } catch (InterruptedException e) {
+ getLog().warn("Sleep Interupted");
}
}
- if (countError == 2)
- {
+ if (countError == 2) {
getLog().error("File: " + m_repositoryName + " is locked. Try -Dignore-lock=true if you want to force uploading");
throw new MojoFailureException("fileLocked");
}
}
// file is not locked, so we lock it now
- try
- {
+ try {
remoteFile.put(lockFile, m_repositoryName + ".lock");
- }
- catch (TransferFailedException e)
- {
+ } catch (TransferFailedException e) {
getLog().error("Transfer failed");
e.printStackTrace();
throw new MojoFailureException("TransferFailedException");
- }
- catch (ResourceDoesNotExistException e)
- {
+ } catch (ResourceDoesNotExistException e) {
throw new MojoFailureException("ResourceDoesNotExistException");
- }
- catch (AuthorizationException e)
- {
+ } catch (AuthorizationException e) {
getLog().error("Authorization failed");
e.printStackTrace();
throw new MojoFailureException("AuthorizationException");
}
- try
- {
+ try {
repoDescriptorFile = remoteFile.get(m_repositoryName);
- }
- catch (TransferFailedException e)
- {
+ } catch (TransferFailedException e) {
getLog().error("Transfer failed");
e.printStackTrace();
throw new MojoFailureException("TransferFailedException");
- }
- catch (ResourceDoesNotExistException e)
- {
+ } catch (ResourceDoesNotExistException e) {
// file doesn't exist! create a new one
getLog().warn("file specified does not exist: " + m_repositoryName);
getLog().warn("Create a new repository descriptor file " + m_repositoryName);
- try
- {
+ try {
File f = File.createTempFile(String.valueOf(System.currentTimeMillis()), null);
repoDescriptorFile = new File(f.getParent() + File.separator + String.valueOf(System.currentTimeMillis()) + ".xml");
- }
- catch (IOException e1)
- {
+ } catch (IOException e1) {
getLog().error("canno't create temporary file");
e1.printStackTrace();
return;
}
- }
- catch (AuthorizationException e)
- {
+ } catch (AuthorizationException e) {
getLog().error("Authorization failed");
e.printStackTrace();
throw new MojoFailureException("AuthorizationException");
- }
- catch (IOException e)
- {
+ } catch (IOException e) {
e.printStackTrace();
throw new MojoFailureException("IOException");
}
@@ -262,10 +225,9 @@
// get the path to local maven repository
file = new PathFile(PathFile.uniformSeparator(m_settings.getLocalRepository()) + File.separator + PathFile.uniformSeparator(m_localRepo.pathOf(m_project.getArtifact())));
- if (file.isExists())
+ if (file.isExists()) {
m_fileInLocalRepo = file.getOnlyAbsoluteFilename();
- else
- {
+ } else {
getLog().error("file not found in local repository: " + m_settings.getLocalRepository() + File.separator + m_localRepo.pathOf(m_project.getArtifact()));
return;
}
@@ -277,24 +239,17 @@
obrUpdate.updateRepository();
// the reposiroty descriptor file is modified, we upload it on the remote repository
- try
- {
+ try {
remoteFile.put(repoDescriptorFile, m_repositoryName);
- }
- catch (TransferFailedException e)
- {
+ } catch (TransferFailedException e) {
getLog().error("Transfer failed");
e.printStackTrace();
throw new MojoFailureException("TransferFailedException");
- }
- catch (ResourceDoesNotExistException e)
- {
+ } catch (ResourceDoesNotExistException e) {
getLog().error("Resource does not exist:" + repoDescriptorFile.getName());
e.printStackTrace();
throw new MojoFailureException("ResourceDoesNotExistException");
- }
- catch (AuthorizationException e)
- {
+ } catch (AuthorizationException e) {
getLog().error("Authorization failed");
e.printStackTrace();
throw new MojoFailureException("AuthorizationException");
@@ -303,32 +258,22 @@
// we remove lockFile activation
lockFile = null;
- try
- {
+ try {
lockFile = File.createTempFile(String.valueOf(System.currentTimeMillis()), null);
- }
- catch (IOException e)
- {
+ } catch (IOException e) {
e.printStackTrace();
throw new MojoFailureException("IOException");
}
- try
- {
+ try {
remoteFile.put(lockFile, m_repositoryName + ".lock");
- }
- catch (TransferFailedException e)
- {
+ } catch (TransferFailedException e) {
getLog().error("Transfer failed");
e.printStackTrace();
throw new MojoFailureException("TransferFailedException");
- }
- catch (ResourceDoesNotExistException e)
- {
+ } catch (ResourceDoesNotExistException e) {
e.printStackTrace();
throw new MojoFailureException("ResourceDoesNotExistException");
- }
- catch (AuthorizationException e)
- {
+ } catch (AuthorizationException e) {
getLog().error("Authorization failed");
e.printStackTrace();
throw new MojoFailureException("AuthorizationException");
Copied: felix/sandbox/clement/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ObrInstall.java (from r572698, felix/sandbox/clement/maven-obr-plugin/src/main/java/org/apache/felix/maven/obr/plugin/ObrInstall.java)
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ObrInstall.java?p2=felix/sandbox/clement/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ObrInstall.java&p1=felix/sandbox/clement/maven-obr-plugin/src/main/java/org/apache/felix/maven/obr/plugin/ObrInstall.java&r1=572698&r2=572766&rev=572766&view=diff
==============================================================================
--- felix/sandbox/clement/maven-obr-plugin/src/main/java/org/apache/felix/maven/obr/plugin/ObrInstall.java (original)
+++ felix/sandbox/clement/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ObrInstall.java Tue Sep 4 11:16:11 2007
@@ -1,4 +1,4 @@
-/*
+/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.felix.maven.obr.plugin;
+package org.apache.felix.obr.plugin;
import java.io.File;
import java.util.List;
@@ -34,9 +34,9 @@
* @goal repository
* @phase install
* @requiresDependencyResolution compile
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
*/
-public class ObrInstall extends AbstractMojo
-{
+public class ObrInstall extends AbstractMojo {
/**
* The local Maven repository.
*
@@ -81,71 +81,58 @@
* @implements org.apache.maven.plugin.Mojo.execute
* @throws MojoExecutionException if the plugin failed
*/
- public void execute() throws MojoExecutionException
- {
+ public void execute() throws MojoExecutionException {
getLog().info("Obr Plugin starts:");
- if (m_repositoryPath == null)
- {
+ if (m_repositoryPath == null) {
m_repositoryPath = "file:/" + m_localRepo.getBasedir() + File.separator + "repository.xml";
getLog().warn("-DpathRepo is not define, use default repository: " + m_repositoryPath);
}
PathFile file = new PathFile(m_repositoryPath);
- if (file.isExists())
- {
- if (!m_repositoryPath.startsWith("file:/"))
- m_repositoryPath = "file:/" + m_repositoryPath;
+ if (file.isExists()) {
+ if (!m_repositoryPath.startsWith("file:/")) { m_repositoryPath = "file:/" + m_repositoryPath; }
}
// locate the obr.xml file
String obrXmlFile = null;
List l = m_project.getResources();
- for (int i = 0; i < l.size(); i++)
- {
+ for (int i = 0; i < l.size(); i++) {
File f = new File(((Resource) l.get(i)).getDirectory() + File.separator + "obr.xml");
- if (f.exists())
- {
+ if (f.exists()) {
obrXmlFile = ((Resource) l.get(i)).getDirectory() + File.separator + "obr.xml";
break;
}
}
// the obr.xml file is not present
- if (obrXmlFile == null)
- {
+ if (obrXmlFile == null) {
getLog().warn("obr.xml is not present, use default");
}
// get the path to local maven repository
file = new PathFile(PathFile.uniformSeparator(m_settings.getLocalRepository()) + File.separator + PathFile.uniformSeparator(m_localRepo.pathOf(m_project.getArtifact())));
- if (file.isExists())
+ if (file.isExists()) {
m_fileInLocalRepo = file.getOnlyAbsoluteFilename();
- else
- {
+ } else {
getLog().error("file not found in local repository: " + m_settings.getLocalRepository() + File.separator + m_localRepo.pathOf(m_project.getArtifact()));
return;
}
// verify the repository.xml
PathFile fileRepo = new PathFile(m_repositoryPath);
- if (fileRepo.isRelative())
- fileRepo.setBaseDir(m_settings.getLocalRepository());
+ if (fileRepo.isRelative()) { fileRepo.setBaseDir(m_settings.getLocalRepository()); }
// create the folder to the repository
PathFile repoExist = new PathFile(fileRepo.getAbsolutePath());
- if (!repoExist.isExists())
- fileRepo.createPath();
+ if (!repoExist.isExists()) { fileRepo.createPath(); }
// build the user configuration (use default)
Config user = new Config();
ObrUpdate obrUpdate = new ObrUpdate(fileRepo, obrXmlFile, m_project, m_fileInLocalRepo, PathFile.uniformSeparator(m_settings.getLocalRepository()), user, getLog());
- try
- {
+ try {
obrUpdate.updateRepository();
- }
- catch (MojoExecutionException e)
- {
+ } catch (MojoExecutionException e) {
e.printStackTrace();
throw new MojoExecutionException("MojoFailureException");
}
Copied: felix/sandbox/clement/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ObrInstallFile.java (from r572698, felix/sandbox/clement/maven-obr-plugin/src/main/java/org/apache/felix/maven/obr/plugin/ObrInstallFile.java)
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ObrInstallFile.java?p2=felix/sandbox/clement/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ObrInstallFile.java&p1=felix/sandbox/clement/maven-obr-plugin/src/main/java/org/apache/felix/maven/obr/plugin/ObrInstallFile.java&r1=572698&r2=572766&rev=572766&view=diff
==============================================================================
--- felix/sandbox/clement/maven-obr-plugin/src/main/java/org/apache/felix/maven/obr/plugin/ObrInstallFile.java (original)
+++ felix/sandbox/clement/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ObrInstallFile.java Tue Sep 4 11:16:11 2007
@@ -1,4 +1,4 @@
-/*
+/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.felix.maven.obr.plugin;
+package org.apache.felix.obr.plugin;
import java.io.File;
@@ -28,14 +28,14 @@
import org.apache.maven.settings.Settings;
/**
- * @description construct the repository.xml from a compiled bundle
- *
+ * construct the repository.xml from a compiled bundle.
+ * @description construct the repository.xml from a compiled bundle.
* @goal install-file
* @requiresProject false
* @phase install
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
*/
-public class ObrInstallFile extends AbstractMojo
-{
+public class ObrInstallFile extends AbstractMojo {
/**
* The local Maven repository.
*
@@ -61,31 +61,36 @@
private Settings m_settings;
/**
- * @descritpion symbolic name define by the user
+ * Artifact Id.
+ * @description symbolic name define by the user
* @parameter expression="${artifactId}"
*/
private String m_artifactId;
/**
- * @descritpion groupId define by the user
+ * Group Id.
+ * @description groupId define by the user
* @parameter expression="${groupId}"
*/
private String m_groupId;
/**
- * @descritpion version define by the user
+ * Version.
+ * @description version define by the user
* @parameter expression="${version}"
*/
private String m_version;
/**
- * @descritpion packaging define by the user
+ * Packaging.
+ * @description packaging define by the user
* @parameter expression="${packaging}"
*/
private String m_packaging;
/**
- * @descritpion obr file define by the user
+ * OBR File.
+ * @description obr file define by the user
* @parameter expression="${obr-file}"
*/
private String m_obrFile;
@@ -101,8 +106,7 @@
* @throws MojoExecutionException if the plugin failed
* @throws MojoFailureException if the plugin failed
*/
- public void execute() throws MojoExecutionException, MojoFailureException
- {
+ public void execute() throws MojoExecutionException, MojoFailureException {
getLog().info("Install-File Obr starts:");
m_project = new MavenProject();
@@ -113,23 +117,19 @@
PathFile fileOut;
- if (m_groupId == null)
- {
+ if (m_groupId == null) {
getLog().error("-DgroupId=VALUE is required");
return;
}
- if (m_artifactId == null)
- {
+ if (m_artifactId == null) {
getLog().error("-Dartifactid=VALUE is required");
return;
}
- if (m_version == null)
- {
+ if (m_version == null) {
getLog().error("-Dversion=VALUE is required");
return;
}
- if (m_packaging == null)
- {
+ if (m_packaging == null) {
getLog().error("-Dpackaging=VALUE is required");
return;
}
@@ -138,35 +138,34 @@
PathFile repoLocal = new PathFile(m_localRepo.getBasedir());
// get the target file in mvn repo
- fileOut = new PathFile(PathFile.uniformSeparator(m_settings.getLocalRepository()) + File.separator + m_groupId.replace('.', File.separatorChar) + File.separator + m_artifactId + File.separator + m_version + File.separator + m_artifactId + "-"
- + m_version + "." + m_packaging);
+ fileOut = new PathFile(PathFile.uniformSeparator(m_settings.getLocalRepository()) + File.separator + m_groupId.replace('.', File.separatorChar) + File.separator + m_artifactId + File.separator + m_version + File.separator + m_artifactId
+ + "-" + m_version + "." + m_packaging);
- if (!fileOut.isExists())
- {
+ if (!fileOut.isExists()) {
getLog().error("file doesn't exist: " + fileOut.getAbsoluteFilename());
return;
- }
- else
+ } else {
getLog().info("Target file: " + fileOut.getAbsoluteFilename());
+ }
- if (m_repositoryPath == null)
- {
+ if (m_repositoryPath == null) {
m_repositoryPath = "file:" + repoLocal.getOnlyAbsoluteFilename() + "repository.xml";
getLog().warn("-DpathRepo is not define, use default repository: " + m_repositoryPath);
}
PathFile fileRepo = new PathFile(m_repositoryPath);
- if (fileRepo.isRelative())
+ if (fileRepo.isRelative()) {
fileRepo.setBaseDir(m_settings.getLocalRepository());
+ }
// create the folder to the repository
PathFile repoExist = new PathFile(fileRepo.getAbsolutePath());
- if (!repoExist.isExists())
+ if (!repoExist.isExists()) {
fileRepo.createPath();
+ }
PathFile fileObrXml = new PathFile(m_obrFile);
- if (!fileObrXml.isExists())
- {
+ if (!fileObrXml.isExists()) {
getLog().warn("obr.xml file not found, use default");
}
Copied: felix/sandbox/clement/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ObrUpdate.java (from r572698, felix/sandbox/clement/maven-obr-plugin/src/main/java/org/apache/felix/maven/obr/plugin/ObrUpdate.java)
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ObrUpdate.java?p2=felix/sandbox/clement/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ObrUpdate.java&p1=felix/sandbox/clement/maven-obr-plugin/src/main/java/org/apache/felix/maven/obr/plugin/ObrUpdate.java&r1=572698&r2=572766&rev=572766&view=diff
==============================================================================
--- felix/sandbox/clement/maven-obr-plugin/src/main/java/org/apache/felix/maven/obr/plugin/ObrUpdate.java (original)
+++ felix/sandbox/clement/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/ObrUpdate.java Tue Sep 4 11:16:11 2007
@@ -1,4 +1,4 @@
-/*
+/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@@ -16,14 +16,13 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.felix.maven.obr.plugin;
+package org.apache.felix.obr.plugin;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.net.URI;
-import java.net.URL;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Properties;
@@ -50,13 +49,15 @@
import org.xml.sax.SAXException;
/**
- * this class parse the old repository.xml file build the bundle resource description and update the repository
- * @author Maxime
- *
+ * this class parse the old repository.xml file build the bundle resource description and update the repository.
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
*/
-public class ObrUpdate
-{
+public class ObrUpdate {
+ /**
+ * generate the date format to insert it in repository descriptor file.
+ */
+ static SimpleDateFormat m_format = new SimpleDateFormat("yyyyMMddHHmmss.SSS");
/**
* logger for this plugin.
@@ -66,22 +67,22 @@
/**
* name and path to the repository descriptor file.
*/
- private URI m_repoFilename;
+ private URI m_repoFilename;
/**
* name and path to the obr.xml file.
*/
- private String m_obrXml;
+ private String m_obrXml;
/**
* name and path to the bundle jar file.
*/
- private String m_outputFile;
+ private String m_outputFile;
/**
* maven project description.
*/
- private MavenProject m_project;
+ private MavenProject m_project;
/**
* user configuration information.
@@ -96,38 +97,32 @@
/**
* root on parent document.
*/
- private Document m_repoDoc;
+ private Document m_repoDoc;
/**
* used to determine the first free id.
*/
- private boolean[] m_idTab;
+ private boolean[] m_idTab;
/**
* first Node on repository descriptor tree.
*/
- private Node m_root;
+ private Node m_root;
/**
* used to extract bindex bundle information.
*/
- private ExtractBindexInfo m_ebi;
-
- /**
- * used to store bundle information
- */
- private ResourcesBundle m_resourceBundle;
+ private ExtractBindexInfo m_ebi;
-
/**
- * generate the date format to insert it in repository descriptor file
+ * used to store bundle information.
*/
- static SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmmss.SSS");
+ private ResourcesBundle m_resourceBundle;
/**
- * pathfile to the repository descriptor file
+ * pathfile to the repository descriptor file.
*/
- private PathFile m_repo;
+ private PathFile m_repo;
/**
* initialize information.
@@ -139,8 +134,7 @@
* @param userConfig user information
* @param log plugin logger
*/
- public ObrUpdate(PathFile repoFilename, String obrXml, MavenProject project, String outputFile, String localRepo, Config userConfig, Log log)
- {
+ public ObrUpdate(PathFile repoFilename, String obrXml, MavenProject project, String outputFile, String localRepo, Config userConfig, Log log) {
// this.m_localRepo = localRepo;
this.m_outputFile = outputFile;
this.m_repoFilename = repoFilename.getUri();
@@ -154,78 +148,61 @@
m_resourceBundle = new ResourcesBundle(log);
- if (userConfig.isRemotely())
- {
+ if (userConfig.isRemotely()) {
this.m_repo = new PathFile(localRepo);
- }
- else
- {
+ } else {
this.m_repo = repoFilename;
}
// System.err.println("Construct: "+repoFilename.getAbsoluteFilename());
}
/**
- * update the repository descriptor file.
- * parse the old repository descriptor file,
- * get the old reference of the bundle or determine the id for a new bundle,
- * extract information from bindex
- * set the new information in descriptor file and save it.
+ * update the repository descriptor file. parse the old repository descriptor file, get the old reference of the bundle or determine the id for a new bundle, extract information from bindex set the new information in descriptor file and save it.
* @throws MojoExecutionException if the plugin failed
*/
- public void updateRepository() throws MojoExecutionException
- {
+ public void updateRepository() throws MojoExecutionException {
m_constructor = initConstructor();
- if (m_constructor == null)
+ if (m_constructor == null) {
return;
+ }
// get the file size
PathFile pf = new PathFile(m_outputFile);
File fout = pf.getFile();
pf.setBaseDir(m_repo.getOnlyAbsolutePath());
- if (fout.exists())
- {
+ if (fout.exists()) {
m_resourceBundle.setSize(String.valueOf(fout.length()));
- if (m_userConfig.isPathRelative())
+ if (m_userConfig.isPathRelative()) {
m_resourceBundle.setUri(pf.getOnlyRelativeFilename().replace('\\', '/'));
- else
+ } else {
m_resourceBundle.setUri("file:" + m_outputFile);
- }
- else
- {
+ }
+ } else {
m_logger.error("file doesn't exist: " + m_outputFile);
return;
}
// parse repository
- if (parseRepositoryXml() == -1)
- {
- return;
- }
+ if (parseRepositoryXml() == -1) { return; }
// parse the obr.xml file
- if (m_obrXml != null)
- {
- URL url = getClass().getResource("/SchemaObr.xsd");
+ if (m_obrXml != null) {
+ // URL url = getClass().getResource("/SchemaObr.xsd");
// TODO validate obr.xml file
Document obrXmlDoc = parseFile(m_obrXml, m_constructor);
- if (obrXmlDoc == null)
- return;
+ if (obrXmlDoc == null) { return; }
Node obrXmlRoot = (Element) obrXmlDoc.getDocumentElement();
// sort the obr file
sortObrXml(obrXmlRoot);
}
// use bindex to extract bundle information
- try
- {
+ try {
m_ebi = new ExtractBindexInfo(m_repoFilename, m_outputFile);
- }
- catch (MojoExecutionException e)
- {
+ } catch (MojoExecutionException e) {
m_logger.error("unable to build Bindex informations");
e.printStackTrace();
throw new MojoExecutionException("MojoFailureException");
@@ -233,21 +210,17 @@
m_resourceBundle.construct(m_project, m_ebi);
- if (!walkOnTree(m_root))
- {
+ if (!walkOnTree(m_root)) {
// the correct resource node was not found, we must create it
// we calcul the new id
int id = -1;
- for (int i = 1; i < m_idTab.length; i++)
- {
- if (!m_idTab[i])
- {
+ for (int i = 1; i < m_idTab.length; i++) {
+ if (!m_idTab[i]) {
id = i;
break;
}
}
- if (id == -1)
- id = m_idTab.length;
+ if (id == -1) { id = m_idTab.length; }
searchRepository(m_root, id);
}
@@ -260,16 +233,12 @@
* init the document builder from xerces.
* @return DocumentBuilder ready to create new document
*/
- private DocumentBuilder initConstructor()
- {
+ private DocumentBuilder initConstructor() {
DocumentBuilder constructor = null;
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
- try
- {
+ try {
constructor = factory.newDocumentBuilder();
- }
- catch (ParserConfigurationException e)
- {
+ } catch (ParserConfigurationException e) {
m_logger.error("unable to create a new xml document");
e.printStackTrace();
}
@@ -282,20 +251,15 @@
* @return 0 if the bundle is already in the descriptor, else -1
* @throws MojoExecutionException if the plugin failed
*/
- private int parseRepositoryXml() throws MojoExecutionException
- {
+ private int parseRepositoryXml() throws MojoExecutionException {
File fout = new File(m_repoFilename.getPath());
- if (!fout.exists())
- {
+ if (!fout.exists()) {
// create the repository.xml
- try
- {
+ try {
fout.createNewFile();
m_logger.info("create new repository.xml file");
- }
- catch (IOException e)
- {
+ } catch (IOException e) {
m_logger.error("cannot create " + m_repoFilename.getPath());
e.printStackTrace();
return -1;
@@ -306,14 +270,11 @@
Date d = new Date();
d.setTime(System.currentTimeMillis());
Element root = doc.createElement("repository");
- root.setAttribute("lastmodified", format.format(d));
+ root.setAttribute("lastmodified", m_format.format(d));
root.setAttribute("name", "MyRepository");
- try
- {
+ try {
writeToFile(m_repoFilename, root);
- }
- catch (MojoExecutionException e)
- {
+ } catch (MojoExecutionException e) {
e.printStackTrace();
throw new MojoExecutionException("MojoExecutionException");
}
@@ -321,10 +282,7 @@
// now we parse the repository.xml file
m_repoDoc = parseFile(m_repoFilename.getPath()/* +m_ext */, m_constructor);
- if (m_repoDoc == null)
- {
- return -1;
- }
+ if (m_repoDoc == null) { return -1; }
m_root = (Element) m_repoDoc.getDocumentElement();
return 0;
@@ -335,26 +293,19 @@
* transform a xml file to a xerces Document.
* @param filename path to the xml file
* @param constructor DocumentBuilder get from xerces
- * @return Document which describe this file
+ * @return Document which describe this file
*/
- private Document parseFile(String filename, DocumentBuilder constructor)
- {
- if (constructor == null)
- return null;
+ private Document parseFile(String filename, DocumentBuilder constructor) {
+ if (constructor == null) { return null; }
// The document is the root of the DOM tree.
m_logger.info("Try to open: " + filename);
Document doc = null;
- try
- {
+ try {
doc = constructor.parse(new File(filename));
- }
- catch (SAXException e)
- {
+ } catch (SAXException e) {
e.printStackTrace();
return null;
- }
- catch (IOException e)
- {
+ } catch (IOException e) {
m_logger.error("cannot open file: " + filename);
e.printStackTrace();
return null;
@@ -366,74 +317,55 @@
* put the information from obr.xml into ressourceBundle object.
* @param node Node to the OBR.xml file
*/
- private void sortObrXml(Node node)
- {
- if (node.getNodeName().compareTo("require") == 0)
- {
+ private void sortObrXml(Node node) {
+ if (node.getNodeName().compareTo("require") == 0) {
Require newRequireNode = new Require();
NamedNodeMap list = node.getAttributes();
- try
- {
+ try {
newRequireNode.setExtend(list.getNamedItem("extend").getNodeValue());
newRequireNode.setMultiple(list.getNamedItem("multiple").getNodeValue());
newRequireNode.setOptional(list.getNamedItem("optional").getNodeValue());
newRequireNode.setFilter(list.getNamedItem("filter").getNodeValue());
newRequireNode.setName(list.getNamedItem("name").getNodeValue());
- }
- catch (NullPointerException e)
- {
+ } catch (NullPointerException e) {
m_logger.error("the obr.xml file seems to be invalid in a \"require\" tag (one or more attributes are missing)");
// e.printStackTrace();
}
newRequireNode.setValue(node.getTextContent());
m_resourceBundle.addRequire(newRequireNode);
- }
- else if (node.getNodeName().compareTo("capability") == 0)
- {
+ } else if (node.getNodeName().compareTo("capability") == 0) {
Capability newCapability = new Capability();
- try
- {
+ try {
newCapability.setName(node.getAttributes().getNamedItem("name").getNodeValue());
- }
- catch (NullPointerException e)
- {
+ } catch (NullPointerException e) {
m_logger.error("attribute \"name\" is missing in obr.xml in a \"capability\" tag");
e.printStackTrace();
}
NodeList list = node.getChildNodes();
- for (int i = 0; i < list.getLength(); i++)
- {
+ for (int i = 0; i < list.getLength(); i++) {
PElement p = new PElement();
Node n = list.item(i);
Node item = null;
// System.err.println(n.getNodeName());
- if (n.getNodeName().compareTo("p") == 0)
- {
+ if (n.getNodeName().compareTo("p") == 0) {
p.setN(n.getAttributes().getNamedItem("n").getNodeValue());
item = n.getAttributes().getNamedItem("t");
- if (item != null)
- p.setT(item.getNodeValue());
+ if (item != null) { p.setT(item.getNodeValue()); }
item = n.getAttributes().getNamedItem("v");
- if (item != null)
- p.setV(item.getNodeValue());
+ if (item != null) { p.setV(item.getNodeValue()); }
newCapability.addP(p);
}
}
m_resourceBundle.addCapability(newCapability);
- }
- else if (node.getNodeName().compareTo("category") == 0)
- {
+ } else if (node.getNodeName().compareTo("category") == 0) {
Category newCategory = new Category();
newCategory.setId(node.getAttributes().getNamedItem("id").getNodeValue());
m_resourceBundle.addCategory(newCategory);
- }
- else
- {
+ } else {
NodeList list = node.getChildNodes();
- for (int i = 0; i < list.getLength(); i++)
- {
+ for (int i = 0; i < list.getLength(); i++) {
sortObrXml(list.item(i));
}
}
@@ -445,17 +377,13 @@
* @param treeToBeWrite Node root of the tree to be write in file
* @throws MojoExecutionException if the plugin failed
*/
- private void writeToFile(URI outputFilename, Node treeToBeWrite) throws MojoExecutionException
- {
+ private void writeToFile(URI outputFilename, Node treeToBeWrite) throws MojoExecutionException {
// init the transformer
Transformer transformer = null;
TransformerFactory tfabrique = TransformerFactory.newInstance();
- try
- {
+ try {
transformer = tfabrique.newTransformer();
- }
- catch (TransformerConfigurationException e)
- {
+ } catch (TransformerConfigurationException e) {
m_logger.error("Unable to write to file: " + outputFilename.toString());
e.printStackTrace();
throw new MojoExecutionException("TransformerConfigurationException");
@@ -473,34 +401,25 @@
File fichier = new File(outputFilename);
FileOutputStream flux = null;
- try
- {
+ try {
flux = new FileOutputStream(fichier);
- }
- catch (FileNotFoundException e)
- {
+ } catch (FileNotFoundException e) {
m_logger.error("Unable to write to file: " + fichier.getName());
e.printStackTrace();
throw new MojoExecutionException("FileNotFoundException");
}
Result output = new StreamResult(flux);
- try
- {
+ try {
transformer.transform(input, output);
- }
- catch (TransformerException e)
- {
+ } catch (TransformerException e) {
e.printStackTrace();
throw new MojoExecutionException("TransformerException");
}
- try
- {
+ try {
flux.flush();
flux.close();
- }
- catch (IOException e)
- {
+ } catch (IOException e) {
e.printStackTrace();
throw new MojoExecutionException("IOException");
}
@@ -512,33 +431,22 @@
* @param node targeted node
* @return true if the requiered node was found else false.
*/
- private boolean walkOnTree(Node node)
- {
+ private boolean walkOnTree(Node node) {
- if (node.getNodeName().compareTo("resource") == 0)
- {
- if (resource(node))
- return true;
- else
- return false;
- }
- else
- { // look at the repository node (first in the file)
- if (node.getNodeName().compareTo("repository") == 0)
- {
+ if (node.getNodeName().compareTo("resource") == 0) {
+ return resource(node);
+ } else { // look at the repository node (first in the file)
+ if (node.getNodeName().compareTo("repository") == 0) {
Date d = new Date();
d.setTime(System.currentTimeMillis());
NamedNodeMap nList = node.getAttributes();
Node n = nList.getNamedItem("lastmodified");
- n.setNodeValue(format.format(d));
+ n.setNodeValue(m_format.format(d));
}
NodeList list = node.getChildNodes();
- if (list.getLength() > 0)
- {
- for (int i = 0; i < list.getLength(); i++)
- {
- if (walkOnTree(list.item(i)))
- return true;
+ if (list.getLength() > 0) {
+ for (int i = 0; i < list.getLength(); i++) {
+ if (walkOnTree(list.item(i))) { return true; }
}
}
return false;
@@ -551,21 +459,15 @@
* @param node Node on the xml file
* @param id id of the bundle ressource
*/
- private void searchRepository(Node node, int id)
- {
- if (node.getNodeName().compareTo("repository") == 0)
- {
+ private void searchRepository(Node node, int id) {
+ if (node.getNodeName().compareTo("repository") == 0) {
m_resourceBundle.setId(String.valueOf(id));
node.appendChild(m_resourceBundle.getNode(m_repoDoc));
return;
- }
- else
- {
+ } else {
NodeList list = node.getChildNodes();
- if (list.getLength() > 0)
- {
- for (int i = 0; i < list.getLength(); i++)
- {
+ if (list.getLength() > 0) {
+ for (int i = 0; i < list.getLength(); i++) {
searchRepository(list.item(i), id);
}
}
@@ -575,24 +477,23 @@
/**
* compare two node and update the array which compute the smallest free id.
- *
- * @param node
+ * @param node : node
* @return true if the node is the same bundle than the ressourceBundle, else false.
*/
- private boolean resource(Node node)
- {
+ private boolean resource(Node node) {
// this part save all the id free if we need to add resource
int id = Integer.parseInt(node.getAttributes().getNamedItem("id").getNodeValue());
- if (id >= m_idTab.length)
- {
+ if (id >= m_idTab.length) {
// resize tab
boolean[] bt = new boolean[id + 1];
- for (int i = 0; i < id + 1; i++)
- if (m_idTab.length > i && m_idTab[i])
+ for (int i = 0; i < id + 1; i++) {
+ if (m_idTab.length > i && m_idTab[i]) {
bt[i] = true;
- else
+ } else {
bt[i] = false;
+ }
+ }
m_idTab = bt;
}
@@ -600,8 +501,7 @@
NamedNodeMap map = node.getAttributes();
- if (m_resourceBundle.isSameBundleResource(map.getNamedItem("symbolicname").getNodeValue(), map.getNamedItem("presentationname").getNodeValue(), map.getNamedItem("version").getNodeValue()))
- {
+ if (m_resourceBundle.isSameBundleResource(map.getNamedItem("symbolicname").getNodeValue(), map.getNamedItem("presentationname").getNodeValue(), map.getNamedItem("version").getNodeValue())) {
m_resourceBundle.setId(String.valueOf(id));
node.getParentNode().replaceChild(m_resourceBundle.getNode(m_repoDoc), node);
return true;
Copied: felix/sandbox/clement/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/PElement.java (from r572698, felix/sandbox/clement/maven-obr-plugin/src/main/java/org/apache/felix/maven/obr/plugin/PElement.java)
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/PElement.java?p2=felix/sandbox/clement/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/PElement.java&p1=felix/sandbox/clement/maven-obr-plugin/src/main/java/org/apache/felix/maven/obr/plugin/PElement.java&r1=572698&r2=572766&rev=572766&view=diff
==============================================================================
--- felix/sandbox/clement/maven-obr-plugin/src/main/java/org/apache/felix/maven/obr/plugin/PElement.java (original)
+++ felix/sandbox/clement/maven-obr-plugin/src/main/java/org/apache/felix/obr/plugin/PElement.java Tue Sep 4 11:16:11 2007
@@ -1,4 +1,4 @@
-/*
+/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.felix.maven.obr.plugin;
+package org.apache.felix.obr.plugin;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -24,11 +24,10 @@
/**
* this class describe the p element in a capability tag.
- * @author Maxime
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
*
*/
-public class PElement
-{
+public class PElement {
/**
* store the v tag (value).
*/
@@ -48,54 +47,48 @@
* get the n tag.
* @return attribute n
*/
- public String getN()
- {
+ public String getN() {
return m_n;
}
/**
* set the n tage.
- * @param m_n new value
+ * @param n new value
*/
- public void setN(String m_n)
- {
- this.m_n = m_n;
+ public void setN(String n) {
+ this.m_n = n;
}
/**
* get the t tag.
* @return attribute t
*/
- public String getT()
- {
+ public String getT() {
return m_t;
}
/**
* set the t tag.
- * @param m_t new value
+ * @param t new value
*/
- public void setT(String m_t)
- {
- this.m_t = m_t;
+ public void setT(String t) {
+ this.m_t = t;
}
/**
* get the v tag.
* @return attribute v
*/
- public String getV()
- {
+ public String getV() {
return m_v;
}
/**
* set the v tag.
- * @param m_v new value
+ * @param v new value
*/
- public void setV(String m_v)
- {
- this.m_v = m_v;
+ public void setV(String v) {
+ this.m_v = v;
}
/**
@@ -103,15 +96,12 @@
* @param father father document for create Node
* @return node
*/
- public Node getNode(Document father)
- {
+ public Node getNode(Document father) {
Element p = father.createElement("p");
p.setAttribute("n", this.getN());
- if (this.getT() != null)
- p.setAttribute("t", this.getT());
+ if (this.getT() != null) { p.setAttribute("t", this.getT()); }
- if (this.getV() != null)
- p.setAttribute("v", this.getV());
+ if (this.getV() != null) { p.setAttribute("v", this.getV()); }
return p;
}