You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by ch...@apache.org on 2006/02/22 00:40:29 UTC
svn commit: r379627 [29/34] - in /incubator/servicemix/trunk: ./ etc/
sandbox/servicemix-wsn-1.2/src/sa/META-INF/
sandbox/servicemix-wsn-1.2/src/su/META-INF/ servicemix-assembly/
servicemix-assembly/src/main/assembly/ servicemix-assembly/src/main/relea...
Modified: incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/DeployerEditorPaletteFactory.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/DeployerEditorPaletteFactory.java?rev=379627&r1=379626&r2=379627&view=diff
==============================================================================
--- incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/DeployerEditorPaletteFactory.java (original)
+++ incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/DeployerEditorPaletteFactory.java Tue Feb 21 15:40:05 2006
@@ -1,182 +1,182 @@
-/*
- * Copyright 2005-2006 The Apache Software Foundation.
- *
- * Licensed 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.servicemix.packaging;
-
-import java.util.List;
-
-import org.apache.servicemix.descriptors.packaging.assets.Components.Component;
-import org.apache.servicemix.packaging.model.ComponentConnection;
-import org.eclipse.gef.palette.CombinedTemplateCreationEntry;
-import org.eclipse.gef.palette.ConnectionCreationToolEntry;
-import org.eclipse.gef.palette.MarqueeToolEntry;
-import org.eclipse.gef.palette.PaletteContainer;
-import org.eclipse.gef.palette.PaletteDrawer;
-import org.eclipse.gef.palette.PaletteEntry;
-import org.eclipse.gef.palette.PaletteGroup;
-import org.eclipse.gef.palette.PaletteRoot;
-import org.eclipse.gef.palette.PaletteSeparator;
-import org.eclipse.gef.palette.PanningSelectionToolEntry;
-import org.eclipse.gef.palette.ToolEntry;
-import org.eclipse.gef.requests.CreationFactory;
-import org.eclipse.gef.ui.palette.FlyoutPaletteComposite.FlyoutPreferences;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.resource.ImageDescriptor;
-
-/**
- * The GEF Palette Factory for the DeployerEditor
- *
- * @author <a href="mailto:philip.dodds@gmail.com">Philip Dodds </a>
- *
- */
-public class DeployerEditorPaletteFactory {
-
- private static final String PALETTE_DOCK_LOCATION = "DeployerEditorPaletteFactory.Location";
-
- /** Preference ID used to persist the palette size. */
- private static final String PALETTE_SIZE = "DeployerEditorPaletteFactory.Size";
-
- /** Preference ID used to persist the flyout palette's state. */
- private static final String PALETTE_STATE = "DeployerEditorPaletteFactory.State";
-
- public static FlyoutPreferences createPalettePreferences() {
- return new FlyoutPreferences() {
- private IPreferenceStore getPreferenceStore() {
- return DeployerPlugin.getDefault().getPreferenceStore();
- }
-
- public int getDockLocation() {
- return getPreferenceStore().getInt(PALETTE_DOCK_LOCATION);
- }
-
- public int getPaletteState() {
- return getPreferenceStore().getInt(PALETTE_STATE);
- }
-
- public int getPaletteWidth() {
- return getPreferenceStore().getInt(PALETTE_SIZE);
- }
-
- public void setDockLocation(int location) {
- getPreferenceStore().setValue(PALETTE_DOCK_LOCATION, location);
- }
-
- public void setPaletteState(int state) {
- getPreferenceStore().setValue(PALETTE_STATE, state);
- }
-
- public void setPaletteWidth(int width) {
- getPreferenceStore().setValue(PALETTE_SIZE, width);
- }
- };
- }
-
- public static PaletteRoot createPalette(DeployerEditor editor) {
- PaletteRoot palette = new PaletteRoot();
- palette.add(createToolsGroup(palette));
- palette.add(createComponentDrawer(editor));
- palette.add(createServiceEnginesDrawer(editor));
- return palette;
- }
-
- private static PaletteEntry createComponentDrawer(DeployerEditor editor) {
- PaletteDrawer componentsDrawer = new PaletteDrawer("Binding Components");
-
- List<ComponentArtifact> componentArtifacts = ComponentArtifactFactory
- .getComponentArtifacts();
-
- for (ComponentArtifact artifact : componentArtifacts) {
- for (Component component : artifact.getComponents().getComponent()) {
- if (component.getType().equals("binding-component")) {
- ImageDescriptor imageDescriptor = null;
- if (artifact.getComponentImage(component.getName()) != null)
- imageDescriptor = ImageDescriptor
- .createFromImage(artifact
- .getComponentImage(component.getName()));
- CombinedTemplateCreationEntry componentCreationEntry = new CombinedTemplateCreationEntry(
- component.getDescription(), component
- .getDescription(), Component.class,
- new ComponentCreationFactory(editor, component
- .getName(), component.getType()),
- imageDescriptor, imageDescriptor);
- componentsDrawer.add(componentCreationEntry);
- }
- }
- }
-
- return componentsDrawer;
- }
-
- private static PaletteEntry createServiceEnginesDrawer(DeployerEditor editor) {
- PaletteDrawer componentsDrawer = new PaletteDrawer("Service Engines");
-
- List<ComponentArtifact> serviceArtifacts = ComponentArtifactFactory
- .getComponentArtifacts();
-
- for (ComponentArtifact artifact : serviceArtifacts) {
- for (Component component : artifact.getComponents().getComponent()) {
- if (component.getType().equals("service-engine")) {
- ImageDescriptor imageDescriptor = null;
- if (artifact.getComponentImage(component.getName()) != null)
- imageDescriptor = ImageDescriptor
- .createFromImage(artifact
- .getComponentImage(component.getName()));
- CombinedTemplateCreationEntry componentCreationEntry = new CombinedTemplateCreationEntry(
- component.getDescription(), component
- .getDescription(), Component.class,
- new ComponentCreationFactory(editor, component
- .getName(), component.getType()),
- imageDescriptor, imageDescriptor);
- componentsDrawer.add(componentCreationEntry);
- }
- }
- }
-
- return componentsDrawer;
- }
-
- private static PaletteContainer createToolsGroup(PaletteRoot palette) {
- PaletteGroup toolGroup = new PaletteGroup("Tools");
-
- // Add a selection tool to the group
- ToolEntry tool = new PanningSelectionToolEntry();
- toolGroup.add(tool);
- palette.setDefaultEntry(tool);
-
- // Add a marquee tool to the group
- toolGroup.add(new MarqueeToolEntry());
-
- // Add a (unnamed) separator to the group
- toolGroup.add(new PaletteSeparator());
-
- // Add (solid-line) connection tool
- tool = new ConnectionCreationToolEntry("Solid connection",
- "Create a solid-line connection", new CreationFactory() {
- public Object getNewObject() {
- return null;
- }
-
- public Object getObjectType() {
- return ComponentConnection.SOLID_CONNECTION;
- }
- }, ImageDescriptor.createFromFile(DeployerPlugin.class,
- "icons/connection_s16.gif"), ImageDescriptor
- .createFromFile(DeployerPlugin.class,
- "icons/connection_s24.gif"));
- toolGroup.add(tool);
-
- return toolGroup;
- }
-}
+/*
+ * Copyright 2005-2006 The Apache Software Foundation.
+ *
+ * Licensed 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.servicemix.packaging;
+
+import java.util.List;
+
+import org.apache.servicemix.descriptors.packaging.assets.Components.Component;
+import org.apache.servicemix.packaging.model.ComponentConnection;
+import org.eclipse.gef.palette.CombinedTemplateCreationEntry;
+import org.eclipse.gef.palette.ConnectionCreationToolEntry;
+import org.eclipse.gef.palette.MarqueeToolEntry;
+import org.eclipse.gef.palette.PaletteContainer;
+import org.eclipse.gef.palette.PaletteDrawer;
+import org.eclipse.gef.palette.PaletteEntry;
+import org.eclipse.gef.palette.PaletteGroup;
+import org.eclipse.gef.palette.PaletteRoot;
+import org.eclipse.gef.palette.PaletteSeparator;
+import org.eclipse.gef.palette.PanningSelectionToolEntry;
+import org.eclipse.gef.palette.ToolEntry;
+import org.eclipse.gef.requests.CreationFactory;
+import org.eclipse.gef.ui.palette.FlyoutPaletteComposite.FlyoutPreferences;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.resource.ImageDescriptor;
+
+/**
+ * The GEF Palette Factory for the DeployerEditor
+ *
+ * @author <a href="mailto:philip.dodds@gmail.com">Philip Dodds </a>
+ *
+ */
+public class DeployerEditorPaletteFactory {
+
+ private static final String PALETTE_DOCK_LOCATION = "DeployerEditorPaletteFactory.Location";
+
+ /** Preference ID used to persist the palette size. */
+ private static final String PALETTE_SIZE = "DeployerEditorPaletteFactory.Size";
+
+ /** Preference ID used to persist the flyout palette's state. */
+ private static final String PALETTE_STATE = "DeployerEditorPaletteFactory.State";
+
+ public static FlyoutPreferences createPalettePreferences() {
+ return new FlyoutPreferences() {
+ private IPreferenceStore getPreferenceStore() {
+ return DeployerPlugin.getDefault().getPreferenceStore();
+ }
+
+ public int getDockLocation() {
+ return getPreferenceStore().getInt(PALETTE_DOCK_LOCATION);
+ }
+
+ public int getPaletteState() {
+ return getPreferenceStore().getInt(PALETTE_STATE);
+ }
+
+ public int getPaletteWidth() {
+ return getPreferenceStore().getInt(PALETTE_SIZE);
+ }
+
+ public void setDockLocation(int location) {
+ getPreferenceStore().setValue(PALETTE_DOCK_LOCATION, location);
+ }
+
+ public void setPaletteState(int state) {
+ getPreferenceStore().setValue(PALETTE_STATE, state);
+ }
+
+ public void setPaletteWidth(int width) {
+ getPreferenceStore().setValue(PALETTE_SIZE, width);
+ }
+ };
+ }
+
+ public static PaletteRoot createPalette(DeployerEditor editor) {
+ PaletteRoot palette = new PaletteRoot();
+ palette.add(createToolsGroup(palette));
+ palette.add(createComponentDrawer(editor));
+ palette.add(createServiceEnginesDrawer(editor));
+ return palette;
+ }
+
+ private static PaletteEntry createComponentDrawer(DeployerEditor editor) {
+ PaletteDrawer componentsDrawer = new PaletteDrawer("Binding Components");
+
+ List<ComponentArtifact> componentArtifacts = ComponentArtifactFactory
+ .getComponentArtifacts();
+
+ for (ComponentArtifact artifact : componentArtifacts) {
+ for (Component component : artifact.getComponents().getComponent()) {
+ if (component.getType().equals("binding-component")) {
+ ImageDescriptor imageDescriptor = null;
+ if (artifact.getComponentImage(component.getName()) != null)
+ imageDescriptor = ImageDescriptor
+ .createFromImage(artifact
+ .getComponentImage(component.getName()));
+ CombinedTemplateCreationEntry componentCreationEntry = new CombinedTemplateCreationEntry(
+ component.getDescription(), component
+ .getDescription(), Component.class,
+ new ComponentCreationFactory(editor, component
+ .getName(), component.getType()),
+ imageDescriptor, imageDescriptor);
+ componentsDrawer.add(componentCreationEntry);
+ }
+ }
+ }
+
+ return componentsDrawer;
+ }
+
+ private static PaletteEntry createServiceEnginesDrawer(DeployerEditor editor) {
+ PaletteDrawer componentsDrawer = new PaletteDrawer("Service Engines");
+
+ List<ComponentArtifact> serviceArtifacts = ComponentArtifactFactory
+ .getComponentArtifacts();
+
+ for (ComponentArtifact artifact : serviceArtifacts) {
+ for (Component component : artifact.getComponents().getComponent()) {
+ if (component.getType().equals("service-engine")) {
+ ImageDescriptor imageDescriptor = null;
+ if (artifact.getComponentImage(component.getName()) != null)
+ imageDescriptor = ImageDescriptor
+ .createFromImage(artifact
+ .getComponentImage(component.getName()));
+ CombinedTemplateCreationEntry componentCreationEntry = new CombinedTemplateCreationEntry(
+ component.getDescription(), component
+ .getDescription(), Component.class,
+ new ComponentCreationFactory(editor, component
+ .getName(), component.getType()),
+ imageDescriptor, imageDescriptor);
+ componentsDrawer.add(componentCreationEntry);
+ }
+ }
+ }
+
+ return componentsDrawer;
+ }
+
+ private static PaletteContainer createToolsGroup(PaletteRoot palette) {
+ PaletteGroup toolGroup = new PaletteGroup("Tools");
+
+ // Add a selection tool to the group
+ ToolEntry tool = new PanningSelectionToolEntry();
+ toolGroup.add(tool);
+ palette.setDefaultEntry(tool);
+
+ // Add a marquee tool to the group
+ toolGroup.add(new MarqueeToolEntry());
+
+ // Add a (unnamed) separator to the group
+ toolGroup.add(new PaletteSeparator());
+
+ // Add (solid-line) connection tool
+ tool = new ConnectionCreationToolEntry("Solid connection",
+ "Create a solid-line connection", new CreationFactory() {
+ public Object getNewObject() {
+ return null;
+ }
+
+ public Object getObjectType() {
+ return ComponentConnection.SOLID_CONNECTION;
+ }
+ }, ImageDescriptor.createFromFile(DeployerPlugin.class,
+ "icons/connection_s16.gif"), ImageDescriptor
+ .createFromFile(DeployerPlugin.class,
+ "icons/connection_s24.gif"));
+ toolGroup.add(tool);
+
+ return toolGroup;
+ }
+}
Propchange: incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/DeployerEditorPaletteFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/DeployerPlugin.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/DeployerPlugin.java?rev=379627&r1=379626&r2=379627&view=diff
==============================================================================
--- incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/DeployerPlugin.java (original)
+++ incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/DeployerPlugin.java Tue Feb 21 15:40:05 2006
@@ -1,38 +1,38 @@
-/*
- * Copyright 2005-2006 The Apache Software Foundation.
- *
- * Licensed 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.servicemix.packaging;
-
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-
-/**
- * The Eclipse plugin's Class for the Packaging Plugin
- *
- * @author <a href="mailto:philip.dodds@gmail.com">Philip Dodds </a>
- *
- */
-public class DeployerPlugin extends AbstractUIPlugin {
-
- private static DeployerPlugin singleton;
-
- public static DeployerPlugin getDefault() {
- return singleton;
- }
-
- public DeployerPlugin() {
- if (singleton == null)
- singleton = this;
- }
-}
+/*
+ * Copyright 2005-2006 The Apache Software Foundation.
+ *
+ * Licensed 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.servicemix.packaging;
+
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+/**
+ * The Eclipse plugin's Class for the Packaging Plugin
+ *
+ * @author <a href="mailto:philip.dodds@gmail.com">Philip Dodds </a>
+ *
+ */
+public class DeployerPlugin extends AbstractUIPlugin {
+
+ private static DeployerPlugin singleton;
+
+ public static DeployerPlugin getDefault() {
+ return singleton;
+ }
+
+ public DeployerPlugin() {
+ if (singleton == null)
+ singleton = this;
+ }
+}
Propchange: incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/DeployerPlugin.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/InvalidArchiveException.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/InvalidArchiveException.java?rev=379627&r1=379626&r2=379627&view=diff
==============================================================================
--- incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/InvalidArchiveException.java (original)
+++ incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/InvalidArchiveException.java Tue Feb 21 15:40:05 2006
@@ -1,36 +1,36 @@
-/*
- * Copyright 2005-2006 The Apache Software Foundation.
- *
- * Licensed 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.servicemix.packaging;
-
-/**
- * Exception thrown when a component artifact can not be parsed
- *
- * @author <a href="mailto:philip.dodds@gmail.com">Philip Dodds </a>
- *
- */
-public class InvalidArchiveException extends Exception {
-
- private static final long serialVersionUID = -831605227085404312L;
-
- public InvalidArchiveException(String string) {
- super(string);
- }
-
- public InvalidArchiveException(Exception e) {
- super(e);
- }
-
-}
+/*
+ * Copyright 2005-2006 The Apache Software Foundation.
+ *
+ * Licensed 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.servicemix.packaging;
+
+/**
+ * Exception thrown when a component artifact can not be parsed
+ *
+ * @author <a href="mailto:philip.dodds@gmail.com">Philip Dodds </a>
+ *
+ */
+public class InvalidArchiveException extends Exception {
+
+ private static final long serialVersionUID = -831605227085404312L;
+
+ public InvalidArchiveException(String string) {
+ super(string);
+ }
+
+ public InvalidArchiveException(Exception e) {
+ super(e);
+ }
+
+}
Propchange: incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/InvalidArchiveException.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/JarResources.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/JarResources.java?rev=379627&r1=379626&r2=379627&view=diff
==============================================================================
--- incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/JarResources.java (original)
+++ incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/JarResources.java Tue Feb 21 15:40:05 2006
@@ -1,94 +1,94 @@
-/*
- * Copyright 2005-2006 The Apache Software Foundation.
- *
- * Licensed 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.servicemix.packaging;
-
-import java.io.BufferedInputStream;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipFile;
-import java.util.zip.ZipInputStream;
-
-/**
- * Holds the resources for a given JAR, bit of a memory intensive idea
- *
- * TODO Look and importing so we are not holding the contenting in memory
- *
- * @author <a href="mailto:philip.dodds@gmail.com">Philip Dodds </a>
- *
- */
-public class JarResources {
-
- private Map<String, Integer> htSizes = new HashMap<String, Integer>();
-
- private Map<String, byte[]> htJarContents = new HashMap<String, byte[]>();
-
- private String jarFileName;
-
- public JarResources(String jarFileName) throws IOException {
- this.jarFileName = jarFileName;
- init();
- }
-
- public Map getResourceMap() {
- return htJarContents;
- }
-
- public byte[] getResource(String resourceName) {
- return (byte[]) htJarContents.get(resourceName);
- }
-
- public void init() throws IOException {
-
- ZipFile zf = new ZipFile(jarFileName);
- Enumeration e = zf.entries();
- while (e.hasMoreElements()) {
- ZipEntry ze = (ZipEntry) e.nextElement();
- htSizes.put(ze.getName(), new Integer((int) ze.getSize()));
- }
- zf.close();
- FileInputStream fis = new FileInputStream(jarFileName);
- BufferedInputStream bis = new BufferedInputStream(fis);
- ZipInputStream zis = new ZipInputStream(bis);
- ZipEntry ze = null;
- while ((ze = zis.getNextEntry()) != null) {
- if (ze.isDirectory()) {
- continue;
- }
- int size = (int) ze.getSize();
- // -1 means unknown size.
- if (size == -1) {
- size = ((Integer) htSizes.get(ze.getName())).intValue();
- }
- byte[] b = new byte[(int) size];
- int rb = 0;
- int chunk = 0;
- while (((int) size - rb) > 0) {
- chunk = zis.read(b, rb, (int) size - rb);
- if (chunk == -1) {
- break;
- }
- rb += chunk;
- }
- // add to internal resource hashtable
- htJarContents.put(ze.getName(), b);
- }
-
- }
-}
+/*
+ * Copyright 2005-2006 The Apache Software Foundation.
+ *
+ * Licensed 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.servicemix.packaging;
+
+import java.io.BufferedInputStream;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
+import java.util.zip.ZipInputStream;
+
+/**
+ * Holds the resources for a given JAR, bit of a memory intensive idea
+ *
+ * TODO Look and importing so we are not holding the contenting in memory
+ *
+ * @author <a href="mailto:philip.dodds@gmail.com">Philip Dodds </a>
+ *
+ */
+public class JarResources {
+
+ private Map<String, Integer> htSizes = new HashMap<String, Integer>();
+
+ private Map<String, byte[]> htJarContents = new HashMap<String, byte[]>();
+
+ private String jarFileName;
+
+ public JarResources(String jarFileName) throws IOException {
+ this.jarFileName = jarFileName;
+ init();
+ }
+
+ public Map getResourceMap() {
+ return htJarContents;
+ }
+
+ public byte[] getResource(String resourceName) {
+ return (byte[]) htJarContents.get(resourceName);
+ }
+
+ public void init() throws IOException {
+
+ ZipFile zf = new ZipFile(jarFileName);
+ Enumeration e = zf.entries();
+ while (e.hasMoreElements()) {
+ ZipEntry ze = (ZipEntry) e.nextElement();
+ htSizes.put(ze.getName(), new Integer((int) ze.getSize()));
+ }
+ zf.close();
+ FileInputStream fis = new FileInputStream(jarFileName);
+ BufferedInputStream bis = new BufferedInputStream(fis);
+ ZipInputStream zis = new ZipInputStream(bis);
+ ZipEntry ze = null;
+ while ((ze = zis.getNextEntry()) != null) {
+ if (ze.isDirectory()) {
+ continue;
+ }
+ int size = (int) ze.getSize();
+ // -1 means unknown size.
+ if (size == -1) {
+ size = ((Integer) htSizes.get(ze.getName())).intValue();
+ }
+ byte[] b = new byte[(int) size];
+ int rb = 0;
+ int chunk = 0;
+ while (((int) size - rb) > 0) {
+ chunk = zis.read(b, rb, (int) size - rb);
+ if (chunk == -1) {
+ break;
+ }
+ rb += chunk;
+ }
+ // add to internal resource hashtable
+ htJarContents.put(ze.getName(), b);
+ }
+
+ }
+}
Propchange: incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/JarResources.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/actions/DeployAction.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/actions/DeployAction.java?rev=379627&r1=379626&r2=379627&view=diff
==============================================================================
--- incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/actions/DeployAction.java (original)
+++ incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/actions/DeployAction.java Tue Feb 21 15:40:05 2006
@@ -1,127 +1,127 @@
-/*
- * Copyright 2005-2006 The Apache Software Foundation.
- *
- * Licensed 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.servicemix.packaging.actions;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.apache.servicemix.packaging.DeployerEditor;
-import org.apache.servicemix.packaging.engine.PackagingEngine;
-import org.apache.servicemix.packaging.model.AbstractComponent;
-import org.apache.servicemix.packaging.model.BindingComponent;
-import org.apache.servicemix.packaging.model.ServiceAssembly;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.EditPartViewer;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * The Eclipse Action to deploy from the DeployerEditor
- *
- * @author <a href="mailto:philip.dodds@gmail.com">Philip Dodds </a>
- *
- */
-public class DeployAction extends Action {
-
- public static final String COMPONENT_ID = "DEPLOY_SERVICE_ACTION";
-
- private EditPartViewer viewer;
-
- private DeployerEditor editor;
-
- public DeployAction(EditPartViewer viewer, DeployerEditor editor) {
- super();
- this.viewer = viewer;
- this.editor = editor;
- }
-
- @Override
- public String getId() {
- return COMPONENT_ID;
- }
-
- @Override
- public String getText() {
- return "Deploy";
- }
-
- @Override
- public boolean isEnabled() {
- List selectedParts = viewer.getSelectedEditParts();
- for (Iterator partIterator = selectedParts.iterator(); partIterator
- .hasNext();) {
- EditPart editPart = (EditPart) partIterator.next();
- if (editPart.getModel() instanceof AbstractComponent) {
- AbstractComponent component = (AbstractComponent) editPart
- .getModel();
- return true;
- }
- }
- return false;
- }
-
- @Override
- public void run() {
- try {
- List selectedParts = viewer.getSelectedEditParts();
-
- // Gather up a list of the services
- List<AbstractComponent> components = new ArrayList<AbstractComponent>();
- for (Iterator partIterator = selectedParts.iterator(); partIterator
- .hasNext();) {
- EditPart editPart = (EditPart) partIterator.next();
- if (editPart.getModel() instanceof AbstractComponent) {
- AbstractComponent component = (AbstractComponent) editPart
- .getModel();
- components.add(component);
- }
- }
-
- // Deploy the services
- for (AbstractComponent component : components) {
- if (component instanceof BindingComponent) {
- for (PackagingEngine engine : ((BindingComponent) component)
- .getComponentArtifact().getPackagingEngines(
- ((BindingComponent) component)
- .getComponentName())) {
- if (engine.canDeploy(component)) {
- engine.deploy(null, editor.getProject());
- }
- }
- } else if (component instanceof ServiceAssembly) {
- for (PackagingEngine engine : ((ServiceAssembly) component)
- .getComponentArtifact().getPackagingEngines(
- ((ServiceAssembly) component)
- .getComponentName())) {
- if (engine.canDeploy(component)) {
- engine.deploy(null, editor.getProject());
- }
- }
- }
- }
- } catch (Throwable e) {
- e.printStackTrace();
- Status s = new Status(Status.ERROR, "not_used", 0, e.getMessage(),
- e);
- ErrorDialog.openError(PlatformUI.getWorkbench()
- .getActiveWorkbenchWindow().getShell(), "Unable to Deploy",
- null, s);
- }
- }
-}
+/*
+ * Copyright 2005-2006 The Apache Software Foundation.
+ *
+ * Licensed 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.servicemix.packaging.actions;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.servicemix.packaging.DeployerEditor;
+import org.apache.servicemix.packaging.engine.PackagingEngine;
+import org.apache.servicemix.packaging.model.AbstractComponent;
+import org.apache.servicemix.packaging.model.BindingComponent;
+import org.apache.servicemix.packaging.model.ServiceAssembly;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPartViewer;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.dialogs.ErrorDialog;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * The Eclipse Action to deploy from the DeployerEditor
+ *
+ * @author <a href="mailto:philip.dodds@gmail.com">Philip Dodds </a>
+ *
+ */
+public class DeployAction extends Action {
+
+ public static final String COMPONENT_ID = "DEPLOY_SERVICE_ACTION";
+
+ private EditPartViewer viewer;
+
+ private DeployerEditor editor;
+
+ public DeployAction(EditPartViewer viewer, DeployerEditor editor) {
+ super();
+ this.viewer = viewer;
+ this.editor = editor;
+ }
+
+ @Override
+ public String getId() {
+ return COMPONENT_ID;
+ }
+
+ @Override
+ public String getText() {
+ return "Deploy";
+ }
+
+ @Override
+ public boolean isEnabled() {
+ List selectedParts = viewer.getSelectedEditParts();
+ for (Iterator partIterator = selectedParts.iterator(); partIterator
+ .hasNext();) {
+ EditPart editPart = (EditPart) partIterator.next();
+ if (editPart.getModel() instanceof AbstractComponent) {
+ AbstractComponent component = (AbstractComponent) editPart
+ .getModel();
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public void run() {
+ try {
+ List selectedParts = viewer.getSelectedEditParts();
+
+ // Gather up a list of the services
+ List<AbstractComponent> components = new ArrayList<AbstractComponent>();
+ for (Iterator partIterator = selectedParts.iterator(); partIterator
+ .hasNext();) {
+ EditPart editPart = (EditPart) partIterator.next();
+ if (editPart.getModel() instanceof AbstractComponent) {
+ AbstractComponent component = (AbstractComponent) editPart
+ .getModel();
+ components.add(component);
+ }
+ }
+
+ // Deploy the services
+ for (AbstractComponent component : components) {
+ if (component instanceof BindingComponent) {
+ for (PackagingEngine engine : ((BindingComponent) component)
+ .getComponentArtifact().getPackagingEngines(
+ ((BindingComponent) component)
+ .getComponentName())) {
+ if (engine.canDeploy(component)) {
+ engine.deploy(null, editor.getProject());
+ }
+ }
+ } else if (component instanceof ServiceAssembly) {
+ for (PackagingEngine engine : ((ServiceAssembly) component)
+ .getComponentArtifact().getPackagingEngines(
+ ((ServiceAssembly) component)
+ .getComponentName())) {
+ if (engine.canDeploy(component)) {
+ engine.deploy(null, editor.getProject());
+ }
+ }
+ }
+ }
+ } catch (Throwable e) {
+ e.printStackTrace();
+ Status s = new Status(Status.ERROR, "not_used", 0, e.getMessage(),
+ e);
+ ErrorDialog.openError(PlatformUI.getWorkbench()
+ .getActiveWorkbenchWindow().getShell(), "Unable to Deploy",
+ null, s);
+ }
+ }
+}
Propchange: incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/actions/DeployAction.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/actions/UndeployServiceAction.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/actions/UndeployServiceAction.java?rev=379627&r1=379626&r2=379627&view=diff
==============================================================================
--- incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/actions/UndeployServiceAction.java (original)
+++ incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/actions/UndeployServiceAction.java Tue Feb 21 15:40:05 2006
@@ -1,114 +1,114 @@
-/*
- * Copyright 2005-2006 The Apache Software Foundation.
- *
- * Licensed 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.servicemix.packaging.actions;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.apache.servicemix.packaging.DeployerEditor;
-import org.apache.servicemix.packaging.engine.PackagingEngine;
-import org.apache.servicemix.packaging.model.AbstractComponent;
-import org.apache.servicemix.packaging.model.BindingComponent;
-import org.apache.servicemix.packaging.model.ServiceAssembly;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.EditPartViewer;
-import org.eclipse.jface.action.Action;
-
-/**
- * The Eclipse Action to undeploy from the DeployerEditor
- *
- * @author <a href="mailto:philip.dodds@gmail.com">Philip Dodds </a>
- *
- */
-public class UndeployServiceAction extends Action {
-
- public static final String COMPONENT_ID = "UNDEPLOY_SERVICE_ACTION";
-
- private EditPartViewer viewer;
-
- private DeployerEditor editor;
-
- public UndeployServiceAction(EditPartViewer viewer, DeployerEditor editor) {
- super();
- this.viewer = viewer;
- this.editor = editor;
- }
-
- @Override
- public String getId() {
- return COMPONENT_ID;
- }
-
- @Override
- public String getText() {
- return "Undeploy";
- }
-
- @Override
- public boolean isEnabled() {
- List selectedParts = viewer.getSelectedEditParts();
- for (Iterator partIterator = selectedParts.iterator(); partIterator
- .hasNext();) {
- EditPart editPart = (EditPart) partIterator.next();
- if (editPart.getModel() instanceof AbstractComponent) {
- AbstractComponent component = (AbstractComponent) editPart
- .getModel();
- return true;
- }
- }
- return false;
- }
-
- @Override
- public void run() {
- List selectedParts = viewer.getSelectedEditParts();
-
- List<AbstractComponent> components = new ArrayList<AbstractComponent>();
- for (Iterator partIterator = selectedParts.iterator(); partIterator
- .hasNext();) {
- EditPart editPart = (EditPart) partIterator.next();
- if (editPart.getModel() instanceof AbstractComponent) {
- AbstractComponent component = (AbstractComponent) editPart
- .getModel();
- components.add(component);
- }
- }
-
- // Undeploy the services
- for (AbstractComponent component : components) {
- if (component instanceof BindingComponent) {
- for (PackagingEngine engine : ((BindingComponent) component)
- .getComponentArtifact().getPackagingEngines(
- ((BindingComponent) component)
- .getComponentName())) {
- if (engine.canDeploy(component)) {
- engine.undeploy(null, editor.getProject());
- }
- }
- } else if (component instanceof ServiceAssembly) {
- for (PackagingEngine engine : ((ServiceAssembly) component)
- .getComponentArtifact().getPackagingEngines(
- ((ServiceAssembly) component)
- .getComponentName())) {
- if (engine.canDeploy(component)) {
- engine.undeploy(null, editor.getProject());
- }
- }
- }
- }
- }
-}
+/*
+ * Copyright 2005-2006 The Apache Software Foundation.
+ *
+ * Licensed 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.servicemix.packaging.actions;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.servicemix.packaging.DeployerEditor;
+import org.apache.servicemix.packaging.engine.PackagingEngine;
+import org.apache.servicemix.packaging.model.AbstractComponent;
+import org.apache.servicemix.packaging.model.BindingComponent;
+import org.apache.servicemix.packaging.model.ServiceAssembly;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPartViewer;
+import org.eclipse.jface.action.Action;
+
+/**
+ * The Eclipse Action to undeploy from the DeployerEditor
+ *
+ * @author <a href="mailto:philip.dodds@gmail.com">Philip Dodds </a>
+ *
+ */
+public class UndeployServiceAction extends Action {
+
+ public static final String COMPONENT_ID = "UNDEPLOY_SERVICE_ACTION";
+
+ private EditPartViewer viewer;
+
+ private DeployerEditor editor;
+
+ public UndeployServiceAction(EditPartViewer viewer, DeployerEditor editor) {
+ super();
+ this.viewer = viewer;
+ this.editor = editor;
+ }
+
+ @Override
+ public String getId() {
+ return COMPONENT_ID;
+ }
+
+ @Override
+ public String getText() {
+ return "Undeploy";
+ }
+
+ @Override
+ public boolean isEnabled() {
+ List selectedParts = viewer.getSelectedEditParts();
+ for (Iterator partIterator = selectedParts.iterator(); partIterator
+ .hasNext();) {
+ EditPart editPart = (EditPart) partIterator.next();
+ if (editPart.getModel() instanceof AbstractComponent) {
+ AbstractComponent component = (AbstractComponent) editPart
+ .getModel();
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public void run() {
+ List selectedParts = viewer.getSelectedEditParts();
+
+ List<AbstractComponent> components = new ArrayList<AbstractComponent>();
+ for (Iterator partIterator = selectedParts.iterator(); partIterator
+ .hasNext();) {
+ EditPart editPart = (EditPart) partIterator.next();
+ if (editPart.getModel() instanceof AbstractComponent) {
+ AbstractComponent component = (AbstractComponent) editPart
+ .getModel();
+ components.add(component);
+ }
+ }
+
+ // Undeploy the services
+ for (AbstractComponent component : components) {
+ if (component instanceof BindingComponent) {
+ for (PackagingEngine engine : ((BindingComponent) component)
+ .getComponentArtifact().getPackagingEngines(
+ ((BindingComponent) component)
+ .getComponentName())) {
+ if (engine.canDeploy(component)) {
+ engine.undeploy(null, editor.getProject());
+ }
+ }
+ } else if (component instanceof ServiceAssembly) {
+ for (PackagingEngine engine : ((ServiceAssembly) component)
+ .getComponentArtifact().getPackagingEngines(
+ ((ServiceAssembly) component)
+ .getComponentName())) {
+ if (engine.canDeploy(component)) {
+ engine.undeploy(null, editor.getProject());
+ }
+ }
+ }
+ }
+ }
+}
Propchange: incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/actions/UndeployServiceAction.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/engine/AbstractPackagingEngine.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/engine/AbstractPackagingEngine.java?rev=379627&r1=379626&r2=379627&view=diff
==============================================================================
--- incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/engine/AbstractPackagingEngine.java (original)
+++ incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/engine/AbstractPackagingEngine.java Tue Feb 21 15:40:05 2006
@@ -1,126 +1,126 @@
-/*
- * Copyright 2005-2006 The Apache Software Foundation.
- *
- * Licensed 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.servicemix.packaging.engine;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.StringWriter;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipOutputStream;
-
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.Marshaller;
-
-import org.apache.servicemix.descriptors.packaging.assets.Assets;
-import org.apache.servicemix.descriptors.packaging.assets.Components.Component;
-import org.apache.servicemix.packaging.ComponentArtifact;
-import org.apache.servicemix.packaging.ComponentArtifactFactory;
-import org.apache.servicemix.packaging.model.AbstractComponent;
-import org.apache.servicemix.packaging.model.DeploymentDiagram;
-import org.apache.servicemix.packaging.model.ModelElement;
-
-public abstract class AbstractPackagingEngine implements PackagingEngine {
-
- private ComponentArtifact artifact;
-
- private List injectors = new ArrayList();
-
- public ComponentArtifact getArtifact() {
- return artifact;
- }
-
- public ComponentArtifact getArtifactForComponent(Component serviceToLookup) {
- for (ComponentArtifact artifact : ComponentArtifactFactory
- .getComponentArtifacts()) {
- for (Component component : artifact.getComponents().getComponent()) {
- if (component.getName().equals(serviceToLookup.getName())) {
- return artifact;
- }
- }
- }
- return null;
- }
-
- public String getDeploymentDir(ModelElement component) {
- String path = null;
- if (component instanceof DeploymentDiagram)
- path = ((DeploymentDiagram) component).getDeployPath();
- else if (component instanceof AbstractComponent) {
- path = getDeploymentDir(((AbstractComponent) component)
- .getParentModelElement());
- }
- if (path != null)
- new File(path).mkdirs();
-
- return path;
- }
-
- public String getInstallPath(ModelElement component) {
- String path = null;
- if (component instanceof DeploymentDiagram)
- path = ((DeploymentDiagram) component).getInstallPath();
- else if (component instanceof AbstractComponent) {
- path = getInstallPath(((AbstractComponent) component)
- .getParentModelElement());
- }
-
- if (path != null)
- new File(path).mkdirs();
-
- return path;
- }
-
- protected void injectComponentFiles(ZipOutputStream out,
- String componentName) throws IOException {
- for (String fileName : getArtifact().getResourceMap().keySet()) {
- if (!fileName.equals("META-INF/components.xml")) {
- if (fileName.equals(getArtifact().getComponentDefinitionByName(
- componentName).getAssets().getJbiDescriptor())) {
- out.putNextEntry(new ZipEntry("META-INF/jbi.xml"));
- } else
- out.putNextEntry(new ZipEntry(fileName));
- out.write(artifact.getResourceMap().get(fileName));
- out.closeEntry();
- }
- }
- }
-
- protected void injectAssets(Assets assets, ZipOutputStream out)
- throws Exception {
- JAXBContext context = JAXBContext.newInstance(Assets.class.getPackage()
- .getName());
- Marshaller m = context.createMarshaller();
- final StringWriter write = new StringWriter();
- m.marshal(assets, write);
- out.putNextEntry(new ZipEntry("META-INF/bundled-assets.xml"));
- out.write(write.toString().getBytes());
- out.closeEntry();
- }
-
- public void setArtifact(ComponentArtifact artifact) {
- this.artifact = artifact;
- }
-
- public void setInjectors(List<PackagingInjector> injectors) {
- this.injectors = injectors;
- }
-
- public List<PackagingInjector> getInjectors() {
- return injectors;
- }
-}
+/*
+ * Copyright 2005-2006 The Apache Software Foundation.
+ *
+ * Licensed 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.servicemix.packaging.engine;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.StringWriter;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipOutputStream;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.Marshaller;
+
+import org.apache.servicemix.descriptors.packaging.assets.Assets;
+import org.apache.servicemix.descriptors.packaging.assets.Components.Component;
+import org.apache.servicemix.packaging.ComponentArtifact;
+import org.apache.servicemix.packaging.ComponentArtifactFactory;
+import org.apache.servicemix.packaging.model.AbstractComponent;
+import org.apache.servicemix.packaging.model.DeploymentDiagram;
+import org.apache.servicemix.packaging.model.ModelElement;
+
+public abstract class AbstractPackagingEngine implements PackagingEngine {
+
+ private ComponentArtifact artifact;
+
+ private List injectors = new ArrayList();
+
+ public ComponentArtifact getArtifact() {
+ return artifact;
+ }
+
+ public ComponentArtifact getArtifactForComponent(Component serviceToLookup) {
+ for (ComponentArtifact artifact : ComponentArtifactFactory
+ .getComponentArtifacts()) {
+ for (Component component : artifact.getComponents().getComponent()) {
+ if (component.getName().equals(serviceToLookup.getName())) {
+ return artifact;
+ }
+ }
+ }
+ return null;
+ }
+
+ public String getDeploymentDir(ModelElement component) {
+ String path = null;
+ if (component instanceof DeploymentDiagram)
+ path = ((DeploymentDiagram) component).getDeployPath();
+ else if (component instanceof AbstractComponent) {
+ path = getDeploymentDir(((AbstractComponent) component)
+ .getParentModelElement());
+ }
+ if (path != null)
+ new File(path).mkdirs();
+
+ return path;
+ }
+
+ public String getInstallPath(ModelElement component) {
+ String path = null;
+ if (component instanceof DeploymentDiagram)
+ path = ((DeploymentDiagram) component).getInstallPath();
+ else if (component instanceof AbstractComponent) {
+ path = getInstallPath(((AbstractComponent) component)
+ .getParentModelElement());
+ }
+
+ if (path != null)
+ new File(path).mkdirs();
+
+ return path;
+ }
+
+ protected void injectComponentFiles(ZipOutputStream out,
+ String componentName) throws IOException {
+ for (String fileName : getArtifact().getResourceMap().keySet()) {
+ if (!fileName.equals("META-INF/components.xml")) {
+ if (fileName.equals(getArtifact().getComponentDefinitionByName(
+ componentName).getAssets().getJbiDescriptor())) {
+ out.putNextEntry(new ZipEntry("META-INF/jbi.xml"));
+ } else
+ out.putNextEntry(new ZipEntry(fileName));
+ out.write(artifact.getResourceMap().get(fileName));
+ out.closeEntry();
+ }
+ }
+ }
+
+ protected void injectAssets(Assets assets, ZipOutputStream out)
+ throws Exception {
+ JAXBContext context = JAXBContext.newInstance(Assets.class.getPackage()
+ .getName());
+ Marshaller m = context.createMarshaller();
+ final StringWriter write = new StringWriter();
+ m.marshal(assets, write);
+ out.putNextEntry(new ZipEntry("META-INF/bundled-assets.xml"));
+ out.write(write.toString().getBytes());
+ out.closeEntry();
+ }
+
+ public void setArtifact(ComponentArtifact artifact) {
+ this.artifact = artifact;
+ }
+
+ public void setInjectors(List<PackagingInjector> injectors) {
+ this.injectors = injectors;
+ }
+
+ public List<PackagingInjector> getInjectors() {
+ return injectors;
+ }
+}
Propchange: incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/engine/AbstractPackagingEngine.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/engine/ArtifactInjector.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/engine/ArtifactInjector.java?rev=379627&r1=379626&r2=379627&view=diff
==============================================================================
--- incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/engine/ArtifactInjector.java (original)
+++ incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/engine/ArtifactInjector.java Tue Feb 21 15:40:05 2006
@@ -1,65 +1,65 @@
-/*
- * Copyright 2005-2006 The Apache Software Foundation.
- *
- * Licensed 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.servicemix.packaging.engine;
-
-import java.io.InputStream;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipOutputStream;
-
-import org.apache.servicemix.descriptors.packaging.assets.Artifact;
-import org.apache.servicemix.descriptors.packaging.assets.Assets;
-import org.apache.servicemix.packaging.model.BindingComponent;
-import org.apache.servicemix.packaging.model.ModelElement;
-import org.apache.servicemix.packaging.model.ServiceUnit;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IProgressMonitor;
-
-public class ArtifactInjector implements PackagingInjector {
-
- private Assets storedAssets;
-
- public boolean canInject(ModelElement modelElement) {
- if (modelElement instanceof BindingComponent) {
- storedAssets = ((BindingComponent) modelElement).getStoredAssets();
- return true;
- }
- if (modelElement instanceof ServiceUnit) {
- storedAssets = ((ServiceUnit) modelElement).getStoredAssets();
- return true;
- }
- return false;
- }
-
- public void inject(IProgressMonitor monitor, IProject project,
- ZipOutputStream outputStream) {
- try {
- for (Artifact reference : storedAssets.getArtifact()) {
-
- InputStream inputStream = project.getFile(reference.getPath())
- .getContents();
- byte[] theBytes;
- theBytes = new byte[inputStream.available()];
- inputStream.read(theBytes);
- outputStream.putNextEntry(new ZipEntry(reference.getName()));
- outputStream.write(theBytes);
- outputStream.closeEntry();
- }
- } catch (Exception e) {
- throw new RuntimeException("Unable to inject artifacts");
- }
- }
-
-}
+/*
+ * Copyright 2005-2006 The Apache Software Foundation.
+ *
+ * Licensed 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.servicemix.packaging.engine;
+
+import java.io.InputStream;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipOutputStream;
+
+import org.apache.servicemix.descriptors.packaging.assets.Artifact;
+import org.apache.servicemix.descriptors.packaging.assets.Assets;
+import org.apache.servicemix.packaging.model.BindingComponent;
+import org.apache.servicemix.packaging.model.ModelElement;
+import org.apache.servicemix.packaging.model.ServiceUnit;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IProgressMonitor;
+
+public class ArtifactInjector implements PackagingInjector {
+
+ private Assets storedAssets;
+
+ public boolean canInject(ModelElement modelElement) {
+ if (modelElement instanceof BindingComponent) {
+ storedAssets = ((BindingComponent) modelElement).getStoredAssets();
+ return true;
+ }
+ if (modelElement instanceof ServiceUnit) {
+ storedAssets = ((ServiceUnit) modelElement).getStoredAssets();
+ return true;
+ }
+ return false;
+ }
+
+ public void inject(IProgressMonitor monitor, IProject project,
+ ZipOutputStream outputStream) {
+ try {
+ for (Artifact reference : storedAssets.getArtifact()) {
+
+ InputStream inputStream = project.getFile(reference.getPath())
+ .getContents();
+ byte[] theBytes;
+ theBytes = new byte[inputStream.available()];
+ inputStream.read(theBytes);
+ outputStream.putNextEntry(new ZipEntry(reference.getName()));
+ outputStream.write(theBytes);
+ outputStream.closeEntry();
+ }
+ } catch (Exception e) {
+ throw new RuntimeException("Unable to inject artifacts");
+ }
+ }
+
+}
Propchange: incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/engine/ArtifactInjector.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/engine/AssetsInjector.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/engine/AssetsInjector.java?rev=379627&r1=379626&r2=379627&view=diff
==============================================================================
--- incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/engine/AssetsInjector.java (original)
+++ incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/engine/AssetsInjector.java Tue Feb 21 15:40:05 2006
@@ -1,65 +1,65 @@
-/*
- * Copyright 2005-2006 The Apache Software Foundation.
- *
- * Licensed 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.servicemix.packaging.engine;
-
-import java.io.StringWriter;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipOutputStream;
-
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.Marshaller;
-
-import org.apache.servicemix.descriptors.packaging.assets.Assets;
-import org.apache.servicemix.packaging.model.BindingComponent;
-import org.apache.servicemix.packaging.model.ModelElement;
-import org.apache.servicemix.packaging.model.ServiceUnit;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IProgressMonitor;
-
-public class AssetsInjector implements PackagingInjector {
-
- private Assets storedAssets;
-
- public boolean canInject(ModelElement modelElement) {
- if (modelElement instanceof BindingComponent) {
- storedAssets = ((BindingComponent) modelElement).getStoredAssets();
- return true;
- }
- if (modelElement instanceof ServiceUnit) {
- storedAssets = ((ServiceUnit) modelElement).getStoredAssets();
- return true;
- }
- return false;
- }
-
- public void inject(IProgressMonitor monitor, IProject project,
- ZipOutputStream outputStream) {
- try {
- JAXBContext context = JAXBContext.newInstance(Assets.class
- .getPackage().getName());
- Marshaller m = context.createMarshaller();
- final StringWriter write = new StringWriter();
- m.marshal(storedAssets, write);
- outputStream.putNextEntry(new ZipEntry(
- "META-INF/bundled-assets.xml"));
- outputStream.write(write.toString().getBytes());
- outputStream.closeEntry();
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
-
-}
+/*
+ * Copyright 2005-2006 The Apache Software Foundation.
+ *
+ * Licensed 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.servicemix.packaging.engine;
+
+import java.io.StringWriter;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipOutputStream;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.Marshaller;
+
+import org.apache.servicemix.descriptors.packaging.assets.Assets;
+import org.apache.servicemix.packaging.model.BindingComponent;
+import org.apache.servicemix.packaging.model.ModelElement;
+import org.apache.servicemix.packaging.model.ServiceUnit;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IProgressMonitor;
+
+public class AssetsInjector implements PackagingInjector {
+
+ private Assets storedAssets;
+
+ public boolean canInject(ModelElement modelElement) {
+ if (modelElement instanceof BindingComponent) {
+ storedAssets = ((BindingComponent) modelElement).getStoredAssets();
+ return true;
+ }
+ if (modelElement instanceof ServiceUnit) {
+ storedAssets = ((ServiceUnit) modelElement).getStoredAssets();
+ return true;
+ }
+ return false;
+ }
+
+ public void inject(IProgressMonitor monitor, IProject project,
+ ZipOutputStream outputStream) {
+ try {
+ JAXBContext context = JAXBContext.newInstance(Assets.class
+ .getPackage().getName());
+ Marshaller m = context.createMarshaller();
+ final StringWriter write = new StringWriter();
+ m.marshal(storedAssets, write);
+ outputStream.putNextEntry(new ZipEntry(
+ "META-INF/bundled-assets.xml"));
+ outputStream.write(write.toString().getBytes());
+ outputStream.closeEntry();
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+}
Propchange: incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/engine/AssetsInjector.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/engine/BindingComponentPackagingEngine.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/engine/BindingComponentPackagingEngine.java?rev=379627&r1=379626&r2=379627&view=diff
==============================================================================
--- incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/engine/BindingComponentPackagingEngine.java (original)
+++ incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/engine/BindingComponentPackagingEngine.java Tue Feb 21 15:40:05 2006
@@ -1,72 +1,72 @@
-/*
- * Copyright 2005-2006 The Apache Software Foundation.
- *
- * Licensed 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.servicemix.packaging.engine;
-
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.util.zip.ZipOutputStream;
-
-import org.apache.servicemix.packaging.model.BindingComponent;
-import org.apache.servicemix.packaging.model.ModelElement;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IProgressMonitor;
-
-public class BindingComponentPackagingEngine extends AbstractPackagingEngine {
-
- private BindingComponent bindingComponent;
-
- public boolean canDeploy(ModelElement modelElement) {
- if (modelElement instanceof BindingComponent) {
- bindingComponent = (BindingComponent) modelElement;
- setArtifact(bindingComponent.getComponentArtifact());
- return true;
- }
- return false;
- }
-
- public void deploy(IProgressMonitor monitor, IProject project) {
-
- ZipOutputStream out = null;
- try {
- String fileName = "/"
- + bindingComponent.getServiceName().getLocalPart()
- + "-bc.zip";
- out = new ZipOutputStream(new FileOutputStream(
- getInstallPath(bindingComponent) + fileName));
-
- for (PackagingInjector injector : getInjectors()) {
- if (injector.canInject(bindingComponent)) {
- injector.inject(monitor, project, out);
- }
- }
- } catch (Throwable e) {
- throw new RuntimeException(e);
- } finally {
- if (out != null)
- try {
- out.close();
- } catch (IOException e) {
- // Ignore?
- }
- }
- }
-
- public void undeploy(IProgressMonitor monitor, IProject project) {
- // TODO Needs implementing
-
- }
-
-}
+/*
+ * Copyright 2005-2006 The Apache Software Foundation.
+ *
+ * Licensed 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.servicemix.packaging.engine;
+
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.util.zip.ZipOutputStream;
+
+import org.apache.servicemix.packaging.model.BindingComponent;
+import org.apache.servicemix.packaging.model.ModelElement;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IProgressMonitor;
+
+public class BindingComponentPackagingEngine extends AbstractPackagingEngine {
+
+ private BindingComponent bindingComponent;
+
+ public boolean canDeploy(ModelElement modelElement) {
+ if (modelElement instanceof BindingComponent) {
+ bindingComponent = (BindingComponent) modelElement;
+ setArtifact(bindingComponent.getComponentArtifact());
+ return true;
+ }
+ return false;
+ }
+
+ public void deploy(IProgressMonitor monitor, IProject project) {
+
+ ZipOutputStream out = null;
+ try {
+ String fileName = "/"
+ + bindingComponent.getServiceName().getLocalPart()
+ + "-bc.zip";
+ out = new ZipOutputStream(new FileOutputStream(
+ getInstallPath(bindingComponent) + fileName));
+
+ for (PackagingInjector injector : getInjectors()) {
+ if (injector.canInject(bindingComponent)) {
+ injector.inject(monitor, project, out);
+ }
+ }
+ } catch (Throwable e) {
+ throw new RuntimeException(e);
+ } finally {
+ if (out != null)
+ try {
+ out.close();
+ } catch (IOException e) {
+ // Ignore?
+ }
+ }
+ }
+
+ public void undeploy(IProgressMonitor monitor, IProject project) {
+ // TODO Needs implementing
+
+ }
+
+}
Propchange: incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/engine/BindingComponentPackagingEngine.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/engine/ComponentFilesInjector.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/engine/ComponentFilesInjector.java?rev=379627&r1=379626&r2=379627&view=diff
==============================================================================
--- incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/engine/ComponentFilesInjector.java (original)
+++ incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/engine/ComponentFilesInjector.java Tue Feb 21 15:40:05 2006
@@ -1,63 +1,63 @@
-/*
- * Copyright 2005-2006 The Apache Software Foundation.
- *
- * Licensed 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.servicemix.packaging.engine;
-
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipOutputStream;
-
-import org.apache.servicemix.packaging.ComponentArtifact;
-import org.apache.servicemix.packaging.model.BindingComponent;
-import org.apache.servicemix.packaging.model.ModelElement;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IProgressMonitor;
-
-public class ComponentFilesInjector implements PackagingInjector {
-
- private ComponentArtifact artifact;
-
- private String componentName;
-
- public boolean canInject(ModelElement modelElement) {
- if (modelElement instanceof BindingComponent) {
- componentName = ((BindingComponent) modelElement)
- .getComponentName();
- artifact = ((BindingComponent) modelElement).getComponentArtifact();
- return true;
- }
- return false;
- }
-
- public void inject(IProgressMonitor monitor, IProject project,
- ZipOutputStream outputStream) {
- try {
- for (String fileName : artifact.getResourceMap().keySet()) {
- if (!fileName.equals("META-INF/components.xml")) {
- if (fileName.equals(artifact.getComponentDefinitionByName(
- componentName).getAssets().getJbiDescriptor())) {
- outputStream.putNextEntry(new ZipEntry(
- "META-INF/jbi.xml"));
- } else
- outputStream.putNextEntry(new ZipEntry(fileName));
- outputStream.write(artifact.getResourceMap().get(fileName));
- outputStream.closeEntry();
- }
- }
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
-
-}
+/*
+ * Copyright 2005-2006 The Apache Software Foundation.
+ *
+ * Licensed 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.servicemix.packaging.engine;
+
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipOutputStream;
+
+import org.apache.servicemix.packaging.ComponentArtifact;
+import org.apache.servicemix.packaging.model.BindingComponent;
+import org.apache.servicemix.packaging.model.ModelElement;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IProgressMonitor;
+
+public class ComponentFilesInjector implements PackagingInjector {
+
+ private ComponentArtifact artifact;
+
+ private String componentName;
+
+ public boolean canInject(ModelElement modelElement) {
+ if (modelElement instanceof BindingComponent) {
+ componentName = ((BindingComponent) modelElement)
+ .getComponentName();
+ artifact = ((BindingComponent) modelElement).getComponentArtifact();
+ return true;
+ }
+ return false;
+ }
+
+ public void inject(IProgressMonitor monitor, IProject project,
+ ZipOutputStream outputStream) {
+ try {
+ for (String fileName : artifact.getResourceMap().keySet()) {
+ if (!fileName.equals("META-INF/components.xml")) {
+ if (fileName.equals(artifact.getComponentDefinitionByName(
+ componentName).getAssets().getJbiDescriptor())) {
+ outputStream.putNextEntry(new ZipEntry(
+ "META-INF/jbi.xml"));
+ } else
+ outputStream.putNextEntry(new ZipEntry(fileName));
+ outputStream.write(artifact.getResourceMap().get(fileName));
+ outputStream.closeEntry();
+ }
+ }
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+}
Propchange: incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/engine/ComponentFilesInjector.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/engine/ManifestInjector.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/engine/ManifestInjector.java?rev=379627&r1=379626&r2=379627&view=diff
==============================================================================
--- incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/engine/ManifestInjector.java (original)
+++ incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/engine/ManifestInjector.java Tue Feb 21 15:40:05 2006
@@ -1,47 +1,47 @@
-/*
- * Copyright 2005-2006 The Apache Software Foundation.
- *
- * Licensed 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.servicemix.packaging.engine;
-
-import java.io.StringWriter;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipOutputStream;
-
-import org.apache.servicemix.packaging.model.ModelElement;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IProgressMonitor;
-
-public class ManifestInjector implements PackagingInjector {
-
- public boolean canInject(ModelElement modelElement) {
- return true;
- }
-
- public void inject(IProgressMonitor monitor, IProject project,
- ZipOutputStream outputStream) {
- try {
- StringWriter stringWriter = new StringWriter();
- stringWriter.write("Created-By: ServiceMix JBI Packager");
- stringWriter.write("Built-By:" + System.getProperty("user.name"));
- stringWriter.write("Built-By:" + System.getProperty("user.name"));
- outputStream.putNextEntry(new ZipEntry("META-INF/MANIFEST.MF"));
- outputStream.write(stringWriter.toString().getBytes());
- outputStream.closeEntry();
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
-
-}
+/*
+ * Copyright 2005-2006 The Apache Software Foundation.
+ *
+ * Licensed 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.servicemix.packaging.engine;
+
+import java.io.StringWriter;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipOutputStream;
+
+import org.apache.servicemix.packaging.model.ModelElement;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IProgressMonitor;
+
+public class ManifestInjector implements PackagingInjector {
+
+ public boolean canInject(ModelElement modelElement) {
+ return true;
+ }
+
+ public void inject(IProgressMonitor monitor, IProject project,
+ ZipOutputStream outputStream) {
+ try {
+ StringWriter stringWriter = new StringWriter();
+ stringWriter.write("Created-By: ServiceMix JBI Packager");
+ stringWriter.write("Built-By:" + System.getProperty("user.name"));
+ stringWriter.write("Built-By:" + System.getProperty("user.name"));
+ outputStream.putNextEntry(new ZipEntry("META-INF/MANIFEST.MF"));
+ outputStream.write(stringWriter.toString().getBytes());
+ outputStream.closeEntry();
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+}
Propchange: incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/engine/ManifestInjector.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/engine/PackagingEngine.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/engine/PackagingEngine.java?rev=379627&r1=379626&r2=379627&view=diff
==============================================================================
--- incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/engine/PackagingEngine.java (original)
+++ incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/engine/PackagingEngine.java Tue Feb 21 15:40:05 2006
@@ -1,34 +1,34 @@
-/*
- * Copyright 2005-2006 The Apache Software Foundation.
- *
- * Licensed 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.servicemix.packaging.engine;
-
-import java.util.List;
-
-import org.apache.servicemix.packaging.model.ModelElement;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IProgressMonitor;
-
-public interface PackagingEngine {
-
- public boolean canDeploy(ModelElement modelElement);
-
- public void deploy(IProgressMonitor monitor, IProject project);
-
- public void undeploy(IProgressMonitor monitor, IProject project);
-
- public void setInjectors(List<PackagingInjector> injectors);
-
-}
+/*
+ * Copyright 2005-2006 The Apache Software Foundation.
+ *
+ * Licensed 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.servicemix.packaging.engine;
+
+import java.util.List;
+
+import org.apache.servicemix.packaging.model.ModelElement;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IProgressMonitor;
+
+public interface PackagingEngine {
+
+ public boolean canDeploy(ModelElement modelElement);
+
+ public void deploy(IProgressMonitor monitor, IProject project);
+
+ public void undeploy(IProgressMonitor monitor, IProject project);
+
+ public void setInjectors(List<PackagingInjector> injectors);
+
+}
Propchange: incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/engine/PackagingEngine.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/engine/PackagingInjector.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/engine/PackagingInjector.java?rev=379627&r1=379626&r2=379627&view=diff
==============================================================================
--- incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/engine/PackagingInjector.java (original)
+++ incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/engine/PackagingInjector.java Tue Feb 21 15:40:05 2006
@@ -1,31 +1,31 @@
-/*
- * Copyright 2005-2006 The Apache Software Foundation.
- *
- * Licensed 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.servicemix.packaging.engine;
-
-import java.util.zip.ZipOutputStream;
-
-import org.apache.servicemix.packaging.model.ModelElement;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IProgressMonitor;
-
-public interface PackagingInjector {
-
- public boolean canInject(ModelElement modelElement);
-
- public void inject(IProgressMonitor monitor, IProject project,
- ZipOutputStream outputStream);
-
-}
+/*
+ * Copyright 2005-2006 The Apache Software Foundation.
+ *
+ * Licensed 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.servicemix.packaging.engine;
+
+import java.util.zip.ZipOutputStream;
+
+import org.apache.servicemix.packaging.model.ModelElement;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IProgressMonitor;
+
+public interface PackagingInjector {
+
+ public boolean canInject(ModelElement modelElement);
+
+ public void inject(IProgressMonitor monitor, IProject project,
+ ZipOutputStream outputStream);
+
+}
Propchange: incubator/servicemix/trunk/tooling/servicemix-packaging-eclipse-plugin/src/main/java/org/apache/servicemix/packaging/engine/PackagingInjector.java
------------------------------------------------------------------------------
svn:eol-style = native