Home » geronimo-2.2-source-release » org.apache.geronimo.farm.plugin » [javadoc | source]

    1   /*
    2    * Licensed to the Apache Software Foundation (ASF) under one
    3    * or more contributor license agreements.  See the NOTICE file
    4    * distributed with this work for additional information
    5    * regarding copyright ownership.  The ASF licenses this file
    6    * to you under the Apache License, Version 2.0 (the
    7    * "License"); you may not use this file except in compliance
    8    * with the License.  You may obtain a copy of the License at
    9    *
   10    *  http://www.apache.org/licenses/LICENSE-2.0
   11    *
   12    * Unless required by applicable law or agreed to in writing,
   13    * software distributed under the License is distributed on an
   14    * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
   15    * KIND, either express or implied.  See the License for the
   16    * specific language governing permissions and limitations
   17    * under the License.
   18    */
   19   
   20   
   21   package org.apache.geronimo.farm.plugin;
   22   
   23   import javax.persistence.Entity;
   24   import javax.persistence.Id;
   25   import javax.persistence.GeneratedValue;
   26   
   27   import org.apache.geronimo.system.plugin.model.PluginType;
   28   import org.apache.geronimo.system.plugin.model.PluginArtifactType;
   29   import org.apache.geronimo.system.plugin.model.ArtifactType;
   30   import org.apache.geronimo.kernel.repository.Artifact;
   31   
   32   /**
   33    * @version $Rev: 698040 $ $Date: 2008-09-22 16:54:24 -0700 (Mon, 22 Sep 2008) $
   34    */
   35   @Entity(name="plugin")
   36   public class JpaPluginInstance {
   37   
   38       @Id
   39       @GeneratedValue
   40       private int id;
   41       private String groupId;
   42       private String artifactId;
   43       private String version;
   44       private String type;
   45   
   46       public JpaPluginInstance() {
   47       }
   48   
   49       public JpaPluginInstance(String groupId, String artifactId, String version, String type) {
   50           this.groupId = groupId;
   51           this.artifactId = artifactId;
   52           this.version = version;
   53           this.type = type;
   54       }
   55   
   56       public JpaPluginInstance(String artifactUri) {
   57           Artifact artifact = Artifact.create(artifactUri);
   58           this.groupId = artifact.getGroupId();
   59           this.artifactId = artifact.getArtifactId();
   60           this.version = artifact.getVersion().toString();
   61           this.type = artifact.getType();
   62       }
   63   
   64       public String getGroupId() {
   65           return groupId;
   66       }
   67   
   68       public void setGroupId(String groupId) {
   69           this.groupId = groupId;
   70       }
   71   
   72       public String getArtifactId() {
   73           return artifactId;
   74       }
   75   
   76       public void setArtifactId(String artifactId) {
   77           this.artifactId = artifactId;
   78       }
   79   
   80       public String getVersion() {
   81           return version;
   82       }
   83   
   84       public void setVersion(String version) {
   85           this.version = version;
   86       }
   87   
   88       public String getType() {
   89           return type;
   90       }
   91   
   92       public void setType(String type) {
   93           this.type = type;
   94       }
   95   
   96       public PluginType getPlugin() {
   97           PluginType plugin = new PluginType();
   98           PluginArtifactType pluginArtifact = new PluginArtifactType();
   99           ArtifactType artifact = new ArtifactType();
  100           artifact.setGroupId(groupId);
  101           artifact.setArtifactId(artifactId);
  102           artifact.setVersion(version);
  103           artifact.setType(type);
  104           pluginArtifact.setModuleId(artifact);
  105           plugin.getPluginArtifact().add(pluginArtifact);
  106           return plugin;
  107       }
  108   
  109       public String toString() {
  110           return groupId + "/" + artifactId + "/" + version + "/" + type;
  111       }
  112   
  113       public Artifact toArtifact() {
  114           return new Artifact(groupId, artifactId, version, type);
  115       }
  116   }

Home » geronimo-2.2-source-release » org.apache.geronimo.farm.plugin » [javadoc | source]